Search in sources :

Example 6 with NameIDBuilder

use of org.opensaml.saml.saml2.core.impl.NameIDBuilder 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 7 with NameIDBuilder

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

the class SamlpRequestComponentBuilder method createNameIDPolicy.

@SuppressWarnings("unchecked")
public static NameIDPolicy createNameIDPolicy(boolean allowCreate, String format, String spNameQualifier) {
    if (nameIDBuilder == null) {
        nameIDBuilder = (SAMLObjectBuilder<NameIDPolicy>) builderFactory.getBuilder(NameIDPolicy.DEFAULT_ELEMENT_NAME);
    }
    NameIDPolicy nameId = nameIDBuilder.buildObject();
    nameId.setAllowCreate(allowCreate);
    nameId.setFormat(format);
    nameId.setSPNameQualifier(spNameQualifier);
    return nameId;
}
Also used : NameIDPolicy(org.opensaml.saml.saml2.core.NameIDPolicy)

Aggregations

NameID (org.opensaml.saml2.core.NameID)4 NameIDBuilder (org.opensaml.saml2.core.impl.NameIDBuilder)4 DateTime (org.joda.time.DateTime)3 Assertion (org.opensaml.saml2.core.Assertion)3 AttributeStatement (org.opensaml.saml2.core.AttributeStatement)3 AssertionBuilder (org.opensaml.saml2.core.impl.AssertionBuilder)3 AttributeStatementBuilder (org.opensaml.saml2.core.impl.AttributeStatementBuilder)3 LogoutRequest (org.opensaml.saml.saml2.core.LogoutRequest)2 NameID (org.opensaml.saml.saml2.core.NameID)2 SessionIndex (org.opensaml.saml.saml2.core.SessionIndex)2 Issuer (org.opensaml.saml2.core.Issuer)2 IssuerBuilder (org.opensaml.saml2.core.impl.IssuerBuilder)2 SAMLCredential (org.springframework.security.saml.SAMLCredential)2 Date (java.util.Date)1 HashMap (java.util.HashMap)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 JwsJwtCompactConsumer (org.apache.cxf.rs.security.jose.jws.JwsJwtCompactConsumer)1 SyncopeClientException (org.apache.syncope.common.lib.SyncopeClientException)1 SAML2RequestTO (org.apache.syncope.common.lib.to.SAML2RequestTO)1 SAML2IdPEntity (org.apache.syncope.core.logic.saml2.SAML2IdPEntity)1