Java Code Examples for org.opensaml.saml.saml2.core.AuthnContextClassRef#setAuthnContextClassRef()

The following examples show how to use org.opensaml.saml.saml2.core.AuthnContextClassRef#setAuthnContextClassRef() . 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: MockSamlIdpServer.java    From deprecated-security-advanced-modules with Apache License 2.0 5 votes vote down vote up
private AuthnContext createAuthnCotext() {
    AuthnContext authnContext = createSamlElement(AuthnContext.class);
    AuthnContextClassRef authnContextClassRef = createSamlElement(AuthnContextClassRef.class);
    authnContextClassRef.setAuthnContextClassRef(AuthnContext.UNSPECIFIED_AUTHN_CTX);
    authnContext.setAuthnContextClassRef(authnContextClassRef);
    return authnContext;
}
 
Example 2
Source File: AbstractSaml20ObjectBuilder.java    From springboot-shiro-cas-mybatis with MIT License 5 votes vote down vote up
/**
 * New authn statement.
 *
 * @param contextClassRef the context class ref such as {@link AuthnContext#PASSWORD_AUTHN_CTX}
 * @param authnInstant the authn instant
 * @return the authn statement
 */
public AuthnStatement newAuthnStatement(final String contextClassRef, final DateTime authnInstant) {
    final AuthnStatement stmt = newSamlObject(AuthnStatement.class);
    final AuthnContext ctx = newSamlObject(AuthnContext.class);

    final AuthnContextClassRef classRef = newSamlObject(AuthnContextClassRef.class);
    classRef.setAuthnContextClassRef(contextClassRef);

    ctx.setAuthnContextClassRef(classRef);
    stmt.setAuthnContext(ctx);
    stmt.setAuthnInstant(authnInstant);

    return stmt;
}
 
Example 3
Source File: SAML2PResponseComponentBuilder.java    From syncope with Apache License 2.0 5 votes vote down vote up
public static AuthnContextClassRef createAuthnContextClassRef(final String newAuthnContextClassRef) {
    if (authnContextClassRefBuilder == null) {
        authnContextClassRefBuilder = new AuthnContextClassRefBuilder();
    }

    AuthnContextClassRef authnContextClassRef = authnContextClassRefBuilder.buildObject();
    authnContextClassRef.setAuthnContextClassRef(newAuthnContextClassRef);

    return authnContextClassRef;
}
 
Example 4
Source File: DefaultRequestedAuthnContextProvider.java    From syncope with Apache License 2.0 5 votes vote down vote up
@Override
public RequestedAuthnContext provide() {
    AuthnContextClassRef authnContextClassRef = new AuthnContextClassRefBuilder().buildObject();
    authnContextClassRef.setAuthnContextClassRef(AuthnContext.PPT_AUTHN_CTX);
    RequestedAuthnContext requestedAuthnContext = new RequestedAuthnContextBuilder().buildObject();
    requestedAuthnContext.setComparison(AuthnContextComparisonTypeEnumeration.EXACT);
    requestedAuthnContext.getAuthnContextClassRefs().add(authnContextClassRef);

    return requestedAuthnContext;
}
 
Example 5
Source File: SamlpRequestComponentBuilder.java    From cxf with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public static AuthnContextClassRef createAuthnCtxClassRef(
    String authnCtxClassRefValue
) {
    if (requestedAuthnCtxClassRefBuilder == null) {
        requestedAuthnCtxClassRefBuilder = (SAMLObjectBuilder<AuthnContextClassRef>)
            builderFactory.getBuilder(AuthnContextClassRef.DEFAULT_ELEMENT_NAME);
    }
    AuthnContextClassRef authnCtxClassRef = requestedAuthnCtxClassRefBuilder.buildObject();
    authnCtxClassRef.setAuthnContextClassRef(authnCtxClassRefValue);

    return authnCtxClassRef;
}
 
Example 6
Source File: SAML2PResponseComponentBuilder.java    From cxf with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public static AuthnContextClassRef createAuthnContextClassRef(String newAuthnContextClassRef) {
    if (authnContextClassRefBuilder == null) {
        authnContextClassRefBuilder = (SAMLObjectBuilder<AuthnContextClassRef>)
            builderFactory.getBuilder(AuthnContextClassRef.DEFAULT_ELEMENT_NAME);
    }

    AuthnContextClassRef authnContextClassRef = authnContextClassRefBuilder.buildObject();
    authnContextClassRef.setAuthnContextClassRef(newAuthnContextClassRef);

    return authnContextClassRef;
}
 
Example 7
Source File: SamlpRequestComponentBuilder.java    From cxf-fediz with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public static AuthnContextClassRef createAuthnCtxClassRef(
    String authnCtxClassRefValue
) {
    if (requestedAuthnCtxClassRefBuilder == null) {
        requestedAuthnCtxClassRefBuilder = (SAMLObjectBuilder<AuthnContextClassRef>)
            builderFactory.getBuilder(AuthnContextClassRef.DEFAULT_ELEMENT_NAME);
    }
    AuthnContextClassRef authnCtxClassRef = requestedAuthnCtxClassRefBuilder.buildObject();
    authnCtxClassRef.setAuthnContextClassRef(authnCtxClassRefValue);

    return authnCtxClassRef;
}