Search in sources :

Example 6 with CustomScriptConfiguration

use of org.gluu.model.custom.script.conf.CustomScriptConfiguration in project oxAuth by GluuFederation.

the class U2fRegistrationWS method isCurrentAuthenticationLevelCorrespondsToU2fLevel.

private boolean isCurrentAuthenticationLevelCorrespondsToU2fLevel(String session) {
    SessionId sessionId = sessionIdService.getSessionId(session);
    if (sessionId == null)
        return false;
    String acrValuesStr = sessionIdService.getAcr(sessionId);
    if (acrValuesStr == null)
        return false;
    CustomScriptConfiguration u2fScriptConfiguration = service.getCustomScriptConfigurationByName("u2f");
    if (u2fScriptConfiguration == null)
        return false;
    String[] acrValuesArray = acrValuesStr.split(" ");
    for (String acrValue : acrValuesArray) {
        CustomScriptConfiguration currentScriptConfiguration = service.getCustomScriptConfigurationByName(acrValue);
        if (currentScriptConfiguration == null)
            continue;
        if (currentScriptConfiguration.getLevel() >= u2fScriptConfiguration.getLevel())
            return true;
    }
    return false;
}
Also used : SessionId(org.gluu.oxauth.model.common.SessionId) CustomScriptConfiguration(org.gluu.model.custom.script.conf.CustomScriptConfiguration)

Example 7 with CustomScriptConfiguration

use of org.gluu.model.custom.script.conf.CustomScriptConfiguration in project oxAuth by GluuFederation.

the class UmaGatherer method getScript.

protected CustomScriptConfiguration getScript(final SessionId session) {
    String scriptName = umaSessionService.getScriptName(session);
    CustomScriptConfiguration script = external.getCustomScriptConfigurationByName(scriptName);
    return script;
}
Also used : CustomScriptConfiguration(org.gluu.model.custom.script.conf.CustomScriptConfiguration)

Example 8 with CustomScriptConfiguration

use of org.gluu.model.custom.script.conf.CustomScriptConfiguration in project oxAuth by GluuFederation.

the class ExternalAuthenticationService method buildScriptAliases.

private HashMap<String, String> buildScriptAliases() {
    HashMap<String, String> newScriptAliases = new HashMap<String, String>();
    for (Entry<String, CustomScriptConfiguration> script : customScriptConfigurationsNameMap.entrySet()) {
        String name = script.getKey();
        CustomScript customScript = script.getValue().getCustomScript();
        newScriptAliases.put(name, name);
        List<String> aliases = customScript.getAliases();
        if (aliases != null) {
            for (String alias : aliases) {
                if (StringUtils.isNotBlank(alias)) {
                    newScriptAliases.put(alias, name);
                }
            }
        }
    }
    return newScriptAliases;
}
Also used : CustomScript(org.gluu.model.custom.script.model.CustomScript) AuthenticationCustomScript(org.gluu.model.custom.script.model.auth.AuthenticationCustomScript) HashMap(java.util.HashMap) CustomScriptConfiguration(org.gluu.model.custom.script.conf.CustomScriptConfiguration)

Example 9 with CustomScriptConfiguration

use of org.gluu.model.custom.script.conf.CustomScriptConfiguration in project oxAuth by GluuFederation.

the class ExternalAuthenticationService method getInternalCustomScriptConfiguration.

private CustomScriptConfiguration getInternalCustomScriptConfiguration(GluuLdapConfiguration ldapAuthConfig) {
    CustomScriptConfiguration customScriptConfiguration = getInternalCustomScriptConfiguration();
    customScriptConfiguration.getCustomScript().setName(ldapAuthConfig.getConfigId());
    return customScriptConfiguration;
}
Also used : CustomScriptConfiguration(org.gluu.model.custom.script.conf.CustomScriptConfiguration)

Example 10 with CustomScriptConfiguration

use of org.gluu.model.custom.script.conf.CustomScriptConfiguration in project oxAuth by GluuFederation.

the class ExternalAuthenticationService method determineDefaultCustomScriptConfigurationsMap.

private Map<AuthenticationScriptUsageType, CustomScriptConfiguration> determineDefaultCustomScriptConfigurationsMap(Map<String, CustomScriptConfiguration> customScriptConfigurationsMap) {
    Map<AuthenticationScriptUsageType, CustomScriptConfiguration> newDefaultCustomScriptConfigurationsMap = new HashMap<AuthenticationScriptUsageType, CustomScriptConfiguration>();
    for (AuthenticationScriptUsageType usageType : AuthenticationScriptUsageType.values()) {
        CustomScriptConfiguration defaultExternalAuthenticator = null;
        for (CustomScriptConfiguration customScriptConfiguration : customScriptConfigurationsMapByUsageType.get(usageType)) {
            // Determine default authenticator. It has bigger level than others
            if ((defaultExternalAuthenticator == null) || (defaultExternalAuthenticator.getLevel() < customScriptConfiguration.getLevel())) {
                defaultExternalAuthenticator = customScriptConfiguration;
            }
        }
        newDefaultCustomScriptConfigurationsMap.put(usageType, defaultExternalAuthenticator);
    }
    return newDefaultCustomScriptConfigurationsMap;
}
Also used : HashMap(java.util.HashMap) AuthenticationScriptUsageType(org.gluu.model.AuthenticationScriptUsageType) CustomScriptConfiguration(org.gluu.model.custom.script.conf.CustomScriptConfiguration)

Aggregations

CustomScriptConfiguration (org.gluu.model.custom.script.conf.CustomScriptConfiguration)35 SessionId (org.gluu.oxauth.model.common.SessionId)9 HttpServletRequest (javax.servlet.http.HttpServletRequest)6 HttpServletResponse (javax.servlet.http.HttpServletResponse)5 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 WebApplicationException (javax.ws.rs.WebApplicationException)3 CustomScript (org.gluu.model.custom.script.model.CustomScript)3 AuthenticationCustomScript (org.gluu.model.custom.script.model.auth.AuthenticationCustomScript)3 ConsentGatheringContext (org.gluu.oxauth.service.external.context.ConsentGatheringContext)3 UmaGatherContext (org.gluu.oxauth.uma.authorization.UmaGatherContext)3 AuthenticationScriptUsageType (org.gluu.model.AuthenticationScriptUsageType)2 User (org.gluu.oxauth.model.common.User)2 Client (org.gluu.oxauth.model.registration.Client)2 Scope (org.oxauth.persistence.model.Scope)2 IOException (java.io.IOException)1 URI (java.net.URI)1 Date (java.util.Date)1 HashSet (java.util.HashSet)1 List (java.util.List)1