Search in sources :

Example 6 with PersonAuthenticationType

use of org.gluu.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.getCustomScriptConfigurationByName(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(script.getConfigurationAttributes());
            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.gluu.model.custom.script.type.auth.PersonAuthenticationType) CustomScriptConfiguration(org.gluu.model.custom.script.conf.CustomScriptConfiguration)

Example 7 with PersonAuthenticationType

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

the class ExternalAuthenticationService method executeExternalIsValidAuthenticationMethod.

private boolean executeExternalIsValidAuthenticationMethod(AuthenticationScriptUsageType usageType, CustomScriptConfiguration customScriptConfiguration) {
    try {
        log.debug("Executing python 'isValidAuthenticationMethod' authenticator method");
        PersonAuthenticationType externalAuthenticator = (PersonAuthenticationType) customScriptConfiguration.getExternalType();
        Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
        return externalAuthenticator.isValidAuthenticationMethod(usageType, configurationAttributes);
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
        saveScriptError(customScriptConfiguration.getCustomScript(), ex);
    }
    return false;
}
Also used : PersonAuthenticationType(org.gluu.model.custom.script.type.auth.PersonAuthenticationType) InternalDefaultPersonAuthenticationType(org.gluu.oxauth.service.external.internal.InternalDefaultPersonAuthenticationType) SimpleCustomProperty(org.gluu.model.SimpleCustomProperty)

Example 8 with PersonAuthenticationType

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

the class ExternalAuthenticationService method executeExternalGetAlternativeAuthenticationMethod.

private String executeExternalGetAlternativeAuthenticationMethod(AuthenticationScriptUsageType usageType, CustomScriptConfiguration customScriptConfiguration) {
    try {
        log.trace("Executing python 'getAlternativeAuthenticationMethod' authenticator method");
        PersonAuthenticationType externalAuthenticator = (PersonAuthenticationType) customScriptConfiguration.getExternalType();
        Map<String, SimpleCustomProperty> configurationAttributes = customScriptConfiguration.getConfigurationAttributes();
        return externalAuthenticator.getAlternativeAuthenticationMethod(usageType, configurationAttributes);
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
        saveScriptError(customScriptConfiguration.getCustomScript(), ex);
    }
    return null;
}
Also used : PersonAuthenticationType(org.gluu.model.custom.script.type.auth.PersonAuthenticationType) InternalDefaultPersonAuthenticationType(org.gluu.oxauth.service.external.internal.InternalDefaultPersonAuthenticationType) SimpleCustomProperty(org.gluu.model.SimpleCustomProperty)

Example 9 with PersonAuthenticationType

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

the class ExternalAuthenticationService method executeExternalGetApiVersion.

public int executeExternalGetApiVersion(CustomScriptConfiguration customScriptConfiguration) {
    try {
        log.trace("Executing python 'getApiVersion' authenticator method");
        PersonAuthenticationType externalAuthenticator = (PersonAuthenticationType) customScriptConfiguration.getExternalType();
        return externalAuthenticator.getApiVersion();
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
        saveScriptError(customScriptConfiguration.getCustomScript(), ex);
    }
    return -1;
}
Also used : PersonAuthenticationType(org.gluu.model.custom.script.type.auth.PersonAuthenticationType) InternalDefaultPersonAuthenticationType(org.gluu.oxauth.service.external.internal.InternalDefaultPersonAuthenticationType)

Example 10 with PersonAuthenticationType

use of org.gluu.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.trace("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);
        saveScriptError(customScriptConfiguration.getCustomScript(), ex);
    }
    return null;
}
Also used : PersonAuthenticationType(org.gluu.model.custom.script.type.auth.PersonAuthenticationType) InternalDefaultPersonAuthenticationType(org.gluu.oxauth.service.external.internal.InternalDefaultPersonAuthenticationType) SimpleCustomProperty(org.gluu.model.SimpleCustomProperty)

Aggregations

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