Examples of AuthenticationModule


Examples of com.adito.security.AuthenticationModule

                scheme = (AuthenticationScheme) request.getSession().getAttribute(Constants.AUTH_SESSION);
            }
        }

        if (scheme != null) {
            AuthenticationModule module = scheme.currentAuthenticationModule();
            if (module == null) {
                log.error("No authentication module.");
                request.getSession().removeAttribute(Constants.AUTH_SESSION);
                return mapping.findForward("logon");
            }

            try {             
              // If there is no user in the scheme then it is an invalid login
              if(scheme.getUser() == null) {
                throw new InvalidLoginCredentialsException();
              }
             
              // Check the account is enabled and not locked
              if(!PolicyUtil.isEnabled(scheme.getUser())) {
                throw new AccountLockedException(scheme.getUsername(), "Account disabled.", true, 0);
              }
             
              // Check for locks
              LogonControllerFactory.getInstance().checkForAccountLock(scheme.getUsername(), scheme.getUser().getRealm().getResourceName());

              // Authenticate
                authenticate(scheme, request);

                // Check logon is currently allowed
                String logonNotAllowedReason = LogonControllerFactory.getInstance().checkLogonAllowed(
                                scheme.getUser());

                if (logonNotAllowedReason != null) {
                    log.warn("Logon not allowed because '" + logonNotAllowedReason + "'");
                    msgs.add(Globals.ERROR_KEY, new ActionMessage("login.logonNotAllowed", logonNotAllowedReason));
                    saveErrors(request, msgs);
                    return new RedirectWithMessages(mapping.findForward("logon"), request);
                }

                // Check for the next authentication modules
                AuthenticationModule nextModule = scheme.nextAuthenticationModule();
                if (nextModule != null && request.getSession().getAttribute(Constants.SESSION_LOCKED) == null) {
                    if (log.isDebugEnabled())
                        log.debug("There are more authentication modules to satisfy (current mapping = " + mapping.getPath());
                    ActionForward fw = new RedirectWithMessages(mapping.findForward("logon"), request);
                    return fw;
View Full Code Here

Examples of com.adito.security.AuthenticationModule

     * @param scheme scheme
     * @param request request
     * @throws Exception on any error
     */
    public static void authenticate(AuthenticationScheme scheme, HttpServletRequest request) throws Exception {
        AuthenticationModule module = scheme.currentAuthenticationModule();
        if (module == null) {
            throw new Exception("No current authentication module");
        }
        RequestParameterMap params = new RequestParameterMap(new ServletRequestAdapter(request));
        User currentUser = scheme.getUser();
        LogonStateAndCache logonStateMachine = (LogonStateAndCache) request.getSession().getAttribute(
                        LogonStateAndCache.LOGON_STATE_MACHINE);

        if (logonStateMachine == null) {
            logonStateMachine = new LogonStateAndCache(LogonStateAndCache.STATE_STARTED, request.getSession());
        }

        if (logonStateMachine.getState() == LogonStateAndCache.STATE_KNOWN_USERNAME_NO_SCHEME_SPOOF_PASSWORD_ENTRY) {
            scheme.addCredentials(new PasswordCredentials("", "".toCharArray()));
        } else if (logonStateMachine.getState() == LogonStateAndCache.STATE_UNKNOWN_USERNAME_PROMPT_FOR_PASSWORD) {
            Credentials creds = module.authenticate(request, params);
            if(creds!=null)
              scheme.addCredentials(creds);
        } else {
          Credentials creds = module.authenticate(request, params);
            if(creds!=null) {
              scheme.addCredentials(creds);
              logonStateMachine.setState(LogonStateAndCache.STATE_VALID_LOGON);
            }
            // Check we have a user object
View Full Code Here

Examples of com.adito.security.AuthenticationModule

                    log.debug("Scheme " + authScheme.getSchemeName() + " initialised OK");
            }
        }

        while (true) {
            AuthenticationModule module = authScheme.currentAuthenticationModule();
            if (form != null) {
                form.setCurrentModuleIndex(authScheme.getCurrentModuleIndex());
            }

            // The module may wish to forward somewhere other than to the
            // default login page
            ActionForward forward = module.startAuthentication(mapping, request, response);

            if (module.isRequired()) {
                return forward;
            } else {
                // Are we at the end of the sequence
                if (authScheme.nextAuthenticationModule() == null) {
                    return LogonAction.finishAuthentication(authScheme, request, response);
View Full Code Here

Examples of com.changestuffs.scrum.server.authentication.AuthenticationModule

import com.google.inject.AbstractModule;

public class ServerModule extends AbstractModule {
    @Override
    protected void configure() {
      install(new AuthenticationModule());
        install(new RestModule());
    }
View Full Code Here

Examples of de.innovationgate.webgate.api.auth.AuthenticationModule

    /* (non-Javadoc)
     * @see de.innovationgate.webgate.api.auth.DefaultAuthModuleFactory#createAuthModule(java.lang.String)
     */
    protected AuthenticationModule createAuthModule(String type) throws ConfigurationException {
        AuthenticationModule module = null;
       
        // First try. Create modules hosted by this module factory
        if (type.equals((AUTHMODULE_CS))) {
            module = new CSAuthModule();
        }
View Full Code Here

Examples of de.innovationgate.webgate.api.auth.AuthenticationModule

            _cachedListeners.add(listener);
            return;
        }
       
       
        AuthenticationModule mod = getAuthModule();
        if (mod == null) {
            return;
        }
       
        mod.addAuthenticationSourceListener(listener);
    }
View Full Code Here

Examples of de.innovationgate.webgate.api.auth.AuthenticationModule

        mod.addAuthenticationSourceListener(listener);
    }

    public void clearCache() {

        AuthenticationModule mod = getAuthModule();
        if (mod == null) {
            return;
        }
       
        mod.clearCache();

    }
View Full Code Here

Examples of de.innovationgate.webgate.api.auth.AuthenticationModule

        // No, we won't pass this on. Target module should destroy itself
    }

    public Class[] getAllowedCredentialClasses() {
       
        AuthenticationModule mod = getAuthModule();
        if (mod == null) {
            return new Class[] {};
        }
       
        return mod.getAllowedCredentialClasses();

    }
View Full Code Here

Examples of de.innovationgate.webgate.api.auth.AuthenticationModule

       
        if (!_ready) {
            return "Delegate Auth Module, not yet ready";
        }
       
        AuthenticationModule mod = getAuthModule();
        if (mod == null) {
            return "No authentication";
        }
       
        return mod.getAuthenticationSource() + " (delegated)";
    }
View Full Code Here

Examples of de.innovationgate.webgate.api.auth.AuthenticationModule

       
        return mod.getAuthenticationSource() + " (delegated)";
    }

    public String getEMailAddress(String user) {
        AuthenticationModule mod = getAuthModule();
        if (mod == null) {
            return null;
        }
       
        return mod.getEMailAddress(user);

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.