Search in sources :

Example 11 with IssuerBuilder

use of org.opensaml.saml.saml2.core.impl.IssuerBuilder in project cxf by apache.

the class SAML2PResponseComponentBuilder method createIssuer.

@SuppressWarnings("unchecked")
public static Issuer createIssuer(String issuerValue) {
    if (issuerBuilder == null) {
        issuerBuilder = (SAMLObjectBuilder<Issuer>) builderFactory.getBuilder(Issuer.DEFAULT_ELEMENT_NAME);
    }
    Issuer issuer = issuerBuilder.buildObject();
    issuer.setValue(issuerValue);
    return issuer;
}
Also used : Issuer(org.opensaml.saml.saml2.core.Issuer)

Example 12 with IssuerBuilder

use of org.opensaml.saml.saml2.core.impl.IssuerBuilder in project testcases by coheigea.

the class SAML2PResponseComponentBuilder method createIssuer.

@SuppressWarnings("unchecked")
public static Issuer createIssuer(String issuerValue) {
    if (issuerBuilder == null) {
        issuerBuilder = (SAMLObjectBuilder<Issuer>) builderFactory.getBuilder(Issuer.DEFAULT_ELEMENT_NAME);
    }
    Issuer issuer = issuerBuilder.buildObject();
    issuer.setValue(issuerValue);
    return issuer;
}
Also used : Issuer(org.opensaml.saml.saml2.core.Issuer)

Example 13 with IssuerBuilder

use of org.opensaml.saml.saml2.core.impl.IssuerBuilder in project cloudstack by apache.

the class SAML2LoginAPIAuthenticatorCmdTest method buildMockResponse.

private Response buildMockResponse() throws Exception {
    Response samlMessage = new ResponseBuilder().buildObject();
    samlMessage.setID("foo");
    samlMessage.setVersion(SAMLVersion.VERSION_20);
    samlMessage.setIssueInstant(new DateTime(0));
    Issuer issuer = new IssuerBuilder().buildObject();
    issuer.setValue("MockedIssuer");
    samlMessage.setIssuer(issuer);
    Status status = new StatusBuilder().buildObject();
    StatusCode statusCode = new StatusCodeBuilder().buildObject();
    statusCode.setValue(StatusCode.SUCCESS_URI);
    status.setStatusCode(statusCode);
    samlMessage.setStatus(status);
    Assertion assertion = new AssertionBuilder().buildObject();
    Subject subject = new SubjectBuilder().buildObject();
    NameID nameID = new NameIDBuilder().buildObject();
    nameID.setValue("SOME-UNIQUE-ID");
    nameID.setFormat(NameIDType.PERSISTENT);
    subject.setNameID(nameID);
    assertion.setSubject(subject);
    AuthnStatement authnStatement = new AuthnStatementBuilder().buildObject();
    authnStatement.setSessionIndex("Some Session String");
    assertion.getAuthnStatements().add(authnStatement);
    AttributeStatement attributeStatement = new AttributeStatementBuilder().buildObject();
    assertion.getAttributeStatements().add(attributeStatement);
    samlMessage.getAssertions().add(assertion);
    return samlMessage;
}
Also used : Status(org.opensaml.saml2.core.Status) AttributeStatementBuilder(org.opensaml.saml2.core.impl.AttributeStatementBuilder) StatusCodeBuilder(org.opensaml.saml2.core.impl.StatusCodeBuilder) Issuer(org.opensaml.saml2.core.Issuer) NameID(org.opensaml.saml2.core.NameID) Assertion(org.opensaml.saml2.core.Assertion) AssertionBuilder(org.opensaml.saml2.core.impl.AssertionBuilder) AuthnStatementBuilder(org.opensaml.saml2.core.impl.AuthnStatementBuilder) StatusCode(org.opensaml.saml2.core.StatusCode) DateTime(org.joda.time.DateTime) Subject(org.opensaml.saml2.core.Subject) Response(org.opensaml.saml2.core.Response) HttpServletResponse(javax.servlet.http.HttpServletResponse) NameIDBuilder(org.opensaml.saml2.core.impl.NameIDBuilder) AttributeStatement(org.opensaml.saml2.core.AttributeStatement) AuthnStatement(org.opensaml.saml2.core.AuthnStatement) StatusBuilder(org.opensaml.saml2.core.impl.StatusBuilder) IssuerBuilder(org.opensaml.saml2.core.impl.IssuerBuilder) ResponseBuilder(org.opensaml.saml2.core.impl.ResponseBuilder) SubjectBuilder(org.opensaml.saml2.core.impl.SubjectBuilder)

Example 14 with IssuerBuilder

use of org.opensaml.saml.saml2.core.impl.IssuerBuilder in project cloudstack by apache.

the class SAMLUtils method buildLogoutRequest.

