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 4181610B9A for ; Mon, 4 Nov 2013 13:56:53 +0000 (UTC) Received: (qmail 72037 invoked by uid 500); 4 Nov 2013 13:51:59 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 71243 invoked by uid 500); 4 Nov 2013 13:50:44 -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 70254 invoked by uid 99); 4 Nov 2013 13:49:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Nov 2013 13:49:54 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Nov 2013 13:49:52 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 8EDDF23888E7; Mon, 4 Nov 2013 13:49:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1538604 - /cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java Date: Mon, 04 Nov 2013 13:49:32 -0000 To: commits@cxf.apache.org From: coheigea@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131104134932.8EDDF23888E7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: coheigea Date: Mon Nov 4 13:49:32 2013 New Revision: 1538604 URL: http://svn.apache.org/r1538604 Log: [CXF-5048] - StaticSTSProperties class requires a CXF message context to initialize using configure() method Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java Modified: cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java URL: http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java?rev=1538604&r1=1538603&r2=1538604&view=diff ============================================================================== --- cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java (original) +++ cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/StaticSTSProperties.java Mon Nov 4 13:49:32 2013 @@ -28,9 +28,9 @@ import java.util.logging.Logger; import javax.security.auth.callback.CallbackHandler; import org.apache.cxf.Bus; +import org.apache.cxf.BusFactory; import org.apache.cxf.common.classloader.ClassLoaderUtils; import org.apache.cxf.common.logging.LogUtils; -import org.apache.cxf.phase.PhaseInterceptorChain; import org.apache.cxf.resource.ResourceManager; import org.apache.cxf.sts.service.EncryptionProperties; import org.apache.cxf.sts.token.realm.Relationship; @@ -65,13 +65,14 @@ public class StaticSTSProperties impleme private List relationships; private RelationshipResolver relationshipResolver; private SAMLRealmCodec samlRealmCodec; + private Bus bus; /** * Load the CallbackHandler, Crypto objects, if necessary. */ public void configureProperties() throws STSException { if (signatureCrypto == null && signatureCryptoProperties != null) { - Properties sigProperties = getProps(signatureCryptoProperties); + Properties sigProperties = getProps(signatureCryptoProperties, bus); if (sigProperties == null) { LOG.fine("Cannot load signature properties using: " + signatureCryptoProperties); throw new STSException("Configuration error: cannot load signature properties"); @@ -85,7 +86,7 @@ public class StaticSTSProperties impleme } if (encryptionCrypto == null && encryptionCryptoProperties != null) { - Properties encrProperties = getProps(encryptionCryptoProperties); + Properties encrProperties = getProps(encryptionCryptoProperties, bus); if (encrProperties == null) { LOG.fine("Cannot load encryption properties using: " + encryptionCryptoProperties); throw new STSException("Configuration error: cannot load encryption properties"); @@ -321,14 +322,17 @@ public class StaticSTSProperties impleme return identityMapper; } - private static Properties getProps(Object o) { + private static Properties getProps(Object o, Bus bus) { Properties properties = null; if (o instanceof Properties) { properties = (Properties)o; } else if (o instanceof String) { URL url = null; - Bus bus = PhaseInterceptorChain.getCurrentMessage().getExchange().getBus(); - ResourceManager rm = bus.getExtension(ResourceManager.class); + Bus b = bus; + if (b == null) { + b = BusFactory.getThreadDefaultBus(); + } + ResourceManager rm = b.getExtension(ResourceManager.class); url = rm.resolveResource((String)o, URL.class); try { if (url == null) { @@ -397,4 +401,12 @@ public class StaticSTSProperties impleme public void setSamlRealmCodec(SAMLRealmCodec samlRealmCodec) { this.samlRealmCodec = samlRealmCodec; } + + public Bus getBus() { + return bus; + } + + public void setBus(Bus bus) { + this.bus = bus; + } }