Java Code Examples for org.opensaml.saml.saml2.core.LogoutResponse#setIssuer()
The following examples show how to use
org.opensaml.saml.saml2.core.LogoutResponse#setIssuer() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SamlSingleLogoutFunction.java From armeria with Apache License 2.0 | 6 votes |
private LogoutResponse createLogoutResponse(LogoutRequest logoutRequest, String statusCode) { final StatusCode success = build(StatusCode.DEFAULT_ELEMENT_NAME); success.setValue(statusCode); final Status status = build(Status.DEFAULT_ELEMENT_NAME); status.setStatusCode(success); final Issuer me = build(Issuer.DEFAULT_ELEMENT_NAME); me.setValue(entityId); final LogoutResponse logoutResponse = build(LogoutResponse.DEFAULT_ELEMENT_NAME); logoutResponse.setIssuer(me); logoutResponse.setID(requestIdManager.newId()); logoutResponse.setIssueInstant(DateTime.now()); logoutResponse.setStatus(status); logoutResponse.setInResponseTo(logoutRequest.getID()); return logoutResponse; }
Example 2
Source File: SAML2PResponseComponentBuilder.java From cxf-fediz with Apache License 2.0 | 6 votes |
public static LogoutResponse createSAMLLogoutResponse( String inResponseTo, String issuer, Status status, String destination ) { if (logoutResponseBuilder == null) { logoutResponseBuilder = (SAMLObjectBuilder<LogoutResponse>) builderFactory.getBuilder(LogoutResponse.DEFAULT_ELEMENT_NAME); } LogoutResponse response = logoutResponseBuilder.buildObject(); response.setID("_" + UUID.randomUUID().toString()); response.setIssueInstant(new DateTime()); response.setInResponseTo(inResponseTo); response.setIssuer(createIssuer(issuer)); response.setStatus(status); response.setVersion(SAMLVersion.VERSION_20); response.setDestination(destination); return response; }
Example 3
Source File: SAML2PResponseComponentBuilder.java From cxf-fediz with Apache License 2.0 | 6 votes |
public static LogoutResponse createSAMLLogoutResponse( String inResponseTo, String issuer, Status status, String destination ) { if (logoutResponseBuilder == null) { logoutResponseBuilder = (SAMLObjectBuilder<LogoutResponse>) builderFactory.getBuilder(LogoutResponse.DEFAULT_ELEMENT_NAME); } LogoutResponse response = logoutResponseBuilder.buildObject(); response.setID(UUID.randomUUID().toString()); response.setIssueInstant(new DateTime()); response.setInResponseTo(inResponseTo); response.setIssuer(createIssuer(issuer)); response.setStatus(status); response.setVersion(SAMLVersion.VERSION_20); response.setDestination(destination); return response; }
Example 4
Source File: SamlClient.java From saml-client with MIT License | 5 votes |
/** * Gets saml logout response. * * @param status the status code @See StatusCode.java * @param statMsg the status message * @return saml logout response * @throws SamlException the saml exception */ public String getSamlLogoutResponse(final String status, final String statMsg) throws SamlException { LogoutResponse response = (LogoutResponse) buildSamlObject(LogoutResponse.DEFAULT_ELEMENT_NAME); response.setID("z" + UUID.randomUUID().toString()); // ADFS needs IDs to start with a letter response.setVersion(SAMLVersion.VERSION_20); response.setIssueInstant(DateTime.now()); Issuer issuer = (Issuer) buildSamlObject(Issuer.DEFAULT_ELEMENT_NAME); issuer.setValue(relyingPartyIdentifier); response.setIssuer(issuer); //Status Status stat = (Status) buildSamlObject(Status.DEFAULT_ELEMENT_NAME); StatusCode statCode = new StatusCodeBuilder().buildObject(); statCode.setValue(status); stat.setStatusCode(statCode); if (statMsg != null) { StatusMessage statMessage = new StatusMessageBuilder().buildObject(); statMessage.setMessage(statMsg); stat.setStatusMessage(statMessage); } response.setStatus(stat); //Add a signature into the response signSAMLObject(response); StringWriter stringWriter; try { stringWriter = marshallXmlObject(response); } catch (MarshallingException ex) { throw new SamlException("Error while marshalling SAML request to XML", ex); } logger.trace("Issuing SAML Logout request: " + stringWriter.toString()); return Base64.encodeBase64String(stringWriter.toString().getBytes(StandardCharsets.UTF_8)); }