Package org.apache.cassandra.auth

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


    /**
     * 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;
    }
View Full Code Here

    }

    public void checkAccess(ClientState state) throws UnauthorizedException
    {
        state.validateLogin();
        AuthenticatedUser user = state.getUser();

        if (superuser != null && user.getName().equals(username))
            throw new UnauthorizedException("You aren't allowed to alter your own superuser status");

        if (superuser != null && !user.isSuper())
            throw new UnauthorizedException("Only superusers are allowed to alter superuser status");

        if (!user.isSuper() && !user.getName().equals(username))
            throw new UnauthorizedException("You aren't allowed to alter this user");

        if (!user.isSuper())
        {
            for (IAuthenticator.Option option : opts.getOptions().keySet())
            {
                if (!DatabaseDescriptor.getAuthenticator().alterableOptions().contains(option))
                    throw new UnauthorizedException(String.format("You aren't allowed to alter %s option", option));
View Full Code Here

    public void validate(ClientState state) throws InvalidRequestException
    {
        if (!Auth.isExistingUser(username))
            throw new InvalidRequestException(String.format("User %s doesn't exists", 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

    /**
     * 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;
    }
View Full Code Here

    /**
     * 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;
    }
View Full Code Here

    /**
     * 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;
    }
View Full Code Here

    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

        clientState = ClientState.forInternalCalls();
        try {
            if (!Auth.isExistingUser(user.getName()))
                Auth.insertUser(user.getName(), user.isAdmin());
            clientState.login(new AuthenticatedUser(user.getName()));
        } catch (Exception e) {
            throw DbException.convert(e);
        }
    }
View Full Code Here

    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

TOP

Related Classes of org.apache.cassandra.auth.AuthenticatedUser

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.