Examples of AuthenticatedUser


Examples of org.apache.cassandra.auth.AuthenticatedUser

    public void login(AuthenticationRequest auth_request) throws AuthenticationException, AuthorizationException, TException
    {
        try
        {
            AuthenticatedUser user = DatabaseDescriptor.getAuthenticator().authenticate(auth_request.getCredentials());
            state().login(user);
        }
        catch (org.apache.cassandra.exceptions.AuthenticationException e)
        {
            throw ThriftConversion.toThrift(e);
View Full Code Here

Examples of org.apache.cassandra.auth.AuthenticatedUser

    public void login(AuthenticationRequest auth_request) throws AuthenticationException, AuthorizationException, TException
    {
        try
        {
            AuthenticatedUser user = DatabaseDescriptor.getAuthenticator().authenticate(auth_request.getCredentials());
            state().login(user);
        }
        catch (org.apache.cassandra.exceptions.AuthenticationException e)
        {
            throw ThriftConversion.toThrift(e);
View Full Code Here

Examples of org.apache.cassandra.auth.AuthenticatedUser

        assert pass != null;

        String password = pass.toString();

        if (authenticationService.authenticate(userName, password)) {
            AuthenticatedUser authenticatedUser = new AuthenticatedUser(userName,
                    Collections.<String>emptySet(), domainName);
            return authenticatedUser;
        }

        return null//
View Full Code Here

Examples of org.apache.cassandra.auth.AuthenticatedUser

    /**
     * Attempts to login this client with the given credentials map.
     */
    public void login(Map<? extends CharSequence,? extends CharSequence> credentials) throws AuthenticationException
    {
        AuthenticatedUser user = DatabaseDescriptor.getAuthenticator().authenticate(credentials);
        if (logger.isDebugEnabled())
            logger.debug("logged in: {}", user);
        this.user = user;
        setQualifiedKeyspace();
    }
View Full Code Here

Examples of org.apache.cassandra.auth.AuthenticatedUser

    public void login(AuthenticationRequest auth_request) throws AuthenticationException, AuthorizationException, TException
    {
        try
        {
            AuthenticatedUser user = DatabaseDescriptor.getAuthenticator().authenticate(auth_request.getCredentials());
            state().login(user);
        }
        catch (org.apache.cassandra.exceptions.AuthenticationException e)
        {
            throw ThriftConversion.toThrift(e);
View Full Code Here

Examples of org.apache.cassandra.auth.AuthenticatedUser

        state.ensureNotAnonymous();

        if (!Auth.isExistingUser(username))
            throw new InvalidRequestException(String.format("User %s doesn't exist", username));

        AuthenticatedUser user = state.getUser();
        if (user != null && user.getName().equals(username))
            throw new InvalidRequestException("Users aren't allowed to DROP themselves");
    }
View Full Code Here

Examples of org.apache.cassandra.auth.AuthenticatedUser

    public Message.Response execute(QueryState state)
    {
        try
        {
            AuthenticatedUser user = DatabaseDescriptor.getAuthenticator().authenticate(credentials);
            state.getClientState().login(user);
            return new ReadyMessage();
        }
        catch (AuthenticationException e)
        {
View Full Code Here

Examples of org.apache.jetspeed.security.AuthenticatedUser

                boolean success = false;
                String password = userBean.getPassword();
                User user = userBean.getUser();
                if (user != null && password != null)
                {
                    AuthenticatedUser authUser = null;
                    try
                    {
                        authUser = authorization.authenticate(userBean.getUsername(), password);
                    }
                    catch (SecurityException e)
                    {
                        RequestContext rc = SecurityHelper.getRequestContext(actionRequest);
                        audit.logUserActivity(userBean.getUsername(), rc.getRequest().getRemoteAddr(),
                                AuditActivity.AUTHENTICATION_FAILURE, "PortalFilter");                   
                    }
                    if (authUser != null)
                    {
                        // validate request parameers, if valid update user preferences
                        String question1 = actionRequest.getParameter("question1");
                        String question2 = actionRequest.getParameter("question2");
                        String question3 = actionRequest.getParameter("question3");
                        String answer1 = actionRequest.getParameter("answer1");
                        String answer2 = actionRequest.getParameter("answer2");
                        String answer3 = actionRequest.getParameter("answer3");
                        String passPhrase = actionRequest.getParameter("passphrase");
                       
                        // validation (SecurityHelper.isEmpty, unique questions)
                        if (SecurityHelper.isEmpty(answer1) || SecurityHelper.isEmpty(answer2) || SecurityHelper.isEmpty(answer3))
                        {
                            StatusMessage msg = new StatusMessage("Please enter a valid answer for all 3 questions.", StatusMessage.ERROR);
                            PortletMessaging.publish(actionRequest, STATUS_MESSAGE, msg);
                            setView(actionRequest, phase, FAILURE1);                                                                   
                            return;
                        }
                        if (SecurityHelper.isEmpty(passPhrase))
                        {
                            StatusMessage msg = new StatusMessage("Please enter a valid pass phrase.", StatusMessage.ERROR);
                            PortletMessaging.publish(actionRequest, STATUS_MESSAGE, msg);
                            setView(actionRequest, phase, FAILURE1);                                                                   
                            return;
                        }
                        if (question1.equals(question2) || question1.equals(question3) || question2.equals(question3))
                        {
                            StatusMessage msg = new StatusMessage("Please select a unique question in all cases.", StatusMessage.ERROR);
                            PortletMessaging.publish(actionRequest, STATUS_MESSAGE, msg);
                            setView(actionRequest, phase, FAILURE1);                                                                   
                            return;                   
                        }
       
                        // update the prefs db (we are not logged in yet
                        user = userBean.getUser();
                        try
                        {
                            user.getSecurityAttributes().getAttribute("user.question.1", true).setStringValue(question1);
                            user.getSecurityAttributes().getAttribute("user.question.2", true).setStringValue(question2);
                            user.getSecurityAttributes().getAttribute("user.question.3", true).setStringValue(question3);
                            user.getSecurityAttributes().getAttribute("user.answer.1", true).setStringValue(answer1);
                            user.getSecurityAttributes().getAttribute("user.answer.2", true).setStringValue(answer2);
                            user.getSecurityAttributes().getAttribute("user.answer.3", true).setStringValue(answer3);
                            user.getSecurityAttributes().getAttribute("user.passphrase", true).setStringValue(passPhrase);
                            user.getSecurityAttributes().getAttribute("user.cookie", true).setStringValue(CaptchaImageResource.randomString(8, 16));
                            userManager.updateUser(user);
                            success = true;
                        }
                        catch (SecurityException e)
                        {
                            success = false;
                            RequestContext rc = SecurityHelper.getRequestContext(actionRequest);
                            audit.logUserActivity(userBean.getUsername(), rc.getRequest().getRemoteAddr(), AuditActivity.AUTHENTICATION_FAILURE, "Exception updating attributes" );
                            setView(actionRequest, phase, FAILURE2);                                               
                        }
                        if (success)
                        {
                            String username = userBean.getUsername();
                            String redirect = actionRequest.getParameter("redirect");
                            RequestContext rc = SecurityHelper.getRequestContext(actionRequest);
                            audit.logUserActivity(username, rc.getRequest().getRemoteAddr(),
                                    LOGIN_ENROLL_ACTIVITY, "enrolling user with questions and passphrase");
                            redirect(actionRequest, actionResponse, redirect, username, password);
                        }
                    }
                }
                if (success == false)
                {
                    RequestContext rc = SecurityHelper.getRequestContext(actionRequest);
                    audit.logUserActivity(userBean.getUsername(), rc.getRequest().getRemoteAddr(), AuditActivity.AUTHENTICATION_FAILURE, "Unauthorized Attribute Modification Attempt.");
                    setView(actionRequest, phase, FAILURE2);                   
                }
            }
            else if (phase.equals("enroll-login"))
            {               
                String username = userBean.getUsername();
                String password = actionRequest.getParameter(LoginConstants.PASSWORD);
                if (SecurityHelper.isEmpty(password))
                {
                    RequestContext rc = SecurityHelper.getRequestContext(actionRequest);
                    rc.setSessionAttribute(MFALogin.ERRORCODE, LoginConstants.ERROR_INVALID_PASSWORD);                   
                    setView(actionRequest, phase, FAILURE1);
                    return;
                }               
                // are we in the enrollment phase?
                if (SecurityHelper.isEmpty(userBean.getPassPhrase()))
                {
                    AuthenticatedUser authUser = null;
                    boolean authenticated = false;
                    try
                    {
                        authUser = authorization.authenticate(username, password);
                        authenticated = true;
                    }
                    catch (SecurityException e)
                    {}
                    if (authenticated)
                    {
                        userBean.setPassword(password);
                        setView(actionRequest, phase, SUCCESS1);
                        clearLoginMessages(actionRequest);
                    }
                    else
                    {
                        failedLoginProcessing(actionRequest, phase, username, userBean);                       
                    }                   
                }
            }
            else if (phase.equals("three"))
            {
                String redirect = actionRequest.getParameter("redirect");

                String username = userBean.getUsername();
                String password = actionRequest.getParameter(LoginConstants.PASSWORD);
                if (SecurityHelper.isEmpty(password) || SecurityHelper.isEmpty(redirect))
                {
                    RequestContext rc = SecurityHelper.getRequestContext(actionRequest);                   
                    rc.setSessionAttribute(MFALogin.ERRORCODE, LoginConstants.ERROR_INVALID_PASSWORD);                                       
                    setView(actionRequest, phase, FAILURE1);
                    return;
                }               
                // process authentication
                AuthenticatedUser authUser = null;
                boolean authenticated = false;
                try
                {
                    authUser = authorization.authenticate(username, password);
                    authenticated = true;
View Full Code Here

Examples of org.restlet.ext.oauth.AuthenticatedUser

    public boolean containsUser(String userId) {
        return users.contains(new AuthenticatedUserImpl(userId, this));
    }

    public AuthenticatedUser createUser(String id) {
        AuthenticatedUser user = new AuthenticatedUserImpl(id, this);
        users.add(user);
        return user;
    }
View Full Code Here

Examples of org.restlet.ext.oauth.AuthenticatedUser

            for (String s : scopes)
                ref.addQueryParameter("scope", s);
        }

        // Granted
        AuthenticatedUser user = client.findUser(session.getScopeOwner());

        if (user != null) { // null before first code generated
            // scopes = OAuthUtils.roluser.getGrantedScopes();
            List<Role> roles = user.getGrantedRoles();
            if (roles != null && roles.size() > 0) {
                for (Role r : roles)
                    ref.addQueryParameter("grantedScope", Scopes.toScope(r));
            }
        }
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.