[java-identity-provider COMMIT] in /trunk/idp-saml-impl/src: main/java/net/shibboleth/idp/saml/saml2/profile/impl/Pro...
noreply at shibboleth.net
noreply at shibboleth.net
Tue Oct 18 10:42:22 EDT 2016
Author: scantor
Date: Tue Oct 18 10:42:22 2016
New Revision: 8503
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=8503&view=rev
Log:
Add error checking for missing NameID in LogoutRequest.
Modified:
trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessLogoutRequest.java
trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessLogoutRequestTest.java
Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessLogoutRequest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessLogoutRequest.java?rev=8503&r1=8502&r2=8503&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessLogoutRequest.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessLogoutRequest.java Tue Oct 18 10:42:22 2016
@@ -71,6 +71,7 @@
*
* @event {@link EventIds#PROCEED_EVENT_ID}
* @event {@link EventIds#INVALID_PROFILE_CTX}
+ * @event {@link EventIds#INVALID_MESSAGE}
* @event {@link EventIds#IO_ERROR}
* @event {@link SAMLEventIds#SESSION_NOT_FOUND}
* @post The matching session(s) are destroyed.
@@ -238,6 +239,10 @@
if (logoutRequest == null) {
log.warn("{} No LogoutRequest found to process", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
+ return false;
+ } else if (logoutRequest.getNameID() == null) {
+ log.warn("{} LogoutRequest did not contain NameID", getLogPrefix());
+ ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MESSAGE);
return false;
}
Modified: trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessLogoutRequestTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessLogoutRequestTest.java?rev=8503&r1=8502&r2=8503&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessLogoutRequestTest.java (original)
+++ trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessLogoutRequestTest.java Tue Oct 18 10:42:22 2016
@@ -107,7 +107,17 @@
final Event event = action.execute(src);
ActionTestingSupport.assertEvent(event, EventIds.INVALID_PROFILE_CTX);
}
-
+
+ @Test public void testNoNameID() {
+ prc.getInboundMessageContext().setMessage(SAML2ActionTestingSupport.buildLogoutRequest(null));
+ HttpServletRequestResponseContext.loadCurrent(new MockHttpServletRequest(), new MockHttpServletResponse());
+ final Event event = action.execute(src);
+ ActionTestingSupport.assertEvent(event, EventIds.INVALID_MESSAGE);
+ Assert.assertNull(prc.getSubcontext(SessionContext.class));
+ Assert.assertNull(prc.getSubcontext(SubjectContext.class));
+ Assert.assertNull(prc.getSubcontext(LogoutContext.class));
+ }
+
@Test public void testNoSession() {
final NameID nameId = SAML2ActionTestingSupport.buildNameID("jdoe");
prc.getInboundMessageContext().setMessage(SAML2ActionTestingSupport.buildLogoutRequest(nameId));
More information about the commits
mailing list