本文整理汇总了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);
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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()));
}
示例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();
}
示例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;
}
示例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);
}
}
示例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();
}
示例10: authenticate
import org.apache.cassandra.exceptions.AuthenticationException; //导入依赖的package包/类
public AuthenticatedUser authenticate(Map<String, String> credentials) throws AuthenticationException
{
return AuthenticatedUser.ANONYMOUS_USER;
}
示例11: evaluateResponse
import org.apache.cassandra.exceptions.AuthenticationException; //导入依赖的package包/类
public byte[] evaluateResponse(byte[] clientResponse) throws AuthenticationException
{
return null;
}
示例12: getAuthenticatedUser
import org.apache.cassandra.exceptions.AuthenticationException; //导入依赖的package包/类
public AuthenticatedUser getAuthenticatedUser() throws AuthenticationException
{
return AuthenticatedUser.ANONYMOUS_USER;
}
示例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;
示例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;