Author: anil.saldhana(a)jboss.com
Date: 2011-01-05 12:20:12 -0500 (Wed, 05 Jan 2011)
New Revision: 628
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/interfaces/ProtocolContext.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/interfaces/SecurityTokenProvider.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/common/SAMLProtocolContext.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/providers/SAML20AssertionTokenProvider.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/sts/PicketLinkCoreSTS.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/sts/STSCoreConfig.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/PicketLinkSTSConfiguration.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/StandardRequestHandler.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/WSTrustRequestContext.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/wrappers/RequestSecurityToken.java
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/SpecialTokenProvider.java
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/core/HTTPContext.java
Log:
bring in family to the token provider
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/interfaces/ProtocolContext.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/interfaces/ProtocolContext.java 2011-01-04
17:39:13 UTC (rev 627)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/interfaces/ProtocolContext.java 2011-01-05
17:20:12 UTC (rev 628)
@@ -47,4 +47,12 @@
* @return
*/
QName getQName();
+
+ /**
+ * What family the context belongs to..
+ * @see {@code SecurityTokenProvider#family()}
+ * @see {@code FAMILY_TYPE}
+ * @return
+ */
+ String family();
}
\ No newline at end of file
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/interfaces/SecurityTokenProvider.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/interfaces/SecurityTokenProvider.java 2011-01-04
17:39:13 UTC (rev 627)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/interfaces/SecurityTokenProvider.java 2011-01-05
17:20:12 UTC (rev 628)
@@ -38,6 +38,15 @@
public interface SecurityTokenProvider
{
/**
+ * An enumeration that identifies the family to which
+ * the security token provider belongs
+ */
+ public enum FAMILY_TYPE
+ {
+ SAML2, WS_TRUST,OPENID,OAUTH, CUSTOM;
+ }
+
+ /**
* <p>
* Initializes the {@code SecurityTokenProvider} using the specified properties map.
* </p>
@@ -65,6 +74,14 @@
* @return
*/
public QName getSupportedQName();
+
+
+ /**
+ * The family where this security token provider belongs
+ * @see {@code FAMILY_TYPE}}
+ * @return
+ */
+ public String family();
/**
* <p>
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/common/SAMLProtocolContext.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/common/SAMLProtocolContext.java 2011-01-04
17:39:13 UTC (rev 627)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/common/SAMLProtocolContext.java 2011-01-05
17:20:12 UTC (rev 628)
@@ -28,6 +28,7 @@
import javax.xml.namespace.QName;
import org.picketlink.identity.federation.core.interfaces.ProtocolContext;
+import org.picketlink.identity.federation.core.interfaces.SecurityTokenProvider;
import org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLConstants;
import org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLURIConstants;
import org.picketlink.identity.federation.core.sts.PicketLinkCoreSTS;
@@ -117,20 +118,37 @@
this.issuedAssertion = issuedAssertion;
}
+ /**
+ * @see
org.picketlink.identity.federation.core.interfaces.ProtocolContext#serviceName()
+ */
public String serviceName()
{
return null;
}
+ /**
+ * @see
org.picketlink.identity.federation.core.interfaces.ProtocolContext#tokenType()
+ */
public String tokenType()
{
return JBossSAMLURIConstants.ASSERTION_NSURI.get();
}
+ /**
+ * @see org.picketlink.identity.federation.core.interfaces.ProtocolContext#getQName()
+ */
public QName getQName()
{
String localPart = JBossSAMLConstants.ASSERTION.get();
String ns = tokenType();
return new QName( ns, localPart );
+ }
+
+ /**
+ * @see org.picketlink.identity.federation.core.interfaces.ProtocolContext#family()
+ */
+ public String family()
+ {
+ return SecurityTokenProvider.FAMILY_TYPE.SAML2.toString();
}
}
\ No newline at end of file
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/providers/SAML20AssertionTokenProvider.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/providers/SAML20AssertionTokenProvider.java 2011-01-04
17:39:13 UTC (rev 627)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v2/providers/SAML20AssertionTokenProvider.java 2011-01-05
17:20:12 UTC (rev 628)
@@ -287,5 +287,13 @@
public QName getSupportedQName()
{
return new QName( NS, JBossSAMLConstants.ASSERTION.get() );
+ }
+
+ /**
+ * @see
org.picketlink.identity.federation.core.interfaces.SecurityTokenProvider#family()
+ */
+ public String family()
+ {
+ return SecurityTokenProvider.FAMILY_TYPE.SAML2.toString();
}
}
\ No newline at end of file
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/sts/PicketLinkCoreSTS.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/sts/PicketLinkCoreSTS.java 2011-01-04
17:39:13 UTC (rev 627)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/sts/PicketLinkCoreSTS.java 2011-01-05
17:20:12 UTC (rev 628)
@@ -21,10 +21,9 @@
*/
package org.picketlink.identity.federation.core.sts;
-import java.util.List;
-
import javax.xml.namespace.QName;
+import org.apache.log4j.Logger;
import org.picketlink.identity.federation.core.exceptions.ProcessingException;
import org.picketlink.identity.federation.core.interfaces.ProtocolContext;
import org.picketlink.identity.federation.core.interfaces.SecurityTokenProvider;
@@ -45,6 +44,7 @@
*/
public class PicketLinkCoreSTS
{
+ private static final Logger logger = Logger.getLogger( PicketLinkCoreSTS.class );
public static final RuntimePermission rte = new RuntimePermission(
"org.picketlink.sts" );
protected STSCoreConfig configuration;
@@ -67,9 +67,7 @@
{
if( this.configuration != null )
{
- List<SecurityTokenProvider> providers = config.getTokenProviders();
- for( SecurityTokenProvider provider: providers )
- this.configuration.addTokenProvider( provider.tokenType(), provider );
+ this.configuration.copy(config);
}
else
this.configuration = config;
@@ -99,8 +97,13 @@
SecurityTokenProvider provider = getProvider(protocolContext);
if( provider == null )
- throw new ProcessingException( "No Security Token Provider found in
configuration" );
+ throw new ProcessingException( "No Security Token Provider found in
configuration:" + protocolContext );
+ if( logger.isDebugEnabled() )
+ {
+ logger.debug( "issueToken::provider=" + provider );
+ }
+
provider.issueToken( protocolContext );
}
@@ -124,7 +127,14 @@
if( provider == null )
provider = getProviderBasedOnQName(protocolContext);
-
+
+ if( provider == null )
+ throw new ProcessingException( "No Security Token Provider found in
configuration:" + protocolContext );
+
+ if( logger.isDebugEnabled() )
+ {
+ logger.debug( "renewToken::provider=" + provider );
+ }
provider.renewToken( protocolContext );
}
@@ -148,7 +158,15 @@
if( provider == null )
provider = getProviderBasedOnQName(protocolContext);
-
+
+ if( provider == null )
+ throw new ProcessingException( "No Security Token Provider found in
configuration:" + protocolContext );
+
+ if( logger.isDebugEnabled() )
+ {
+ logger.debug( "cancelToken::provider=" + provider );
+ }
+
provider.cancelToken( protocolContext );
}
@@ -172,7 +190,15 @@
if( provider == null )
provider = getProviderBasedOnQName(protocolContext);
-
+
+ if( provider == null )
+ throw new ProcessingException( "No Security Token Provider found in
configuration:" + protocolContext );
+
+ if( logger.isDebugEnabled() )
+ {
+ logger.debug( "validateToken::provider=" + provider );
+ }
+
provider.validateToken( protocolContext );
}
@@ -210,10 +236,8 @@
qname = protocolContext.getQName();
if( qname == null )
throw new ProcessingException( "QName of the token type is null "
);
- provider =
this.configuration.getProviderForTokenElementNS(qname.getLocalPart(),
- qname.getNamespaceURI());
- }
-
+ provider = this.configuration.getProviderForTokenElementNS(
protocolContext.family(), qname );
+ }
if (provider == null)
throw new ProcessingException("No SecurityTokenProvider configured for
" + qname.getNamespaceURI() + ":"
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/sts/STSCoreConfig.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/sts/STSCoreConfig.java 2011-01-04
17:39:13 UTC (rev 627)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/sts/STSCoreConfig.java 2011-01-05
17:20:12 UTC (rev 628)
@@ -26,6 +26,8 @@
import java.security.cert.Certificate;
import java.util.List;
+import javax.xml.namespace.QName;
+
import org.picketlink.identity.federation.core.interfaces.SecurityTokenProvider;
/**
@@ -36,6 +38,8 @@
*/
public interface STSCoreConfig
{
+ public void copy( STSCoreConfig thatConfig );
+
/**
* <p>
* Obtains the unique name of the secure token service.
@@ -93,6 +97,14 @@
public String getTokenTypeForService(String serviceName);
/**
+ * Get a list of {@code SecurityTokenProvider} that belong to a family
+ * @see {@code SecurityTokenProvider#family()}
+ * @param familyName
+ * @return
+ */
+ public List<SecurityTokenProvider> getProvidersByFamily( String familyName );
+
+ /**
* <p>
* Given the name of a service provider, obtains the provider that must be used when
issuing tokens to clients of
* that service. When requesting a token to the STS, a client can specify the service
it needs the token for using
@@ -127,13 +139,13 @@
* the {@code SecurityTokenProvider} must be determined using the security token
itself.
* </p>
*
- * @param tokenLocalName a {@code String} representing the token element name. (e.g.
{@code Assertion}).
- * @param tokenNamespace a {@code String} representing the token element namespace.
(e.g.
+ * @param family a {@code String} representing the family
+ * @param qname a {@code QName} representing the token element namespace. (e.g.
* {@code urn:oasis:names:tc:SAML:2.0:assertion}).
* @return a reference to the {@code SecurityTokenProvider} that must be used to
handle the request that contains
* only the security token.
*/
- public SecurityTokenProvider getProviderForTokenElementNS(String tokenLocalName,
String tokenNamespace);
+ public SecurityTokenProvider getProviderForTokenElementNS(String family, QName qname
);
/**
* <p>
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/PicketLinkSTSConfiguration.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/PicketLinkSTSConfiguration.java 2011-01-04
17:39:13 UTC (rev 627)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/PicketLinkSTSConfiguration.java 2011-01-05
17:20:12 UTC (rev 628)
@@ -46,6 +46,7 @@
import org.picketlink.identity.federation.core.interfaces.SecurityTokenProvider;
import org.picketlink.identity.federation.core.interfaces.TrustKeyManager;
import org.picketlink.identity.federation.core.sts.PicketLinkCoreSTS;
+import org.picketlink.identity.federation.core.sts.STSCoreConfig;
import org.picketlink.identity.federation.core.util.CoreConfigUtil;
/**
@@ -125,7 +126,8 @@
provider.getProviderClass(), properties);
// token providers can be keyed by the token type and by token element +
namespace.
this.tokenProviders.put(provider.getTokenType(), tokenProvider);
- String tokenElementAndNS = provider.getTokenElement() + "$" +
provider.getTokenElementNS();
+ String tokenElementAndNS =
+ tokenProvider.family() + "$" + provider.getTokenElement() +
"$" + provider.getTokenElementNS();
this.tokenProviders.put(tokenElementAndNS, tokenProvider);
}
}
@@ -272,14 +274,13 @@
return this.tokenProviders.get(tokenType);
}
- /*
- * (non-Javadoc)
- *
- * @see
org.picketlink.identity.federation.core.wstrust.STSConfiguration#getProviderForTokenElementNS(java.lang.String,
java.lang.String)
+ /**
+ * @see
org.picketlink.identity.federation.core.sts.STSCoreConfig#getProviderForTokenElementNS(java.lang.String,
javax.xml.namespace.QName)
*/
- public SecurityTokenProvider getProviderForTokenElementNS(String tokenLocalName,
String tokenNamespace)
+ public SecurityTokenProvider getProviderForTokenElementNS(String family, QName
tokenQName)
{
- return this.tokenProviders.get(tokenLocalName + "$" + tokenNamespace);
+ return this.tokenProviders.get( family + "$" +
+ tokenQName.getLocalPart() + "$" + tokenQName.getNamespaceURI() );
}
/*
@@ -400,7 +401,9 @@
QName tokenQName = provider.getSupportedQName();
if( tokenQName != null )
{
- String tokenElementAndNS = tokenQName.getLocalPart() + "$" +
tokenQName.getNamespaceURI() ;
+ String tokenElementAndNS =
+ provider.family() + "$" + tokenQName.getLocalPart() + "$"
+ tokenQName.getNamespaceURI() ;
+
this.tokenProviders.put(tokenElementAndNS, provider );
}
}
@@ -426,4 +429,33 @@
list.addAll( tokenProviders .values());
return Collections.unmodifiableList(list);
}
+
+ /**
+ * @see
org.picketlink.identity.federation.core.sts.STSCoreConfig#getProvidersByFamily(java.lang.String)
+ */
+ public List<SecurityTokenProvider> getProvidersByFamily( String familyName )
+ {
+ List<SecurityTokenProvider> result = new
ArrayList<SecurityTokenProvider>();
+ for( SecurityTokenProvider provider: tokenProviders.values() )
+ {
+ if( provider.family().equals( familyName ))
+ result.add(provider);
+ }
+ return result;
+ }
+
+ /**
+ * @see
org.picketlink.identity.federation.core.sts.STSCoreConfig#copy(org.picketlink.identity.federation.core.sts.STSCoreConfig)
+ */
+ public void copy(STSCoreConfig thatConfig)
+ {
+ if( thatConfig instanceof PicketLinkSTSConfiguration )
+ {
+ PicketLinkSTSConfiguration pc = (PicketLinkSTSConfiguration) thatConfig;
+ this.tokenProviders.putAll( pc.tokenProviders );
+ this.claimsProcessors.putAll( pc.claimsProcessors );
+ }
+ else
+ throw new RuntimeException( "Unknown config :" + thatConfig );
//TODO: Handle other configuration
+ }
}
\ No newline at end of file
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/StandardRequestHandler.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/StandardRequestHandler.java 2011-01-04
17:39:13 UTC (rev 627)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/StandardRequestHandler.java 2011-01-05
17:20:12 UTC (rev 628)
@@ -282,8 +282,13 @@
// construct the ws-trust security token response.
RequestedSecurityTokenType requestedSecurityToken = new
RequestedSecurityTokenType();
-
requestedSecurityToken.setAny(requestContext.getSecurityToken().getTokenValue());
+ SecurityToken contextSecurityToken = requestContext.getSecurityToken();
+ if( contextSecurityToken == null )
+ throw new WSTrustException( "Security Token from context is null"
);
+
+ requestedSecurityToken.setAny( contextSecurityToken.getTokenValue());
+
RequestSecurityTokenResponse response = new RequestSecurityTokenResponse();
if (request.getContext() != null)
response.setContext(request.getContext());
@@ -379,9 +384,13 @@
context.setOnBehalfOfPrincipal(onBehalfOfPrincipal);
}
try
- {
+ {
if( securityToken != null )
- context.setQName( new QName( securityToken.getNamespaceURI(),
securityToken.getLocalName() ));
+ {
+ String ns = securityToken.getNamespaceURI();
+
+ context.setQName( new QName( ns, securityToken.getLocalName() ));
+ }
PicketLinkCoreSTS sts = PicketLinkCoreSTS.instance();
sts.initialize(configuration);
sts.renewToken(context);
@@ -394,7 +403,10 @@
// create the WS-Trust response with the renewed token.
RequestedSecurityTokenType requestedSecurityToken = new
RequestedSecurityTokenType();
- requestedSecurityToken.setAny(context.getSecurityToken().getTokenValue());
+ SecurityToken contextSecurityToken = context.getSecurityToken();
+ if( contextSecurityToken == null )
+ throw new WSTrustException( "Security Token from context is null" );
+ requestedSecurityToken.setAny(contextSecurityToken.getTokenValue());
RequestSecurityTokenResponse response = new RequestSecurityTokenResponse();
if (request.getContext() != null)
@@ -491,7 +503,7 @@
if (trace)
log.trace("Delegating token validation to token provider");
try
- {
+ {
if( securityToken != null )
context.setQName( new QName( securityToken.getNamespaceURI(),
securityToken.getLocalName() ));
PicketLinkCoreSTS sts = PicketLinkCoreSTS.instance();
@@ -548,7 +560,7 @@
context.setOnBehalfOfPrincipal(onBehalfOfPrincipal);
}
try
- {
+ {
if( securityToken != null )
context.setQName( new QName( securityToken.getNamespaceURI(),
securityToken.getLocalName() ));
PicketLinkCoreSTS sts = PicketLinkCoreSTS.instance();
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/WSTrustRequestContext.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/WSTrustRequestContext.java 2011-01-04
17:39:13 UTC (rev 627)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/WSTrustRequestContext.java 2011-01-05
17:20:12 UTC (rev 628)
@@ -28,6 +28,7 @@
import javax.xml.namespace.QName;
import org.picketlink.identity.federation.core.interfaces.ProtocolContext;
+import org.picketlink.identity.federation.core.interfaces.SecurityTokenProvider;
import org.picketlink.identity.federation.core.wstrust.wrappers.RequestSecurityToken;
import org.picketlink.identity.federation.ws.trust.RequestedReferenceType;
import org.picketlink.identity.federation.ws.trust.StatusType;
@@ -337,11 +338,17 @@
this.unattachedReference = unattachedReference;
}
+ /**
+ * @see
org.picketlink.identity.federation.core.interfaces.ProtocolContext#serviceName()
+ */
public String serviceName()
{
return WSTrustUtil.getServiceNameFromAppliesTo( request );
}
+ /**
+ * @see
org.picketlink.identity.federation.core.interfaces.ProtocolContext#tokenType()
+ */
public String tokenType()
{
return tokenType;
@@ -352,6 +359,9 @@
this.tokenType = tokenType;
}
+ /**
+ * @see org.picketlink.identity.federation.core.interfaces.ProtocolContext#getQName()
+ */
public QName getQName()
{
return qname;
@@ -361,4 +371,23 @@
{
this.qname = qname;
}
+
+ /**
+ * @see org.picketlink.identity.federation.core.interfaces.ProtocolContext#family()
+ */
+ public String family()
+ {
+ return SecurityTokenProvider.FAMILY_TYPE.WS_TRUST.toString();
+ }
+
+
+ @Override
+ public String toString()
+ {
+ return "WSTrustRequestContext [tokenIssuer=" + tokenIssuer + ",
providerPublicKey=" + providerPublicKey
+ + ", onBehalfOfPrincipal=" + onBehalfOfPrincipal + ",
callerPrincipal=" + callerPrincipal + ", request="
+ + request + ", proofTokenInfo=" + proofTokenInfo + ",
claimedAttributes=" + claimedAttributes
+ + ", securityToken=" + securityToken + ", status=" +
status + ", attachedReference=" + attachedReference
+ + ", unattachedReference=" + unattachedReference + ",
tokenType=" + tokenType + ", qname=" + qname + "]";
+ }
}
\ No newline at end of file
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java 2011-01-04
17:39:13 UTC (rev 627)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java 2011-01-05
17:20:12 UTC (rev 628)
@@ -406,7 +406,7 @@
*/
public String tokenType()
{
- return WSTrustConstants.BASE_NAMESPACE;
+ return WSTrustConstants.SAML2_TOKEN_TYPE;
}
/**
@@ -415,5 +415,13 @@
public QName getSupportedQName()
{
return new QName( tokenType(), JBossSAMLConstants.ASSERTION.get() );
+ }
+
+ /**
+ * @see
org.picketlink.identity.federation.core.interfaces.SecurityTokenProvider#family()
+ */
+ public String family()
+ {
+ return SecurityTokenProvider.FAMILY_TYPE.WS_TRUST.toString();
}
}
\ No newline at end of file
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/wrappers/RequestSecurityToken.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/wrappers/RequestSecurityToken.java 2011-01-04
17:39:13 UTC (rev 627)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/wrappers/RequestSecurityToken.java 2011-01-05
17:20:12 UTC (rev 628)
@@ -1208,4 +1208,21 @@
{
this.rstDocument = rstDocument;
}
+
+ @Override
+ public String toString()
+ {
+ return "RequestSecurityToken [delegate=" + delegate + ",
tokenType=" + tokenType + ", requestType=" + requestType
+ + ", appliesTo=" + appliesTo + ", claims=" + claims +
", entropy=" + entropy + ", lifetime=" + lifetime
+ + ", allowPostDating=" + allowPostDating + ", renewing="
+ renewing + ", onBehalfOf=" + onBehalfOf
+ + ", issuer=" + issuer + ", authenticationType=" +
authenticationType + ", keyType=" + keyType
+ + ", keySize=" + keySize + ", signatureAlgorithm=" +
signatureAlgorithm + ", encryption=" + encryption
+ + ", encryptionAlgorithm=" + encryptionAlgorithm + ",
canonicalizationAlgorithm="
+ + canonicalizationAlgorithm + ", keyWrapAlgorithm=" +
keyWrapAlgorithm + ", proofEncryption="
+ + proofEncryption + ", useKey=" + useKey + ", signWith="
+ signWith + ", encryptWith=" + encryptWith
+ + ", delegateTo=" + delegateTo + ", forwardable=" +
forwardable + ", delegatable=" + delegatable
+ + ", policy=" + policy + ", policyReference=" +
policyReference + ", validateTarget=" + validateTarget
+ + ", renewTarget=" + renewTarget + ", cancelTarget=" +
cancelTarget + ", extensionElements="
+ + extensionElements + ", factory=" + factory + ",
rstDocument=" + rstDocument + "]";
+ }
}
\ No newline at end of file
Modified:
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java 2011-01-04
17:39:13 UTC (rev 627)
+++
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java 2011-01-05
17:20:12 UTC (rev 628)
@@ -50,6 +50,8 @@
import org.picketlink.identity.federation.core.interfaces.SecurityTokenProvider;
import org.picketlink.identity.federation.core.parsers.wst.WSTrustParser;
import org.picketlink.identity.federation.core.saml.v2.common.IDGenerator;
+import org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLConstants;
+import org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLURIConstants;
import org.picketlink.identity.federation.core.saml.v2.util.DocumentUtil;
import org.picketlink.identity.federation.core.util.Base64;
import org.picketlink.identity.federation.core.wstrust.PicketLinkSTS;
@@ -199,14 +201,16 @@
assertTrue("Unexpected token provider type", provider instanceof
SAML20TokenProvider);
assertNull(config.getProviderForService("http://invalid.service/service"));
+ String family = SecurityTokenProvider.FAMILY_TYPE.WS_TRUST.toString();
+
// check the token element and namespace -> token provider mapping.
- provider = config.getProviderForTokenElementNS("SpecialToken",
"http://www.tokens.org");
+ provider = config.getProviderForTokenElementNS(family, new QName(
"http://www.tokens.org", "SpecialToken" ) );
assertNotNull("Unexpected null token provider", provider);
assertTrue("Unexpected token provider type", provider instanceof
SpecialTokenProvider);
- provider = config.getProviderForTokenElementNS("Assertion",
"urn:oasis:names:tc:SAML:2.0:assertion");
+ provider = config.getProviderForTokenElementNS(family, new QName(
JBossSAMLURIConstants.ASSERTION_NSURI.get(), JBossSAMLConstants.ASSERTION.get() ));
assertNotNull("Unexpected null token provider", provider);
assertTrue("Unexpected token provider type", provider instanceof
SAML20TokenProvider);
- assertNull(config.getProviderForTokenElementNS("SpecialToken",
"InvalidNamespace"));
+ assertNull(config.getProviderForTokenElementNS( family, new QName(
"InvalidNamespace", "SpecialToken" )) );
// check the service provider -> token type mapping.
assertEquals("Invalid token type for service provider 1",
"http://www.tokens.org/SpecialToken", config
Modified:
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/SpecialTokenProvider.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/SpecialTokenProvider.java 2011-01-04
17:39:13 UTC (rev 627)
+++
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/SpecialTokenProvider.java 2011-01-05
17:20:12 UTC (rev 628)
@@ -172,4 +172,9 @@
{
return new QName( tokenType(), "SpecialToken" );
}
+
+ public String family()
+ {
+ return SecurityTokenProvider.FAMILY_TYPE.WS_TRUST.toString();
+ }
}
\ No newline at end of file
Modified:
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/core/HTTPContext.java
===================================================================
---
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/core/HTTPContext.java 2011-01-04
17:39:13 UTC (rev 627)
+++
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/core/HTTPContext.java 2011-01-05
17:20:12 UTC (rev 628)
@@ -27,6 +27,7 @@
import javax.xml.namespace.QName;
import org.picketlink.identity.federation.core.interfaces.ProtocolContext;
+import org.picketlink.identity.federation.core.interfaces.SecurityTokenProvider;
/**
* Protocol Context based on HTTP
@@ -83,11 +84,17 @@
return this;
}
+ /**
+ * @see
org.picketlink.identity.federation.core.interfaces.ProtocolContext#serviceName()
+ */
public String serviceName()
{
return null;
}
+ /**
+ * @see
org.picketlink.identity.federation.core.interfaces.ProtocolContext#tokenType()
+ */
public String tokenType()
{
return null;
@@ -96,5 +103,13 @@
public QName getQName()
{
return null;
+ }
+
+ /**
+ * @see org.picketlink.identity.federation.core.interfaces.ProtocolContext#family()
+ */
+ public String family()
+ {
+ return SecurityTokenProvider.FAMILY_TYPE.OPENID.toString();
}
}
\ No newline at end of file