Class BasicAuthenticationServiceImpl
java.lang.Object
org.apache.derby.impl.jdbc.authentication.AuthenticationServiceBase
org.apache.derby.impl.jdbc.authentication.BasicAuthenticationServiceImpl
- All Implemented Interfaces:
UserAuthenticator, AuthenticationService, ModuleControl, ModuleSupportable, PropertySetCallback
public final class BasicAuthenticationServiceImpl
extends AuthenticationServiceBase
implements UserAuthenticator
This authentication service is the basic Derby user authentication
level support.
It is activated upon setting derby.authentication.provider database
or system property to 'BUILTIN'.
It instantiates and calls the basic User authentication scheme at runtime.
In 2.0, users can now be defined as database properties. If derby.database.propertiesOnly is set to true, then in this case, only users defined as database properties for the current database will be considered.
-
Field Summary
Fields inherited from class AuthenticationServiceBase
authenticationScheme, AuthenticationTrace, SECMEC_USRSSBPWDFields inherited from interface AuthenticationService
MODULE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanauthenticateUser(String userName, String userPassword, String databaseName, Properties info) Authenticate the passed-in user's credentials.voidboot(boolean create, Properties properties) Start this module.booleancanSupport(Properties properties) Check if we should activate this authentication service.private StringhashPasswordUsingStoredAlgorithm(String user, String password, String storedPassword) Hash a password using the same algorithm as we used to generate the stored password token.Methods inherited from class AuthenticationServiceBase
apply, authenticate, getDatabaseProperties, getDatabaseProperty, getProperty, getServiceModule, getServiceName, getSystemCredentialsDatabaseName, getSystemProperty, getTransaction, hashPasswordSHA1Scheme, hashUsingDefaultAlgorithm, init, map, parsePasswordLifetime, parsePasswordThreshold, requireAuthentication, setAuthenticationService, stop, substitutePassword, validate
-
Constructor Details
-
BasicAuthenticationServiceImpl
public BasicAuthenticationServiceImpl()
-
-
Method Details
-
canSupport
Check if we should activate this authentication service.- Specified by:
canSupportin interfaceModuleSupportable- Returns:
- true if this instance can be used, false otherwise.
-
boot
Description copied from class:AuthenticationServiceBaseStart this module. In this case, nothing needs to be done.- Specified by:
bootin interfaceModuleControl- Overrides:
bootin classAuthenticationServiceBase- Throws:
StandardException- upon failure to load/boot the expected authentication service.- See Also:
-
authenticateUser
public boolean authenticateUser(String userName, String userPassword, String databaseName, Properties info) throws SQLException Authenticate the passed-in user's credentials.- Specified by:
authenticateUserin interfaceUserAuthenticator- Parameters:
userName- The user's name used to connect to JBMS systemuserPassword- The user's password used to connect to JBMS systemdatabaseName- The database which the user wants to connect to.info- Additional jdbc connection info.- Returns:
- false if the connection request should be denied, true if the connection request should proceed. If false is returned the connection attempt will receive a SQLException with SQL State 08004.
- Throws:
SQLException- An exception processing the request, connection request will be denied. The SQL exception will be returned to the connection attempt.
-
hashPasswordUsingStoredAlgorithm
private String hashPasswordUsingStoredAlgorithm(String user, String password, String storedPassword) throws StandardException Hash a password using the same algorithm as we used to generate the stored password token.- Parameters:
user- the user whose password to hashpassword- the plaintext passwordstoredPassword- the password token that's stored in the database- Returns:
- a digest of the password created the same way as the stored password
- Throws:
StandardException- if the password cannot be hashed with the requested algorithm
-