Author: bmozaffa(a)redhat.com
Date: 2010-07-13 17:49:34 -0400 (Tue, 13 Jul 2010)
New Revision: 334
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/STSPrincipalMappingProvider.java
Log:
PLFED-99: Instead of throwing an exception, simply return no mapping and log the error if
a security token is not found in the context
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-07-07
13:29:07 UTC (rev 333)
+++
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSGroupMappingProvider.java 2010-07-13
21:49:34 UTC (rev 334)
@@ -91,15 +91,15 @@
}
if (contextMap == null)
{
- throw new IllegalArgumentException(
- "Empty context map. SAML Token must be provided in the context map to
extract a Principal");
+ log.warn("Empty context map. SAML Token must be provided in the context map
to extract a Principal");
}
Object tokenObject = contextMap.get(AbstractSTSLoginModule.SHARED_TOKEN);
if (!(tokenObject instanceof Element))
{
- throw new IllegalArgumentException("Did not find a token " +
Element.class.getClass().getName() + " under "
- + AbstractSTSLoginModule.SHARED_TOKEN + " in the map");
+ //With Tomcat SSO Valves, mapping providers DO get called automatically, so
there may be no tokens and errors should be expected and handled
+ log.warn("Did not find a token " + Element.class.getName() + "
under " + AbstractSTSLoginModule.SHARED_TOKEN
+ + " in the map");
}
try
@@ -137,7 +137,7 @@
}
catch (JAXBException e)
{
- throw new IllegalArgumentException(e);
+ log.error("Failed to parse token", e);
}
}
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-07-07
13:29:07 UTC (rev 333)
+++
federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/mapping/STSPrincipalMappingProvider.java 2010-07-13
21:49:34 UTC (rev 334)
@@ -57,15 +57,15 @@
{
if (contextMap == null)
{
- throw new IllegalArgumentException(
- "Empty context map. SAML Token must be provided in the context map to
extract a Principal");
+ log.warn("Empty context map. SAML Token must be provided in the context map
to extract a Principal");
}
Object tokenObject = contextMap.get(AbstractSTSLoginModule.SHARED_TOKEN);
if (!(tokenObject instanceof Element))
{
- throw new IllegalArgumentException("Did not find a token " +
Element.class.getClass().getName() + " under "
- + AbstractSTSLoginModule.SHARED_TOKEN + " in the map");
+ //With Tomcat SSO Valves, mapping providers DO get called automatically, so
there may be no tokens and errors should be expected and handled
+ log.warn("Did not find a token " + Element.class.getName() + "
under " + AbstractSTSLoginModule.SHARED_TOKEN
+ + " in the map");
}
try
@@ -93,7 +93,7 @@
}
catch (JAXBException e)
{
- throw new IllegalArgumentException(e);
+ log.error("Failed to parse token", e);
}
}
Show replies by date