Package javax.security.auth.spi

Examples of javax.security.auth.spi.LoginModule


            } catch (MalformedURLException e) {
                log.warn("Repository unable to look up JAR file", e);
            }
        }
        Class cls = loader.loadClass(getSelectedModule(data).getClassName());
        LoginModule module = (LoginModule) cls.newInstance();
        for (Iterator it = data.getOptions().keySet().iterator(); it.hasNext();) {
            String key = (String) it.next();
            final Object value = data.getOptions().get(key);
            if (value != null && !value.equals("")) {
                options.put(key, value);
View Full Code Here


    private void actionAttemptLogin(RealmData data, PortletRequest request, PortletSession session, String username, String password) {
        session.removeAttribute("TestLoginPrincipals");
        session.removeAttribute("TestLoginError");
        Map options = new HashMap();
        try {
            LoginModule module = loadModule(request, data, options);
            Subject sub = PortletManager.testLoginModule(request, module, options, username, password);
            session.setAttribute("TestLoginPrincipals", sub.getPrincipals());
        } catch (Exception e) {
            log.warn("Test login failed", e);
            session.setAttribute("TestLoginError", "Login Failed: " + (e.getMessage() == null ? "no message" : e.getMessage()));
View Full Code Here

      {
         ClassLoader tcl = SecurityActions.getContextClassLoader();
         try
         {
            Class clazz = tcl.loadClass(loginModuleName);
            LoginModule lm = (LoginModule) clazz.newInstance();
            lm.initialize(clientSubject, callbackHandler, new HashMap(), options);
            lm.login();
            lm.commit();
         }
         catch (Exception e)
         {
            throw new AuthException(e.getLocalizedMessage());
         }
View Full Code Here

        for (int i = 0; i < proxies.length; i++) {
            if (config[i].isServerSide()) {
                proxies[i] = new ServerLoginProxy(config[i].getFlag(), subject, i, service, sessionHandle);
            } else {
                LoginModule source = config[i].getLoginModule(JaasLoginCoordinator.class.getClassLoader());
                if (config[i].isWrapPrincipals()) {
                    proxies[i] = new WrappingClientLoginModuleProxy(config[i].getFlag(), subject, source, config[i].getLoginDomainName(), realmName);
                } else {
                    proxies[i] = new ClientLoginModuleProxy(config[i].getFlag(), subject, source);
                }
View Full Code Here

     * populates them, and sends them back to the server.
     */
    public Callback[] getServerLoginCallbacks(JaasSessionId sessionHandle, int loginModuleIndex) throws LoginException {
        JaasSecuritySession session = (JaasSecuritySession) activeLogins.get(sessionHandle);
        checkContext(session, loginModuleIndex);
        LoginModule module = session.getLoginModule(loginModuleIndex);

        session.getHandler().setExploring();
        try {
            module.initialize(session.getSubject(), session.getHandler(), new HashMap(), session.getOptions(loginModuleIndex));
        } catch (Exception e) {
            log.error("Failed to initialize module", e);
        }
        try {
            module.login();
        } catch (LoginException e) {
            //expected
        }
        try {
            module.abort();
        } catch (LoginException e) {
            //makes no difference
        }
        return session.getHandler().finalizeCallbackList();
    }
View Full Code Here

      {
         ClassLoader tcl = SecurityActions.getContextClassLoader();
         try
         {
            Class clazz = tcl.loadClass(loginModuleName);
            LoginModule lm = (LoginModule) clazz.newInstance();
            lm.initialize(clientSubject, callbackHandler, new HashMap(), options);
            lm.login();
            lm.commit();
         }
         catch (Exception e)
         {
            throw new AuthException(e.getLocalizedMessage());
         }
View Full Code Here

                        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);
View Full Code Here

            modules = new LoginModuleConfiguration[entries.length];
            for(int i = 0; i < entries.length; i++) {
                SerializableACE entry = entries[i];

                final String finalClass = entry.getLoginModuleName();
                LoginModule wrapper;
                wrapper = (LoginModule) AccessController.doPrivileged(new PrivilegedExceptionAction() {
                    public Object run() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
                        return Class.forName(finalClass, true, classLoader).newInstance();
                    }
                });

                HashMap map = new HashMap(entry.getOptions());
                map.put(LOGIN_SERVICE, remoteLoginService);

                wrapper.initialize(subject, callbackHandler, sharedState, map);
                modules[i] = new LoginModuleConfiguration(wrapper, entry.getControlFlag());
            }

            if (debug) {
                System.out.print("[GeronimoLoginModule] Debug is  " + debug + " uri " + uri + " realm " + realm + "\n");
View Full Code Here

    }

    private String actionTestLoginModuleLoad(PortletRequest request, RealmData data) {
        Map options = new HashMap();
        try {
            LoginModule module = loadModule(request, data, options);
            log.warn("Testing with options " + options);
            try {
                PortletManager.testLoginModule(request, module, options);
                return null;
            } catch (Exception e) {
View Full Code Here

            } catch (MalformedURLException e) {
                log.warn("Repository unable to look up JAR file", e);
            }
        }
        Class cls = loader.loadClass(getSelectedModule(data).getClassName());
        LoginModule module = (LoginModule) cls.newInstance();
        for (Iterator it = data.getOptions().keySet().iterator(); it.hasNext();) {
            String key = (String) it.next();
            final Object value = data.getOptions().get(key);
            if (value != null && !value.equals("")) {
                options.put(key, value);
View Full Code Here

TOP

Related Classes of javax.security.auth.spi.LoginModule

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.