Search in sources :

Example 1 with PersonAuthenticationType

use of org.xdi.model.custom.script.type.auth.PersonAuthenticationType in project oxAuth by GluuFederation.

the class IdTokenFactory method setAmrClaim.

private void setAmrClaim(JsonWebResponse jwt, String acrValues) {
    List<String> amrList = Lists.newArrayList();
    CustomScriptConfiguration script = externalAuthenticationService.getCustomScriptConfiguration(AuthenticationScriptUsageType.BOTH, acrValues);
    if (script != null) {
        amrList.add(Integer.toString(script.getLevel()));
        PersonAuthenticationType externalAuthenticator = (PersonAuthenticationType) script.getExternalType();
        int apiVersion = externalAuthenticator.getApiVersion();
        if (apiVersion > 3) {
            Map<String, String> authenticationMethodClaimsOrNull = externalAuthenticator.getAuthenticationMethodClaims();
            if (authenticationMethodClaimsOrNull != null) {
                for (String key : authenticationMethodClaimsOrNull.keySet()) {
                    amrList.add(key + ":" + authenticationMethodClaimsOrNull.get(key));
                }
            }
        }
    }
    jwt.getClaims().setClaim(JwtClaimName.AUTHENTICATION_METHOD_REFERENCES, amrList);
}
Also used : PersonAuthenticationType(org.xdi.model.custom.script.type.auth.PersonAuthenticationType) CustomScriptConfiguration(org.xdi.model.custom.script.conf.CustomScriptConfiguration)

Example 2 with PersonAuthenticationType

use of org.xdi.model.custom.script.type.auth.PersonAuthenticationType in project oxAuth by GluuFederation.

the class ExternalAuthenticationService method executeExternalLogout.

public boolean executeExternalLogout(CustomScriptConfiguration customScriptConfiguration, Map<String, String[]> requestParameters) {
    try {
        log.debug("Executing python 'logout' authenticator method");
        PersonAuthenticationType externalAuthenticator = (PersonAuthenticationType) customScriptConfiguration.getExternalType();
        Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
        return externalAuthenticator.logout(configurationAttributes, requestParameters);
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
    }
    return false;
}
Also used : PersonAuthenticationType(org.xdi.model.custom.script.type.auth.PersonAuthenticationType) InternalDefaultPersonAuthenticationType(org.xdi.oxauth.service.external.internal.InternalDefaultPersonAuthenticationType) SimpleCustomProperty(org.xdi.model.SimpleCustomProperty)

Example 3 with PersonAuthenticationType

use of org.xdi.model.custom.script.type.auth.PersonAuthenticationType in project oxAuth by GluuFederation.

the class ExternalAuthenticationService method executeExternalGetExtraParametersForStep.

public List<String> executeExternalGetExtraParametersForStep(CustomScriptConfiguration customScriptConfiguration, int step) {
    try {
        log.debug("Executing python 'getExtraParametersForStep' authenticator method");
        PersonAuthenticationType externalAuthenticator = (PersonAuthenticationType) customScriptConfiguration.getExternalType();
        Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
        return externalAuthenticator.getExtraParametersForStep(configurationAttributes, step);
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
    }
    return null;
}
Also used : PersonAuthenticationType(org.xdi.model.custom.script.type.auth.PersonAuthenticationType) InternalDefaultPersonAuthenticationType(org.xdi.oxauth.service.external.internal.InternalDefaultPersonAuthenticationType) SimpleCustomProperty(org.xdi.model.SimpleCustomProperty)

Example 4 with PersonAuthenticationType

use of org.xdi.model.custom.script.type.auth.PersonAuthenticationType in project oxAuth by GluuFederation.

the class ExternalAuthenticationService method getLogoutExternalUrl.

public String getLogoutExternalUrl(CustomScriptConfiguration customScriptConfiguration, Map<String, String[]> requestParameters) {
    try {
        log.debug("Executing python 'getLogouExternalUrl' authenticator method");
        PersonAuthenticationType externalAuthenticator = (PersonAuthenticationType) customScriptConfiguration.getExternalType();
        Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
        return externalAuthenticator.getLogoutExternalUrl(configurationAttributes, requestParameters);
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
    }
    return null;
}
Also used : PersonAuthenticationType(org.xdi.model.custom.script.type.auth.PersonAuthenticationType) InternalDefaultPersonAuthenticationType(org.xdi.oxauth.service.external.internal.InternalDefaultPersonAuthenticationType) SimpleCustomProperty(org.xdi.model.SimpleCustomProperty)

Example 5 with PersonAuthenticationType

use of org.xdi.model.custom.script.type.auth.PersonAuthenticationType in project oxAuth by GluuFederation.

the class ExternalAuthenticationService method executeExternalGetCountAuthenticationSteps.

public int executeExternalGetCountAuthenticationSteps(CustomScriptConfiguration customScriptConfiguration) {
    try {
        log.debug("Executing python 'getCountAuthenticationSteps' authenticator method");
        PersonAuthenticationType externalAuthenticator = (PersonAuthenticationType) customScriptConfiguration.getExternalType();
        Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
        return externalAuthenticator.getCountAuthenticationSteps(configurationAttributes);
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
    }
    return -1;
}
Also used : PersonAuthenticationType(org.xdi.model.custom.script.type.auth.PersonAuthenticationType) InternalDefaultPersonAuthenticationType(org.xdi.oxauth.service.external.internal.InternalDefaultPersonAuthenticationType) SimpleCustomProperty(org.xdi.model.SimpleCustomProperty)

Aggregations

PersonAuthenticationType (org.xdi.model.custom.script.type.auth.PersonAuthenticationType)12 InternalDefaultPersonAuthenticationType (org.xdi.oxauth.service.external.internal.InternalDefaultPersonAuthenticationType)11 SimpleCustomProperty (org.xdi.model.SimpleCustomProperty)10 CustomScriptConfiguration (org.xdi.model.custom.script.conf.CustomScriptConfiguration)1