Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C3AE2183B7 for ; Tue, 25 Aug 2015 13:55:37 +0000 (UTC) Received: (qmail 84077 invoked by uid 500); 25 Aug 2015 13:55:37 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 84010 invoked by uid 500); 25 Aug 2015 13:55:37 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 83995 invoked by uid 99); 25 Aug 2015 13:55:37 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Aug 2015 13:55:37 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0F48BE00D6; Tue, 25 Aug 2015 13:55:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: coheigea@apache.org To: commits@cxf.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: cxf git commit: [CXF-6534] - Another attempt at this to try to get jenkins builds passing Date: Tue, 25 Aug 2015 13:55:36 +0000 (UTC) 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 Authored: Tue Aug 25 14:55:09 2015 +0100 Committer: Colm O hEigeartaigh 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) {