public static LogoutRequest buildLogoutRequest(String logoutUrl, String spId, String nameIdString) {
    Issuer issuer = new IssuerBuilder().buildObject();
    issuer.setValue(spId);
    NameID nameID = new NameIDBuilder().buildObject();
    nameID.setValue(nameIdString);
    LogoutRequest logoutRequest = new LogoutRequestBuilder().buildObject();
    logoutRequest.setID(generateSecureRandomId());
    logoutRequest.setDestination(logoutUrl);
    logoutRequest.setVersion(SAMLVersion.VERSION_20);
    logoutRequest.setIssueInstant(new DateTime());
    logoutRequest.setIssuer(issuer);
    logoutRequest.setNameID(nameID);
    return logoutRequest;
}
Also used : NameIDBuilder(org.opensaml.saml2.core.impl.NameIDBuilder) LogoutRequestBuilder(org.opensaml.saml2.core.impl.LogoutRequestBuilder) Issuer(org.opensaml.saml2.core.Issuer) NameID(org.opensaml.saml2.core.NameID) LogoutRequest(org.opensaml.saml2.core.LogoutRequest) IssuerBuilder(org.opensaml.saml2.core.impl.IssuerBuilder) DateTime(org.joda.time.DateTime)

Example 15 with IssuerBuilder

use of org.opensaml.saml.saml2.core.impl.IssuerBuilder in project spring-security by spring-projects.

the class TestOpenSamlObjects method assertingPartyLogoutResponse.

public static LogoutResponse assertingPartyLogoutResponse(RelyingPartyRegistration registration) {
    LogoutResponseBuilder logoutResponseBuilder = new LogoutResponseBuilder();
    LogoutResponse logoutResponse = logoutResponseBuilder.buildObject();
    logoutResponse.setID("id");
    StatusBuilder statusBuilder = new StatusBuilder();
    StatusCodeBuilder statusCodeBuilder = new StatusCodeBuilder();
    StatusCode code = statusCodeBuilder.buildObject();
    code.setValue(StatusCode.SUCCESS);
    Status status = statusBuilder.buildObject();
    status.setStatusCode(code);
    logoutResponse.setStatus(status);
    IssuerBuilder issuerBuilder = new IssuerBuilder();
    Issuer issuer = issuerBuilder.buildObject();
    issuer.setValue(registration.getAssertingPartyDetails().getEntityId());
    logoutResponse.setIssuer(issuer);
    logoutResponse.setDestination(registration.getSingleLogoutServiceResponseLocation());
    return logoutResponse;
}
Also used : Status(org.opensaml.saml.saml2.core.Status) StatusCodeBuilder(org.opensaml.saml.saml2.core.impl.StatusCodeBuilder) LogoutResponseBuilder(org.opensaml.saml.saml2.core.impl.LogoutResponseBuilder) LogoutResponse(org.opensaml.saml.saml2.core.LogoutResponse) Issuer(org.opensaml.saml.saml2.core.Issuer) StatusBuilder(org.opensaml.saml.saml2.core.impl.StatusBuilder) IssuerBuilder(org.opensaml.saml.saml2.core.impl.IssuerBuilder) StatusCode(org.opensaml.saml.saml2.core.StatusCode)

Aggregations

Issuer (org.opensaml.saml.saml2.core.Issuer)17 IssuerBuilder (org.opensaml.saml.saml2.core.impl.IssuerBuilder)9 DateTime (org.joda.time.DateTime)7 NameID (org.opensaml.saml.saml2.core.NameID)6 NameIDBuilder (org.opensaml.saml.saml2.core.impl.NameIDBuilder)6 LogoutRequest (org.opensaml.saml.saml2.core.LogoutRequest)4 AuthnContextClassRef (org.opensaml.saml.saml2.core.AuthnContextClassRef)3 AuthnContextClassRefBuilder (org.opensaml.saml.saml2.core.impl.AuthnContextClassRefBuilder)3 LogoutRequestBuilder (org.opensaml.saml.saml2.core.impl.LogoutRequestBuilder)3 Date (java.util.Date)2 HashMap (java.util.HashMap)2 SyncopeClientException (org.apache.syncope.common.lib.SyncopeClientException)2 SAML2RequestTO (org.apache.syncope.common.lib.to.SAML2RequestTO)2 SAML2IdPEntity (org.apache.syncope.core.logic.saml2.SAML2IdPEntity)2 NotFoundException (org.apache.syncope.core.persistence.api.dao.NotFoundException)2 XMLObject (org.opensaml.core.xml.XMLObject)2 XSString (org.opensaml.core.xml.schema.XSString)2 SAMLObjectBuilder (org.opensaml.saml.common.SAMLObjectBuilder)2 Assertion (org.opensaml.saml.saml2.core.Assertion)2 Attribute (org.opensaml.saml.saml2.core.Attribute)2