Search in sources :

Example 11 with SessionIndex

use of org.opensaml.saml.saml2.core.SessionIndex in project ddf by codice.

the class SamlProtocol method createLogoutRequest.

public static LogoutWrapper<LogoutRequest> createLogoutRequest(Issuer issuer, NameID nameId, String id, List<String> sessionIndexes) {
    LogoutRequest logoutRequest = logoutRequestBuilder.buildObject();
    logoutRequest.setID(id);
    logoutRequest.setIssuer(issuer);
    logoutRequest.setNameID(nameId);
    logoutRequest.setIssueInstant(DateTime.now());
    logoutRequest.setVersion(SAMLVersion.VERSION_20);
    SessionIndexBuilder builder = new SessionIndexBuilder();
    for (String index : sessionIndexes) {
        SessionIndex sessionIndexObject = builder.buildObject();
        sessionIndexObject.setSessionIndex(index);
        logoutRequest.getSessionIndexes().add(sessionIndexObject);
    }
    return new LogoutWrapperImpl<>(logoutRequest);
}
Also used : SessionIndexBuilder(org.opensaml.saml.saml2.core.impl.SessionIndexBuilder) SessionIndex(org.opensaml.saml.saml2.core.SessionIndex) LogoutRequest(org.opensaml.saml.saml2.core.LogoutRequest)

Aggregations

LogoutRequest (org.opensaml.saml.saml2.core.LogoutRequest)9 SessionIndex (org.opensaml.saml.saml2.core.SessionIndex)9 Response (javax.ws.rs.core.Response)4 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)4 Test (org.junit.Test)4 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)4 LogoutResponse (org.opensaml.saml.saml2.core.LogoutResponse)4 NameID (org.opensaml.saml.saml2.core.NameID)4 Issuer (org.opensaml.saml.saml2.core.Issuer)3 SessionIndexBuilder (org.opensaml.saml.saml2.core.impl.SessionIndexBuilder)3 DateTime (org.joda.time.DateTime)2 Assertion (org.opensaml.saml.saml2.core.Assertion)2 AuthnStatement (org.opensaml.saml.saml2.core.AuthnStatement)2 IssuerBuilder (org.opensaml.saml.saml2.core.impl.IssuerBuilder)2 LogoutRequestBuilder (org.opensaml.saml.saml2.core.impl.LogoutRequestBuilder)2 NameIDBuilder (org.opensaml.saml.saml2.core.impl.NameIDBuilder)2 LogoutWrapper (ddf.security.samlp.LogoutWrapper)1 LogoutWrapperImpl (ddf.security.samlp.impl.LogoutWrapperImpl)1 HttpServletRequest (jakarta.servlet.http.HttpServletRequest)1 StringWriter (java.io.StringWriter)1