Fix NPE when use has an existing session but is logging into a new service for the...
authorlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Sat, 15 Mar 2008 09:10:54 +0000 (09:10 +0000)
committerlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Sat, 15 Mar 2008 09:10:54 +0000 (09:10 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@2700 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/idp/profile/saml1/AbstractSAML1ProfileHandler.java
src/edu/internet2/middleware/shibboleth/idp/profile/saml2/AbstractSAML2ProfileHandler.java

index 2df02b2..2ee59d1 100644 (file)
@@ -71,6 +71,7 @@ import edu.internet2.middleware.shibboleth.common.profile.provider.BaseSAMLProfi
 import edu.internet2.middleware.shibboleth.common.relyingparty.provider.CryptoOperationRequirementLevel;
 import edu.internet2.middleware.shibboleth.common.relyingparty.provider.saml1.AbstractSAML1ProfileConfiguration;
 import edu.internet2.middleware.shibboleth.idp.profile.AbstractSAMLProfileHandler;
+import edu.internet2.middleware.shibboleth.idp.session.ServiceInformation;
 import edu.internet2.middleware.shibboleth.idp.session.Session;
 
 /** Common implementation details for profile handlers. */
@@ -181,8 +182,12 @@ public abstract class AbstractSAML1ProfileHandler extends AbstractSAMLProfileHan
         if (userSession != null) {
             requestContext.setUserSession(userSession);
             requestContext.setPrincipalName(userSession.getPrincipalName());
-            requestContext.setPrincipalAuthenticationMethod(userSession.getServicesInformation().get(
-                    requestContext.getInboundMessageIssuer()).getAuthenticationMethod().getAuthenticationMethod());
+            ServiceInformation serviceInfo = userSession.getServicesInformation().get(
+                    requestContext.getInboundMessageIssuer());
+            if (serviceInfo != null) {
+                requestContext.setPrincipalAuthenticationMethod(serviceInfo.getAuthenticationMethod()
+                        .getAuthenticationMethod());
+            }
         }
     }
 
index 71e137b..0a4533c 100644 (file)
@@ -92,6 +92,7 @@ import edu.internet2.middleware.shibboleth.common.profile.provider.BaseSAMLProfi
 import edu.internet2.middleware.shibboleth.common.relyingparty.provider.CryptoOperationRequirementLevel;
 import edu.internet2.middleware.shibboleth.common.relyingparty.provider.saml2.AbstractSAML2ProfileConfiguration;
 import edu.internet2.middleware.shibboleth.idp.profile.AbstractSAMLProfileHandler;
+import edu.internet2.middleware.shibboleth.idp.session.ServiceInformation;
 import edu.internet2.middleware.shibboleth.idp.session.Session;
 
 /** Common implementation details for profile handlers. */
@@ -210,8 +211,12 @@ public abstract class AbstractSAML2ProfileHandler extends AbstractSAMLProfileHan
         if (userSession != null) {
             requestContext.setUserSession(userSession);
             requestContext.setPrincipalName(userSession.getPrincipalName());
-            requestContext.setPrincipalAuthenticationMethod(userSession.getServicesInformation().get(
-                    requestContext.getInboundMessageIssuer()).getAuthenticationMethod().getAuthenticationMethod());
+            ServiceInformation serviceInfo = userSession.getServicesInformation().get(
+                    requestContext.getInboundMessageIssuer());
+            if (serviceInfo != null) {
+                requestContext.setPrincipalAuthenticationMethod(serviceInfo.getAuthenticationMethod()
+                        .getAuthenticationMethod());
+            }
         }
     }