Author: anil.saldhana(a)jboss.com
Date: 2011-01-24 23:54:12 -0500 (Mon, 24 Jan 2011)
New Revision: 649
Modified:
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.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/wstrust/PicketLinkSTSConfiguration.java
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/IDPServlet.java
Log:
deal with config not avail in web
Modified:
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java
===================================================================
---
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java 2011-01-25
04:50:50 UTC (rev 648)
+++
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java 2011-01-25
04:54:12 UTC (rev 649)
@@ -23,6 +23,7 @@
import static org.picketlink.identity.federation.core.util.StringUtil.isNotNull;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.security.GeneralSecurityException;
@@ -928,8 +929,13 @@
PicketLinkCoreSTS sts = PicketLinkCoreSTS.instance();
//Let us look for a file
String configPath = context.getServletContext().getRealPath(
"/WEB-INF/picketlink-sts.xml" );
- if( configPath == null )
- sts.installDefaultConfiguration();
+ File stsTokenConfigFile = configPath != null ? new File( configPath ) : null ;
+
+ if( stsTokenConfigFile == null || stsTokenConfigFile.exists() == false )
+ {
+ log.info( "Did not find picketlink-sts.xml. We will install default
configuration" );
+ sts.installDefaultConfiguration();
+ }
else
sts.installDefaultConfiguration( configPath );
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-25
04:50:50 UTC (rev 648)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/sts/PicketLinkCoreSTS.java 2011-01-25
04:54:12 UTC (rev 649)
@@ -100,19 +100,25 @@
fileName = configFileName[ 0 ];
if( configuration == null )
- configuration = new PicketLinkSTSConfiguration();
+ {
+ if(logger.isDebugEnabled() )
+ logger.debug( "[InstallDefaultConfiguration] Configuration is null.
Creating a new configuration" );
+ configuration = new PicketLinkSTSConfiguration();
+ }
try
{
- STSConfiguration config = getConfiguration(fileName);
+
+ if(logger.isDebugEnabled() )
+ logger.debug( "[InstallDefaultConfiguration] Configuration file
name=" + fileName );
+
+ STSConfiguration config = getConfiguration( fileName );
configuration.copy(config);
}
catch (ConfigurationException e)
{
throw new RuntimeException( e );
- }
- //SAML2 Specification Provider
- //configuration.addTokenProvider( SAML20AssertionTokenProvider.NS, new
SAML20AssertionTokenProvider() );
+ }
}
/**
@@ -130,7 +136,7 @@
SecurityTokenProvider provider = getProvider(protocolContext);
if( provider == null )
- throw new ProcessingException( "No Security Token Provider found in
configuration:" + protocolContext );
+ throw new ProcessingException( "No Security Token Provider found in
configuration:" + configuration + "[ProtoCtx=]" + protocolContext );
if( logger.isDebugEnabled() )
{
@@ -162,7 +168,7 @@
provider = getProviderBasedOnQName(protocolContext);
if( provider == null )
- throw new ProcessingException( "No Security Token Provider found in
configuration:" + protocolContext );
+ throw new ProcessingException( "No Security Token Provider found in
configuration:" + configuration + "[ProtoCtx=]" + protocolContext );
if( logger.isDebugEnabled() )
{
@@ -225,7 +231,7 @@
provider = getProviderBasedOnQName(protocolContext);
if( provider == null )
- throw new ProcessingException( "No Security Token Provider found in
configuration:" + protocolContext );
+ throw new ProcessingException( "No Security Token Provider found in
configuration:" + configuration + "[ProtoCtx=]" + protocolContext );
if( logger.isDebugEnabled() )
{
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-25
04:50:50 UTC (rev 648)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/PicketLinkSTSConfiguration.java 2011-01-25
04:54:12 UTC (rev 649)
@@ -458,4 +458,12 @@
else
throw new RuntimeException( "Unknown config :" + thatConfig );
//TODO: Handle other configuration
}
+
+ @Override
+ public String toString()
+ {
+ return "PicketLinkSTSConfiguration [delegate=" + delegate + ",
tokenProviders=" + tokenProviders
+ + ", spMetadata=" + spMetadata + ", claimsProcessors=" +
claimsProcessors + ", trustManager="
+ + trustManager + ", handler=" + handler + "]";
+ }
}
\ No newline at end of file
Modified:
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/IDPServlet.java
===================================================================
---
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/IDPServlet.java 2011-01-25
04:50:50 UTC (rev 648)
+++
federation/trunk/picketlink-web/src/main/java/org/picketlink/identity/federation/web/servlets/IDPServlet.java 2011-01-25
04:54:12 UTC (rev 649)
@@ -21,6 +21,7 @@
*/
package org.picketlink.identity.federation.web.servlets;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.security.GeneralSecurityException;
@@ -255,9 +256,11 @@
//Ensure the configuration in the STS
PicketLinkCoreSTS sts = PicketLinkCoreSTS.instance();
- //Let us look for a file
+ //Let us look for a file
String configPath = context.getRealPath( "/WEB-INF/picketlink-sts.xml"
);
- if( configPath == null )
+ File stsConfigFile = configPath != null ? new File( configPath ) : null;
+
+ if( configPath == null || !stsConfigFile.exists() )
sts.installDefaultConfiguration();
else
sts.installDefaultConfiguration( configPath );