当前位置: 首页>>代码示例>>Java>>正文


Java AuthenticationException类代码示例

本文整理汇总了Java中org.apache.cassandra.exceptions.AuthenticationException的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationException类的具体用法?Java AuthenticationException怎么用?Java AuthenticationException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AuthenticationException类属于org.apache.cassandra.exceptions包,在下文中一共展示了AuthenticationException类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.apache.cassandra.exceptions.AuthenticationException; //导入依赖的package包/类
@Override
public Response execute(QueryState queryState)
{
    try
    {
        SaslAuthenticator authenticator = ((ServerConnection) connection).getAuthenticator();
        byte[] challenge = authenticator.evaluateResponse(token == null ? new byte[0] : token);
        if (authenticator.isComplete())
        {
            AuthenticatedUser user = authenticator.getAuthenticatedUser();
            queryState.getClientState().login(user);
            // authentication is complete, send a ready message to the client
            return new AuthSuccess(challenge);
        }
        else
        {
            return new AuthChallenge(challenge);
        }
    }
    catch (AuthenticationException e)
    {
        return ErrorMessage.fromException(e);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:25,代码来源:AuthResponse.java

示例2: execute

import org.apache.cassandra.exceptions.AuthenticationException; //导入依赖的package包/类
@Override
public Response execute(QueryState queryState)
{
    try
    {
        IAuthenticator.SaslNegotiator negotiator = ((ServerConnection) connection).getSaslNegotiator(queryState);
        byte[] challenge = negotiator.evaluateResponse(token);
        if (negotiator.isComplete())
        {
            AuthenticatedUser user = negotiator.getAuthenticatedUser();
            queryState.getClientState().login(user);
            // authentication is complete, send a ready message to the client
            return new AuthSuccess(challenge);
        }
        else
        {
            return new AuthChallenge(challenge);
        }
    }
    catch (AuthenticationException e)
    {
        return ErrorMessage.fromException(e);
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:25,代码来源:AuthResponse.java

示例3: login

import org.apache.cassandra.exceptions.AuthenticationException; //导入依赖的package包/类
/**
 * Attempts to login the given user.
 */
public void login(AuthenticatedUser user) throws AuthenticationException
{
    if (!user.isAnonymous() && !Auth.isExistingUser(user.getName()))
       throw new AuthenticationException(String.format("User %s doesn't exist - create it with CREATE USER query first",
                                                       user.getName()));
    this.user = user;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:11,代码来源:ClientState.java

示例4: execute

import org.apache.cassandra.exceptions.AuthenticationException; //导入依赖的package包/类
public Message.Response execute(QueryState state)
{
    try
    {
        AuthenticatedUser user = DatabaseDescriptor.getAuthenticator().authenticate(credentials);
        state.getClientState().login(user);
        return new ReadyMessage();
    }
    catch (AuthenticationException e)
    {
        return ErrorMessage.fromException(e);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:14,代码来源:CredentialsMessage.java

示例5: login

import org.apache.cassandra.exceptions.AuthenticationException; //导入依赖的package包/类
/**
 * Attempts to login the given user.
 */
public void login(AuthenticatedUser user) throws AuthenticationException
{
    // Login privilege is not inherited via granted roles, so just
    // verify that the role with the credentials that were actually
    // supplied has it
    if (user.isAnonymous() || DatabaseDescriptor.getRoleManager().canLogin(user.getPrimaryRole()))
        this.user = user;
    else
        throw new AuthenticationException(String.format("%s is not permitted to log in", user.getName()));
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:14,代码来源:ClientState.java

示例6: execute

import org.apache.cassandra.exceptions.AuthenticationException; //导入依赖的package包/类
public Message.Response execute(QueryState state)
{
    try
    {
        AuthenticatedUser user = DatabaseDescriptor.getAuthenticator().legacyAuthenticate(credentials);
        state.getClientState().login(user);
    }
    catch (AuthenticationException e)
    {
        return ErrorMessage.fromException(e);
    }

    return new ReadyMessage();
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:15,代码来源:CredentialsMessage.java

示例7: login

import org.apache.cassandra.exceptions.AuthenticationException; //导入依赖的package包/类
/**
 * Attempts to login this client with the given credentials map.
 */
public void login(Map<String, String> credentials) throws AuthenticationException
{
    AuthenticatedUser user = DatabaseDescriptor.getAuthenticator().authenticate(credentials);

    if (!user.isAnonymous() && !Auth.isExistingUser(user.getName()))
       throw new AuthenticationException(String.format("User %s doesn't exist - create it with CREATE USER query first",
                                                       user.getName()));

    this.user = user;
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:14,代码来源:ClientState.java

示例8: execute

import org.apache.cassandra.exceptions.AuthenticationException; //导入依赖的package包/类
public Message.Response execute(QueryState state)
{
    try
    {
        state.getClientState().login(credentials);
        return new ReadyMessage();
    }
    catch (AuthenticationException e)
    {
        return ErrorMessage.fromException(e);
    }
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:13,代码来源:CredentialsMessage.java

示例9: login

import org.apache.cassandra.exceptions.AuthenticationException; //导入依赖的package包/类
/**
     * Attempts to login this client with the given credentials map.
     */
    public void login(Map<String, String> credentials) throws AuthenticationException
    {
        AuthenticatedUser user = DatabaseDescriptor.getAuthenticator().authenticate(credentials);
//wso2
        if (logger.isDebugEnabled())
            logger.debug("logged in: {}", user);
        this.user = user;
//wso2
        setQualifiedKeyspace();
    }
 
开发者ID:wso2,项目名称:wso2-cassandra,代码行数:14,代码来源:ClientState.java

示例10: authenticate

import org.apache.cassandra.exceptions.AuthenticationException; //导入依赖的package包/类
public AuthenticatedUser authenticate(Map<String, String> credentials) throws AuthenticationException
{
    return AuthenticatedUser.ANONYMOUS_USER;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:5,代码来源:AllowAllAuthenticator.java

示例11: evaluateResponse

import org.apache.cassandra.exceptions.AuthenticationException; //导入依赖的package包/类
public byte[] evaluateResponse(byte[] clientResponse) throws AuthenticationException
{
    return null;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:5,代码来源:AllowAllAuthenticator.java

示例12: getAuthenticatedUser

import org.apache.cassandra.exceptions.AuthenticationException; //导入依赖的package包/类
public AuthenticatedUser getAuthenticatedUser() throws AuthenticationException
{
    return AuthenticatedUser.ANONYMOUS_USER;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:5,代码来源:AllowAllAuthenticator.java

示例13: authenticate

import org.apache.cassandra.exceptions.AuthenticationException; //导入依赖的package包/类
/**
 * Authenticates a user given a Map<String, String> of credentials.
 * Should never return null - always throw AuthenticationException instead.
 * Returning AuthenticatedUser.ANONYMOUS_USER is an option as well if authentication is not required.
 *
 * @throws AuthenticationException if credentials don't match any known user.
 */
AuthenticatedUser authenticate(Map<String, String> credentials) throws AuthenticationException;
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:9,代码来源:IAuthenticator.java

示例14: authenticate

import org.apache.cassandra.exceptions.AuthenticationException; //导入依赖的package包/类
/**
 * @param credentials An implementation specific collection of identifying information.
 * @return A successfully authenticated user: should throw AuthenticationException rather than ever returning null.
 */
public abstract AuthenticatedUser authenticate(Map<String, String> credentials) throws AuthenticationException;
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:6,代码来源:LegacyAuthenticator.java


注:本文中的org.apache.cassandra.exceptions.AuthenticationException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。