Search in sources :

Example 6 with ServiceSchemaManager

use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.

the class AuthUtils method getAuthRevisionNumber.

public static int getAuthRevisionNumber() {
    try {
        SSOToken token = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
        ServiceSchemaManager scm = new ServiceSchemaManager(ISAuthConstants.AUTH_SERVICE_NAME, token);
        return scm.getRevisionNumber();
    } catch (Exception e) {
        if (utilDebug.messageEnabled()) {
            utilDebug.message("getAuthRevisionNumber error", e);
        }
    }
    return 0;
}
Also used : SSOToken(com.iplanet.sso.SSOToken) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager) AuthLoginException(com.sun.identity.authentication.spi.AuthLoginException) SSOException(com.iplanet.sso.SSOException) SMSException(com.sun.identity.sm.SMSException) SessionException(com.iplanet.dpro.session.SessionException)

Example 7 with ServiceSchemaManager

use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.

the class AuthUtils method getGlobalAttributes.

/**
      * Returns <code>Map</code> attributes
      *
      * @param serviceName Service Name
      * @return <code>Map</code> of global attributes.
      */
public static Map getGlobalAttributes(String serviceName) {
    Map attrs = null;
    try {
        SSOToken dUserToken = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
        ServiceSchemaManager scm = new ServiceSchemaManager(serviceName, dUserToken);
        ServiceSchema schema = scm.getGlobalSchema();
        if (schema != null) {
            attrs = schema.getAttributeDefaults();
        }
    } catch (SMSException smsExp) {
        utilDebug.error("AuthUtils.getGlobalAttributes: SMS Error", smsExp);
    } catch (SSOException ssoExp) {
        utilDebug.error("AuthUtils.getGlobalAttributes: SSO Error", ssoExp);
    }
    if (utilDebug.messageEnabled()) {
        utilDebug.message("AuthUtils.getGlobalAttributes: attrs=" + attrs);
    }
    return attrs;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) SSOToken(com.iplanet.sso.SSOToken) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) Map(java.util.Map) HashMap(java.util.HashMap) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 8 with ServiceSchemaManager

use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.

the class AuthD method initPlatformServiceGlobalSettings.

/**
     * Initialized platform service global attributes
     * @throws SMSException if it fails to initialize platform service
     * @throws SSOException if admin <code>SSOToken</code> is not valid 
     */
private void initPlatformServiceGlobalSettings() throws SMSException, SSOException {
    ServiceSchemaManager scm = new ServiceSchemaManager(ISAuthConstants.PLATFORM_SERVICE_NAME, ssoAuthSession);
    updatePlatformServiceGlobals(scm);
    new AuthConfigMonitor(scm);
}
Also used : ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 9 with ServiceSchemaManager

use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.

the class AuthD method initAuthConfigGlobalSettings.

/**
     * Initialize the AuthConfiguration global attributes.
     * @throws SMSException if it fails to get auth service for name
     * @throws SSOException if admin <code>SSOToken</code> is not valid 
     * @throws Exception
     */
private void initAuthConfigGlobalSettings() throws Exception {
    ServiceSchemaManager scm = new ServiceSchemaManager(ISAuthConstants.AUTHCONFIG_SERVICE_NAME, ssoAuthSession);
    updateAuthConfigGlobals(scm);
    new AuthConfigMonitor(scm);
}
Also used : ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 10 with ServiceSchemaManager

use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.

the class NamingService method initialize.

public static void initialize() {
    namingDebug = Debug.getInstance("amNaming");
    platformProperties = SystemProperties.getAll();
    server_proto = platformProperties.getProperty("com.iplanet.am.server.protocol", "");
    server_host = platformProperties.getProperty("com.iplanet.am.server.host", "");
    server_port = platformProperties.getProperty(Constants.AM_SERVER_PORT, "");
    PrivilegedAction<SSOToken> adminAction = InjectorHolder.getInstance(Key.get(new TypeLiteral<PrivilegedAction<SSOToken>>() {
    }));
    sso = AccessController.doPrivileged(adminAction);
    try {
        ssmNaming = new ServiceSchemaManager(NAMING_SERVICE, sso);
        ssmPlatform = new ServiceSchemaManager(PLATFORM_SERVICE, sso);
        serviceRevNumber = ssmPlatform.getRevisionNumber();
    } catch (SMSException | SSOException e) {
        throw new IllegalStateException(e);
    }
    ServiceListeners.Action action = new ServiceListeners.Action() {

        @Override
        public void performUpdate() {
            try {
                updateNamingTable();
                WebtopNaming.updateNamingTable();
            } catch (Exception ex) {
                namingDebug.error("Error occured in updating naming table", ex);
            }
        }
    };
    ServiceListeners builder = InjectorHolder.getInstance(ServiceListeners.class);
    builder.config(NAMING_SERVICE).global(action).schema(action).listen();
    builder.config(PLATFORM_SERVICE).global(action).schema(action).listen();
}
Also used : ServiceListeners(com.iplanet.services.naming.ServiceListeners) PrivilegedAction(java.security.PrivilegedAction) SSOToken(com.iplanet.sso.SSOToken) TypeLiteral(com.google.inject.TypeLiteral) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager) ServerEntryNotFoundException(com.iplanet.services.naming.ServerEntryNotFoundException) SMSException(com.sun.identity.sm.SMSException) MalformedURLException(java.net.MalformedURLException) SSOException(com.iplanet.sso.SSOException)

Aggregations

ServiceSchemaManager (com.sun.identity.sm.ServiceSchemaManager)209 SMSException (com.sun.identity.sm.SMSException)146 ServiceSchema (com.sun.identity.sm.ServiceSchema)131 SSOException (com.iplanet.sso.SSOException)119 Set (java.util.Set)87 HashSet (java.util.HashSet)60 Map (java.util.Map)56 HashMap (java.util.HashMap)49 AttributeSchema (com.sun.identity.sm.AttributeSchema)46 SSOToken (com.iplanet.sso.SSOToken)43 Iterator (java.util.Iterator)40 CLIException (com.sun.identity.cli.CLIException)33 BeforeTest (org.testng.annotations.BeforeTest)27 AfterTest (org.testng.annotations.AfterTest)26 Test (org.testng.annotations.Test)26 CLIRequest (com.sun.identity.cli.CLIRequest)25 Parameters (org.testng.annotations.Parameters)18 ServiceConfigManager (com.sun.identity.sm.ServiceConfigManager)15 TreeSet (java.util.TreeSet)12 ByteString (org.forgerock.opendj.ldap.ByteString)11