Search in sources :

Example 6 with AMAuthenticationSchema

use of com.sun.identity.authentication.config.AMAuthenticationSchema in project OpenAM by OpenRock.

the class AuthPropertiesModelImpl method createAuthInstance.

public void createAuthInstance(String name, String type) throws AMConsoleException {
    String[] params = { currentRealm, name, type };
    logEvent("ATTEMPT_CREATE_AUTH_INSTANCE", params);
    try {
        AMAuthenticationManager mgr = new AMAuthenticationManager(getUserSSOToken(), currentRealm);
        AMAuthenticationSchema as = mgr.getAuthenticationSchema(type);
        mgr.createAuthenticationInstance(name, type, as.getAttributeValues());
        logEvent("SUCCEED_CREATE_AUTH_INSTANCE", params);
    } catch (AMConfigurationException e) {
        String strError = getErrorString(e);
        String[] paramsEx = { currentRealm, name, type, strError };
        logEvent("AUTH_CONFIG_EXCEPTION_CREATE_AUTH_INSTANCE", paramsEx);
        debug.warning("AuthPropertiesModelImpl.createAuthInstance ", e);
        throw new AMConsoleException(strError);
    }
}
Also used : AMAuthenticationSchema(com.sun.identity.authentication.config.AMAuthenticationSchema) AMConfigurationException(com.sun.identity.authentication.config.AMConfigurationException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) AMAuthenticationManager(com.sun.identity.authentication.config.AMAuthenticationManager)

Example 7 with AMAuthenticationSchema

use of com.sun.identity.authentication.config.AMAuthenticationSchema in project OpenAM by OpenRock.

the class AuthPropertiesModelImpl method getAuthTypes.

public Map getAuthTypes() {
    Map authAndLocalizedTypes = Collections.EMPTY_MAP;
    try {
        logEvent("ATTEMPT_GET_AUTH_TYPE", getServerInstanceForLogMsg());
        AMAuthenticationManager mgr = new AMAuthenticationManager(getUserSSOToken(), "/");
        Set types = mgr.getAuthenticationTypes();
        authAndLocalizedTypes = new HashMap(types.size());
        for (Iterator iter = types.iterator(); iter.hasNext(); ) {
            String authType = (String) iter.next();
            AMAuthenticationSchema schema = mgr.getAuthenticationSchema(authType);
            String svcName = schema.getServiceName();
            String localizedName = (svcName != null && svcName.length() > 0) ? getLocalizedServiceName(svcName) : authType;
            authAndLocalizedTypes.put(authType, localizedName);
        }
        logEvent("SUCCEED_GET_AUTH_TYPE", getServerInstanceForLogMsg());
    } catch (AMConfigurationException e) {
        String strError = getErrorString(e);
        String[] paramEx = { strError };
        logEvent("SMS_EXCEPTION_GET_AUTH_TYPE", paramEx);
        debug.warning("AuthPropertiesModelImpl.getAuthTypes", e);
    }
    return authAndLocalizedTypes;
}
Also used : Set(java.util.Set) HashMap(java.util.HashMap) AMAuthenticationSchema(com.sun.identity.authentication.config.AMAuthenticationSchema) Iterator(java.util.Iterator) AMConfigurationException(com.sun.identity.authentication.config.AMConfigurationException) HashMap(java.util.HashMap) Map(java.util.Map) AMAuthenticationManager(com.sun.identity.authentication.config.AMAuthenticationManager)

Aggregations

AMAuthenticationManager (com.sun.identity.authentication.config.AMAuthenticationManager)7 AMAuthenticationSchema (com.sun.identity.authentication.config.AMAuthenticationSchema)7 AMConfigurationException (com.sun.identity.authentication.config.AMConfigurationException)6 SSOToken (com.iplanet.sso.SSOToken)2 AMAuthenticationInstance (com.sun.identity.authentication.config.AMAuthenticationInstance)2 CLIException (com.sun.identity.cli.CLIException)2 Map (java.util.Map)2 SSOException (com.iplanet.sso.SSOException)1 IOutput (com.sun.identity.cli.IOutput)1 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)1 SMSException (com.sun.identity.sm.SMSException)1 ServiceSchemaManager (com.sun.identity.sm.ServiceSchemaManager)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 Set (java.util.Set)1