Repository: cxf Updated Branches: refs/heads/master ee7be61ee -> 2dae57133
[CXF-6534] - Another attempt at this to try to get jenkins builds passing Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/2dae5713 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2dae5713 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2dae5713 Branch: refs/heads/master Commit: 2dae571339fc9979c6ec34862973eb32c53f7e28 Parents: ee7be61 Author: Colm O hEigeartaigh <[email protected]> Authored: Tue Aug 25 14:55:09 2015 +0100 Committer: Colm O hEigeartaigh <[email protected]> Committed: Tue Aug 25 14:55:32 2015 +0100 ---------------------------------------------------------------------- .../http/auth/AbstractSpnegoAuthSupplier.java | 34 ++++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/2dae5713/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/AbstractSpnegoAuthSupplier.java ---------------------------------------------------------------------- diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/AbstractSpnegoAuthSupplier.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/AbstractSpnegoAuthSupplier.java index f284072..713b55c 100644 --- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/AbstractSpnegoAuthSupplier.java +++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/auth/AbstractSpnegoAuthSupplier.java @@ -101,27 +101,11 @@ public abstract class AbstractSpnegoAuthSupplier { Message message) throws GSSException, LoginException { - GSSManager manager = GSSManager.getInstance(); - GSSName serverName = manager.createName(spn, serviceNameType); - GSSCredential delegatedCred = (GSSCredential)message.getContextualProperty(GSSCredential.class.getName()); - GSSContext context = manager - .createContext(serverName.canonicalize(oid), oid, delegatedCred, GSSContext.DEFAULT_LIFETIME); - - context.requestCredDeleg(isCredDelegationRequired(message)); - - // If the delegated cred is not null then we only need the context to - // immediately return a ticket based on this credential without attempting - // to log on again - final byte[] token = new byte[0]; - if (delegatedCred != null) { - return context.initSecContext(token, 0, token.length); - } - Subject subject = null; - if (authPolicy != null) { + if (authPolicy != null && delegatedCred == null) { String contextName = authPolicy.getAuthorization(); if (contextName == null) { contextName = ""; @@ -137,6 +121,22 @@ public abstract class AbstractSpnegoAuthSupplier { } } + GSSManager manager = GSSManager.getInstance(); + GSSName serverName = manager.createName(spn, serviceNameType); + + GSSContext context = manager + .createContext(serverName.canonicalize(oid), oid, delegatedCred, GSSContext.DEFAULT_LIFETIME); + + context.requestCredDeleg(isCredDelegationRequired(message)); + + // If the delegated cred is not null then we only need the context to + // immediately return a ticket based on this credential without attempting + // to log on again + final byte[] token = new byte[0]; + if (delegatedCred != null) { + return context.initSecContext(token, 0, token.length); + } + try { return (byte[])Subject.doAs(subject, new CreateServiceTicketAction(context, token)); } catch (PrivilegedActionException e) {
