[java-shib-idp2 COMMIT] in /branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/profile: saml1/Shibb...

noreply at shibboleth.net noreply at shibboleth.net
Wed Jan 23 18:04:17 EST 2013


Author: scantor
Date: Wed Jan 23 18:04:16 2013
New Revision: 3130

URL: http://svn.shibboleth.net/view/java-shib-idp2?rev=3130&view=rev
Log:
SIDP-562: Profile exception if session is missing at the completion step.

Modified:
    branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/profile/saml1/ShibbolethSSOProfileHandler.java
    branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/profile/saml2/SSOProfileHandler.java

Modified: branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/profile/saml1/ShibbolethSSOProfileHandler.java
URL: http://svn.shibboleth.net/view/java-shib-idp2/branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/profile/saml1/ShibbolethSSOProfileHandler.java?rev=3130&r1=3129&r2=3130&view=diff
==============================================================================
--- branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/profile/saml1/ShibbolethSSOProfileHandler.java (original)
+++ branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/profile/saml1/ShibbolethSSOProfileHandler.java Wed Jan 23 18:04:16 2013
@@ -284,6 +284,12 @@
                 throw new ProfileException("Authentication failure", loginContext.getAuthenticationFailure());
             }
 
+            Session session = getUserSession(requestContext.getInboundMessageTransport());
+            if (session == null) {
+                requestContext.setFailureStatus(buildStatus(StatusCode.RESPONDER, null, "User failed authentication"));
+                throw new ProfileException("Authentication failure, session missing during completion of profile handler");
+            }
+            
             resolveAttributes(requestContext);
 
             ArrayList<Statement> statements = new ArrayList<Statement>();
@@ -302,18 +308,15 @@
             // If a NameIdentifier is being returned to an SP, index the user's session with it.
             NameIdentifier nameID = requestContext.getSubjectNameIdentifier();
             if (nameID != null && samlResponse.getStatus().getStatusCode().getValue().equals(StatusCode.SUCCESS)) {
-                Session session = getUserSession(requestContext.getInboundMessageTransport());
-                if (session != null) {
-                    ServiceInformationImpl serviceInfo =
-                            (ServiceInformationImpl) session.getServicesInformation().get(requestContext.getPeerEntityId());
-                    serviceInfo.setShibbolethNameIdentifier(nameID);
-                    SessionManager<Session> sessionManager = getSessionManager();
-                    if (sessionManager != null) {
-                        String index = getSessionIndexFromNameID(nameID);
-                        if (index != null && !index.isEmpty()) {
-                            log.debug("secondarily indexing user session by name identifier");
-                            sessionManager.indexSession(session, index);
-                        }
+                ServiceInformationImpl serviceInfo =
+                        (ServiceInformationImpl) session.getServicesInformation().get(requestContext.getPeerEntityId());
+                serviceInfo.setShibbolethNameIdentifier(nameID);
+                SessionManager<Session> sessionManager = getSessionManager();
+                if (sessionManager != null) {
+                    String index = getSessionIndexFromNameID(nameID);
+                    if (index != null && !index.isEmpty()) {
+                        log.debug("secondarily indexing user session by name identifier");
+                        sessionManager.indexSession(session, index);
                     }
                 }
             }

Modified: branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/profile/saml2/SSOProfileHandler.java
URL: http://svn.shibboleth.net/view/java-shib-idp2/branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/profile/saml2/SSOProfileHandler.java?rev=3130&r1=3129&r2=3130&view=diff
==============================================================================
--- branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/profile/saml2/SSOProfileHandler.java (original)
+++ branches/REL_2/src/main/java/edu/internet2/middleware/shibboleth/idp/profile/saml2/SSOProfileHandler.java Wed Jan 23 18:04:16 2013
@@ -281,6 +281,12 @@
                 throw new ProfileException("Authentication failure", loginContext.getAuthenticationFailure());
             }
 
+            Session session = getUserSession(requestContext.getInboundMessageTransport());
+            if (session == null) {
+                requestContext.setFailureStatus(buildStatus(StatusCode.RESPONDER_URI, StatusCode.AUTHN_FAILED_URI, null));
+                throw new ProfileException("Authentication failure, session missing during completion of profile handler");
+            }
+            
             if (requestContext.getSubjectNameIdentifier() != null) {
                 log.debug("Authentication request contained a subject with a name identifier, resolving principal from NameID");

[... 30 lines stripped ...]


More information about the commits mailing list