Package org.apache.cassandra.auth
Class PasswordAuthenticator
java.lang.Object
org.apache.cassandra.auth.PasswordAuthenticator
- All Implemented Interfaces:
AuthCache.BulkLoader<String,,String> IAuthenticator
- Direct Known Subclasses:
MutualTlsWithPasswordFallbackAuthenticator
public class PasswordAuthenticator
extends Object
implements IAuthenticator, AuthCache.BulkLoader<String,String>
PasswordAuthenticator is an IAuthenticator implementation
that keeps credentials (rolenames and bcrypt-hashed passwords)
internally in C* - in system_auth.roles CQL3 table.
Since 2.2, the management of roles (creation, modification,
querying etc is the responsibility of IRoleManager. Use of
PasswordAuthenticator requires the use of CassandraRoleManager
for storage and retrieval of encrypted passwords.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interfaceNested classes/interfaces inherited from interface org.apache.cassandra.auth.IAuthenticator
IAuthenticator.SaslNegotiator -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static booleanlegacyAuthenticate(Map<String, String> credentials) A legacy method that is still used by JMX authentication.newSaslNegotiator(InetAddress clientAddress) Provide a SASL handler to perform authentication for an single connection.Set of resources that should be made inaccessible to users and only accessible internally.booleanWhether or not the authenticator requires explicit login.voidsetup()Setup is called once upon system startup to initialize the IAuthenticator.voidValidates configuration of IAuthenticator implementation (if configurable).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cassandra.auth.IAuthenticator
getAuthenticateMessage, newSaslNegotiator
-
Field Details
-
USERNAME_KEY
- See Also:
-
PASSWORD_KEY
- See Also:
-
-
Constructor Details
-
PasswordAuthenticator
public PasswordAuthenticator()
-
-
Method Details
-
requireAuthentication
public boolean requireAuthentication()Description copied from interface:IAuthenticatorWhether or not the authenticator requires explicit login. If false will instantiate user with AuthenticatedUser.ANONYMOUS_USER.- Specified by:
requireAuthenticationin interfaceIAuthenticator
-
bulkLoader
- Specified by:
bulkLoaderin interfaceAuthCache.BulkLoader<String,String>
-
getCredentialsCache
-
checkpw
-
protectedResources
Description copied from interface:IAuthenticatorSet of resources that should be made inaccessible to users and only accessible internally.- Specified by:
protectedResourcesin interfaceIAuthenticator- Returns:
- Keyspaces, column families that will be unmodifiable by users; other resources.
-
validateConfiguration
Description copied from interface:IAuthenticatorValidates configuration of IAuthenticator implementation (if configurable).- Specified by:
validateConfigurationin interfaceIAuthenticator- Throws:
ConfigurationException- when there is a configuration error.
-
setup
public void setup()Description copied from interface:IAuthenticatorSetup is called once upon system startup to initialize the IAuthenticator. For example, use this method to create any required keyspaces/column families.- Specified by:
setupin interfaceIAuthenticator
-
legacyAuthenticate
public AuthenticatedUser legacyAuthenticate(Map<String, String> credentials) throws AuthenticationExceptionDescription copied from interface:IAuthenticatorA legacy method that is still used by JMX authentication. You should implement this for having JMX authentication through your authenticator. Should never return null - always throw AuthenticationException instead. Returning AuthenticatedUser.ANONYMOUS_USER is an option as well if authentication is not required.- Specified by:
legacyAuthenticatein interfaceIAuthenticator- Parameters:
credentials- implementation specific key/value pairs- Returns:
- non-null representation of the authenticated subject
- Throws:
AuthenticationException
-
newSaslNegotiator
Description copied from interface:IAuthenticatorProvide a SASL handler to perform authentication for an single connection. SASL is a stateful protocol, so a new instance must be used for each authentication attempt.- Specified by:
newSaslNegotiatorin interfaceIAuthenticator- Parameters:
clientAddress- the IP address of the client whom we wish to authenticate, or null if an internal client (one not connected over the remote transport).- Returns:
- org.apache.cassandra.auth.IAuthenticator.SaslNegotiator implementation
(see
PasswordAuthenticator.PlainTextSaslAuthenticator)
-