Top Description Fields Constructors Methods
org.apache.derby.impl.jdbc.authentication

public final Class BasicAuthenticationServiceImpl

extends AuthenticationServiceBase
implements UserAuthenticator
Class Inheritance
All Implemented Interfaces
org.apache.derby.authentication.UserAuthenticator
Imports
org.apache.derby.iapi.sql.dictionary.PasswordHasher, org.apache.derby.shared.common.reference.Attribute, .SQLState, org.apache.derby.authentication.UserAuthenticator, org.apache.derby.iapi.services.property.PropertyUtil, org.apache.derby.iapi.services.monitor.Monitor, org.apache.derby.iapi.store.access.TransactionController, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.util.StringUtil, org.apache.derby.impl.jdbc.Util, java.util.Properties, java.security.MessageDigest, .NoSuchAlgorithmException, java.sql.SQLException

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

Inherited from org.apache.derby.impl.jdbc.authentication.AuthenticationServiceBase:
authenticationSchemeAuthenticationTraceSECMEC_USRSSBPWD

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
authenticateUser(String
The user's name used to connect to JBMS system
userName
,
String
The user's password used to connect to JBMS system
userPassword
,
String
The database which the user wants to connect to.
databaseName
,
Properties
Additional jdbc connection info.
info
)

Implements org.apache.derby.authentication.UserAuthenticator.authenticateUser.

Authenticate the passed-in user's credentials.

public void
boot(boolean
True if the database should be created
create
,
Properties
Configuration properties
properties
)

Overrides org.apache.derby.impl.jdbc.authentication.AuthenticationServiceBase.boot.

Implements org.apache.derby.iapi.services.monitor.ModuleControl.boot.

Start this module.

public boolean
canSupport(Properties properties)

Implements org.apache.derby.iapi.services.monitor.ModuleSupportable.canSupport.

Check if we should activate this authentication service.

private String

Returns:

a digest of the password created the same way as the stored password
hashPasswordUsingStoredAlgorithm
(String
the user whose password to hash
user
,
String
the plaintext password
password
,
String
the password token that's stored in the database
storedPassword
)

Hash a password using the same algorithm as we used to generate the stored password token.

Inherited from org.apache.derby.impl.jdbc.authentication.AuthenticationServiceBase:
applyauthenticategetDatabasePropertiesgetDatabasePropertygetPropertygetServiceModulegetServiceNamegetSystemCredentialsDatabaseNamegetSystemPropertygetTransactionhashPasswordSHA1SchemehashUsingDefaultAlgorithminitmapparsePasswordLifetimeparsePasswordThresholdrequireAuthenticationsetAuthenticationServicestopsubstitutePasswordvalidate

Constructor Detail

BasicAuthenticationServiceImplback to summary
public BasicAuthenticationServiceImpl()

Method Detail

authenticateUserback to summary
public boolean authenticateUser(String userName, String userPassword, String databaseName, Properties info) throws SQLException

Implements org.apache.derby.authentication.UserAuthenticator.authenticateUser.

Authenticate the passed-in user's credentials.

Parameters
userName:String

The user's name used to connect to JBMS system

userPassword:String

The user's password used to connect to JBMS system

databaseName:String

The database which the user wants to connect to.

info:Properties

Additional jdbc connection info.

Returns:boolean

Doc from org.apache.derby.authentication.UserAuthenticator.authenticateUser.

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.

Exceptions
SQLException:

Doc from org.apache.derby.authentication.UserAuthenticator.authenticateUser.

An exception processing the request, connection request will be denied. The SQL exception will be returned to the connection attempt.

bootback to summary
public void boot(boolean create, Properties properties) throws StandardException

Overrides org.apache.derby.impl.jdbc.authentication.AuthenticationServiceBase.boot.

Implements org.apache.derby.iapi.services.monitor.ModuleControl.boot.

Doc from org.apache.derby.impl.jdbc.authentication.AuthenticationServiceBase.boot.

Start this module. In this case, nothing needs to be done.

Parameters
create:boolean

Doc from org.apache.derby.iapi.services.monitor.ModuleControl.boot.

True if the database should be created

properties:Properties

Doc from org.apache.derby.iapi.services.monitor.ModuleControl.boot.

Configuration properties

Exceptions
StandardException:
upon failure to load/boot the expected authentication service.
See Also
org.apache.derby.iapi.services.monitor.ModuleControl#boot
canSupportback to summary
public boolean canSupport(Properties properties)

Implements org.apache.derby.iapi.services.monitor.ModuleSupportable.canSupport.

Check if we should activate this authentication service.

Returns:boolean

Doc from org.apache.derby.iapi.services.monitor.ModuleSupportable.canSupport.

true if this instance can be used, false otherwise.

hashPasswordUsingStoredAlgorithmback to summary
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:String

the user whose password to hash

password:String

the plaintext password

storedPassword:String

the password token that's stored in the database

Returns:String

a digest of the password created the same way as the stored password

Exceptions
StandardException:
if the password cannot be hashed with the requested algorithm