Package org.apache.geronimo.security.realm

Examples of org.apache.geronimo.security.realm.SecurityRealm


        return sessionHandle;
    }

    private SecurityRealm getRealm(String realmName) {
        for (Iterator it = realms.iterator(); it.hasNext();) {
            SecurityRealm test = (SecurityRealm) it.next();
            if (test.getRealmName().equals(realmName)) {
                return test;
            }
        }
        return null;
    }
View Full Code Here


    }

    public SerializableACE[] getAppConfigurationEntries(String realmName) {

        for (Iterator iter = getRealms().iterator(); iter.hasNext();) {
            SecurityRealm securityRealm = (SecurityRealm) iter.next();

            if (realmName.equals(securityRealm.getRealmName())) {
                javax.security.auth.login.AppConfigurationEntry[] entries = securityRealm.getAppConfigurationEntries();
                SerializableACE[] results = new SerializableACE[entries.length];
                for(int i = 0; i < entries.length; i++) {
                    AppConfigurationEntry entry = entries[i];

                    HashMap options = new HashMap();

                    options.put(LoginModuleConstants.REALM_NAME, realmName);
                    options.put(LoginModuleConstants.MODULE, entry.getLoginModuleName());

                    SerializableACE wrapper;

                    if (securityRealm.isLoginModuleLocal()) {
                        wrapper = new SerializableACE("org.apache.geronimo.security.jaas.RemoteLoginModuleLocalWrapper",
                                LoginModuleControlFlag.REQUIRED,
                                options);

                    } else {
View Full Code Here

        LoginModuleCacheObject lm = null;

        synchronized (LoginService.class) {
            try {
                for (Iterator iter = getRealms().iterator(); iter.hasNext();) {
                    SecurityRealm securityRealm = (SecurityRealm) iter.next();

                    if (realmName.equals(securityRealm.getRealmName())) {
                        AppConfigurationEntry[] entries = securityRealm.getAppConfigurationEntries();
                        Subject subject = new Subject();
                        CallbackProxy callback = new CallbackProxy();
                        LoginModuleConfiguration[] modules = new LoginModuleConfiguration[entries.length];
                        for(int i = 0; i < entries.length; i++) {
                            AppConfigurationEntry entry = entries[i];

                            final String finalClass = entry.getLoginModuleName();

                            LoginModule module = (LoginModule) AccessController.doPrivileged(new java.security.PrivilegedExceptionAction() {
                                public Object run() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
                                    return Class.forName(finalClass, true, classLoader).newInstance();
                                }
                            });
                            module.initialize(subject, callback, new HashMap(), entry.getOptions());
                            modules[i] = new LoginModuleConfiguration(module, LoginModuleControlFlag.getInstance(entry.getControlFlag()));

                        }
                        lm = allocateLoginModuleCacheObject(securityRealm.getMaxLoginModuleAge());
                        lm.setRealmName(realmName);
                        lm.setLoginModules(modules);
                        lm.setSubject(subject);
                        lm.setCallbackHandler(callback);
                        log.trace("LoginModule [" + lm.getLoginModuleId() + "] created for realm " + realmName);
View Full Code Here

        return doc;
    }

    private void actionLoadExistingRealm(PortletRequest request, RealmData data) {
        SecurityRealm realm = (SecurityRealm) PortletManager.getManagedBean(request, new AbstractName(URI.create(data.getAbstractName())));
        data.name = realm.getRealmName();
        data.global = ((ConfigurationEntryFactory)realm).isGlobal();
        List list = new ArrayList();
        JaasLoginModuleChain node = realm.getLoginModuleChain();
        while (node != null) {
            LoginModuleDetails details = new LoginModuleDetails();
            details.setControlFlag(node.getControlFlag());
            LoginModuleSettings module = node.getLoginModule();
            details.setLoginDomainName(module.getLoginDomainName());
View Full Code Here

            } catch (IOException e) {
                log.error("Unable to save security realm", e);
                return "Unable to save security realm: " + e.getMessage();
            }
        } else {
            SecurityRealm realm = (SecurityRealm) PortletManager.getManagedBean(request, new AbstractName(URI.create(data.getAbstractName())));
            // index existing modules
            Map nodes = new HashMap();
            JaasLoginModuleChain node = realm.getLoginModuleChain();
            while (node != null) {
                LoginModuleSettings module = node.getLoginModule();
                nodes.put(module.getLoginDomainName(), node);
                node = node.getNext();
                if (node == null) {
View Full Code Here

    }

    public SerializableACE getAppConfigurationEntry(String realmName) {

        for (Iterator iter = getRealms().iterator(); iter.hasNext();) {
            SecurityRealm securityRealm = (SecurityRealm) iter.next();

            if (realmName.equals(securityRealm.getRealmName())) {
                javax.security.auth.login.AppConfigurationEntry entry = securityRealm.getAppConfigurationEntry();

                HashMap options = new HashMap();

                options.put(LoginModuleConstants.REALM_NAME, realmName);
                options.put(LoginModuleConstants.MODULE, entry.getLoginModuleName());

                SerializableACE wrapper;

                if (securityRealm.isLoginModuleLocal()) {
                    wrapper = new SerializableACE("org.apache.geronimo.security.jaas.RemoteLoginModuleLocalWrapper",
                                                  SerializableACE.LoginModuleControlFlag.REQUIRED,
                                                  options);

                } else {
View Full Code Here

        LoginModuleCacheObject lm = null;

        synchronized (LoginService.class) {
            try {
                for (Iterator iter = getRealms().iterator(); iter.hasNext();) {
                    SecurityRealm securityRealm = (SecurityRealm) iter.next();

                    if (realmName.equals(securityRealm.getRealmName())) {
                        AppConfigurationEntry entry = securityRealm.getAppConfigurationEntry();

                        final String finalClass = entry.getLoginModuleName();

                        LoginModule module = (LoginModule) AccessController.doPrivileged(new java.security.PrivilegedExceptionAction() {
                            public Object run() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
                                return Class.forName(finalClass, true, classLoader).newInstance();
                            }
                        });
                        Subject subject = new Subject();
                        CallbackProxy callback = new CallbackProxy();
                        module.initialize(subject, callback, new HashMap(), entry.getOptions());

                        lm = allocateLoginModuleCacheObject(securityRealm.getMaxLoginModuleAge());
                        lm.setRealmName(realmName);
                        lm.setLoginModule(module);
                        lm.setSubject(subject);
                        lm.setCallbackHandler(callback);
View Full Code Here

     *
     * @return The client handle used as an argument for the rest of the
     *         methods in this class.
     */
    public JaasSessionId connectToRealm(String realmName) {
        SecurityRealm realm = null;
        realm = getRealm(realmName);
        if (realm == null) {
            throw new GeronimoSecurityException("No such realm (" + realmName + ")");
        } else {
            return initializeClient(realm);
View Full Code Here

        return sessionHandle;
    }

    private SecurityRealm getRealm(String realmName) {
        for (Iterator it = realms.iterator(); it.hasNext();) {
            SecurityRealm test = (SecurityRealm) it.next();
            if (test.getRealmName().equals(realmName)) {
                return test;
            }
        }
        return null;
    }
View Full Code Here

        return doc;
    }

    private void actionLoadExistingRealm(PortletRequest request, RealmData data) {
        SecurityRealm realm = (SecurityRealm) PortletManager.getManagedBean(request, data.getObjectName());
        data.name = realm.getRealmName();
        List list = new ArrayList();
        JaasLoginModuleChain node = (JaasLoginModuleChain) PortletManager.getManagedBean(request, realm.getLoginModuleChainName());
        while(node != null) {
            LoginModuleDetails details = new LoginModuleDetails();
            details.setControlFlag(node.getControlFlag());
            LoginModuleSettings module = (LoginModuleSettings) PortletManager.getManagedBean(request, node.getLoginModuleName());
            details.setLoginDomainName(module.getLoginDomainName());
View Full Code Here

TOP

Related Classes of org.apache.geronimo.security.realm.SecurityRealm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.