Author: sguilhen(a)redhat.com
Date: 2010-06-15 15:20:52 -0400 (Tue, 15 Jun 2010)
New Revision: 306
Modified:
federation/trunk/parent/pom.xml
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/SAML20TokenRoleAttributeProvider.java
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSGroupMappingProvider.java
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSPrincipalMappingProvider.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java
Log:
Attribute provider implementation is now loaded via SecurityActions
Modified: federation/trunk/parent/pom.xml
===================================================================
--- federation/trunk/parent/pom.xml 2010-06-15 16:31:29 UTC (rev 305)
+++ federation/trunk/parent/pom.xml 2010-06-15 19:20:52 UTC (rev 306)
@@ -87,16 +87,6 @@
</snapshots>
</repository>
<repository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <layout>default</layout>
- <
url>http://repository.jboss.org/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
-
- <repository>
<id>snapshots.jboss.org</id>
<name>JBoss Snapshots Repository</name>
<layout>default</layout>
Modified:
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/SAML20TokenRoleAttributeProvider.java
===================================================================
---
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/SAML20TokenRoleAttributeProvider.java 2010-06-15
16:31:29 UTC (rev 305)
+++
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/SAML20TokenRoleAttributeProvider.java 2010-06-15
19:20:52 UTC (rev 306)
@@ -61,7 +61,6 @@
*/
private String tokenRoleAttributeName;
- @Override
public void setProperties(Map<String, String> properties)
{
String roleAttrKey = this.getClass().getName() +
".tokenRoleAttributeName";
@@ -72,7 +71,6 @@
}
}
- @Override
public AttributeStatementType getAttributeStatement()
{
Subject subject =
SecurityContextAssociation.getSecurityContext().getSubjectInfo().getAuthenticatedSubject();
Modified:
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSGroupMappingProvider.java
===================================================================
---
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSGroupMappingProvider.java 2010-06-15
16:31:29 UTC (rev 305)
+++
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSGroupMappingProvider.java 2010-06-15
19:20:52 UTC (rev 306)
@@ -64,7 +64,6 @@
private String tokenRoleAttributeName;
- @Override
public void init(Map<String, Object> contextMap)
{
Object tokenRoleAttributeObject =
contextMap.get("token-role-attribute-name");
@@ -84,7 +83,6 @@
}
}
- @Override
public void performMapping(Map<String, Object> contextMap, RoleGroup Group)
{
if (log.isDebugEnabled())
@@ -143,7 +141,6 @@
}
}
- @Override
public void setMappingResult(MappingResult<RoleGroup> mappingResult)
{
this.result = mappingResult;
Modified:
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSPrincipalMappingProvider.java
===================================================================
---
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSPrincipalMappingProvider.java 2010-06-15
16:31:29 UTC (rev 305)
+++
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSPrincipalMappingProvider.java 2010-06-15
19:20:52 UTC (rev 306)
@@ -48,13 +48,11 @@
private MappingResult<Principal> result;
- @Override
public void init(Map<String, Object> contextMap)
{
//No initialization needed
}
- @Override
public void performMapping(Map<String, Object> contextMap, Principal principal)
{
if (contextMap == null)
@@ -99,7 +97,6 @@
}
}
- @Override
public void setMappingResult(MappingResult<Principal> mappingResult)
{
this.result = mappingResult;
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 2010-06-15
16:31:29 UTC (rev 305)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java 2010-06-15
19:20:52 UTC (rev 306)
@@ -136,15 +136,13 @@
this.revocationRegistry = (RevocationRegistry) object;
else
{
- if (logger.isDebugEnabled())
- logger.debug(registryOption + " is not an instance of
RevocationRegistry - using default registry");
+ logger.warn(registryOption + " is not an instance of
RevocationRegistry - using default registry");
this.revocationRegistry = new DefaultRevocationRegistry();
}
}
catch (PrivilegedActionException pae)
{
- if (logger.isDebugEnabled())
- logger.debug("Error instantiating revocation registry class -
using default registry");
+ logger.warn("Error instantiating revocation registry class - using
default registry");
pae.printStackTrace();
this.revocationRegistry = new DefaultRevocationRegistry();
}
@@ -162,15 +160,20 @@
{
try
{
- @SuppressWarnings("unchecked")
- Class<SAML20TokenAttributeProvider> attributeProviderClass =
(Class<SAML20TokenAttributeProvider>) Class
- .forName(attributeProviderClassName);
- attributeProvider = attributeProviderClass.newInstance();
- attributeProvider.setProperties(properties);
+ Object object =
SecurityActions.instantiateClass(attributeProviderClassName);
+ if (object instanceof SAML20TokenAttributeProvider)
+ {
+ this.attributeProvider = (SAML20TokenAttributeProvider) object;
+ this.attributeProvider.setProperties(this.properties);
+ }
+ else
+ logger.warn("Attribute provider not installed: " +
attributeProviderClassName +
+ "is not an instance of SAML20TokenAttributeProvider");
}
- catch (Exception e)
+ catch (PrivilegedActionException pae)
{
- throw new IllegalStateException(e);
+ logger.warn("Error instantiating attribute provider: " +
pae.getMessage());
+ pae.printStackTrace();
}
}
}
@@ -179,7 +182,7 @@
* (non-Javadoc)
*
* @see org.picketlink.identity.federation.core.wstrust.SecurityTokenProvider#
- *
cancelToken(org.picketlink.identity.federation.core.wstrust.WSTrustRequestContext)
+ *
cancelToken(org.picketlink.identity.federation.core.wstrust.WSTrustRequestContext)
*/
public void cancelToken(WSTrustRequestContext context) throws WSTrustException
{
@@ -200,7 +203,7 @@
* (non-Javadoc)
*
* @see org.picketlink.identity.federation.core.wstrust.SecurityTokenProvider#
- * issueToken(org.picketlink.identity.federation.core.wstrust.WSTrustRequestContext)
+ *
issueToken(org.picketlink.identity.federation.core.wstrust.WSTrustRequestContext)
*/
public void issueToken(WSTrustRequestContext context) throws WSTrustException
{
@@ -258,9 +261,9 @@
AssertionType assertion = SAMLAssertionFactory.createAssertion(assertionID,
issuerID, lifetime.getCreated(),
conditions, subject, statements);
- if (attributeProvider != null)
+ if (this.attributeProvider != null)
{
- AttributeStatementType attributeStatement =
attributeProvider.getAttributeStatement();
+ AttributeStatementType attributeStatement =
this.attributeProvider.getAttributeStatement();
if (attributeStatement != null)
{
assertion.getStatementOrAuthnStatementOrAuthzDecisionStatement().add(attributeStatement);
@@ -294,7 +297,7 @@
* (non-Javadoc)
*
* @see org.picketlink.identity.federation.core.wstrust.SecurityTokenProvider#
- * renewToken(org.picketlink.identity.federation.core.wstrust.WSTrustRequestContext)
+ *
renewToken(org.picketlink.identity.federation.core.wstrust.WSTrustRequestContext)
*/
public void renewToken(WSTrustRequestContext context) throws WSTrustException
{
@@ -361,7 +364,7 @@
* (non-Javadoc)
*
* @see org.picketlink.identity.federation.core.wstrust.SecurityTokenProvider#
- *
validateToken(org.picketlink.identity.federation.core.wstrust.WSTrustRequestContext)
+ *
validateToken(org.picketlink.identity.federation.core.wstrust.WSTrustRequestContext)
*/
public void validateToken(WSTrustRequestContext context) throws WSTrustException
{