Package org.apache.geronimo.security.realm

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


                }
            } catch (IOException e) {
                log.error("Unable to save security realm", e);
            }
        } else {
            SecurityRealm realm = (SecurityRealm) PortletManager.getManagedBean(request, data.getObjectName());
            // index existing modules
            Map nodes = new HashMap();
            JaasLoginModuleChain node = (JaasLoginModuleChain) PortletManager.getManagedBean(request, realm.getLoginModuleChainName());
            while(node != null) {
                LoginModuleSettings module = (LoginModuleSettings) PortletManager.getManagedBean(request, node.getLoginModuleName());
                nodes.put(module.getLoginDomainName(), node);
                final String next = node.getNextName();
                if(next == 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 doc;
    }

    private void actionLoadExistingRealm(PortletRequest request, RealmData data) {
        SecurityRealm realm = (SecurityRealm) PortletManager.getManagedBean(request, new AbstractName(URI.create(data.getAbstractName())));
        data.name = realm.getRealmName();
        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

     *
     * @return The UserIdentifier used as an argument for the rest of the
     *         methods in this class.
     */
    public JaasClientId 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

        Subject subject = context.getSubject();
        ContextManager.registerSubject(subject);
        SubjectId id = ContextManager.getSubjectId(subject);
        IdentificationPrincipal principal = new IdentificationPrincipal(id);
        subject.getPrincipals().add(principal);
        SecurityRealm realm = getRealm(context.getRealmName());
        if (realm.isRestrictPrincipalsToServer()) {
            return new Principal[]{principal};
        } else {
            List list = new ArrayList();
            list.addAll(context.getProcessedPrincipals());
            list.add(principal);
View Full Code Here

        return clientId;
    }

    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

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.