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

public final Class NativeAuthenticationServiceImpl

extends AuthenticationServiceBase
implements UserAuthenticator
Class Inheritance
All Implemented Interfaces
org.apache.derby.authentication.UserAuthenticator
Imports
java.util.Properties, .Arrays, java.security.MessageDigest, .NoSuchAlgorithmException, java.sql.Connection, .SQLException, .SQLWarning, javax.sql.DataSource, org.apache.derby.catalog.SystemProcedures, org.apache.derby.iapi.db.Database, org.apache.derby.shared.common.reference.Property, .Attribute, .SQLState, org.apache.derby.shared.common.info.JVMInfo, org.apache.derby.iapi.sql.dictionary.DataDictionary, .PasswordHasher, .UserDescriptor, org.apache.derby.authentication.UserAuthenticator, org.apache.derby.shared.common.error.SQLWarningFactory, .StandardException, org.apache.derby.iapi.services.monitor.ModuleFactory, .Monitor, org.apache.derby.iapi.services.property.PropertyUtil, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.store.access.TransactionController, org.apache.derby.iapi.util.IdUtil, .StringUtil, org.apache.derby.impl.jdbc.Util, org.apache.derby.iapi.jdbc.InternalDriver

This authentication service supports Derby NATIVE authentication.

To activate this service, set the derby.authentication.provider database or system property to a value beginning with the token "NATIVE:".

This service instantiates and calls the basic User authentication scheme at runtime.

User credentials are defined in the SYSUSERS table.

Field Summary

Modifier and TypeField and Description
private boolean
private String
private boolean
private String
private double
private long
Inherited from org.apache.derby.impl.jdbc.authentication.AuthenticationServiceBase:
authenticationSchemeAuthenticationTraceSECMEC_USRSSBPWD

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private boolean
authenticateLocally(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
)

Authenticate the passed-in credentials against the local database.

private boolean
authenticateRemotely(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
)

Authenticate the passed-in credentials against another Derby database.

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.

private boolean
authenticatingInThisDatabase(String userVisibleDatabaseName)

Return true if we are authenticating in this database.

private boolean
authenticatingInThisService(String canonicalDatabaseName)

Return true if we are authenticating in this service.

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
getCanonicalServiceName()

Get the canonical name of the current database service

private String
getCanonicalServiceName(String rawName)

Turn a service name into its normalized, standard form

private static ModuleFactory
getMonitor()

Must be private so that user code can't call this entry point.

private static String
getServiceName(final Object serviceModule)

Hides org.apache.derby.impl.jdbc.authentication.AuthenticationServiceBase.getServiceName.

Must be private so that user code can't call this entry point.

public String
private boolean
isCredentialsService(String canonicalDatabaseName)

Return true if the passed in service is the credentials database.

private void
parseNativeSpecification(Properties properties)

Parse the specification of NATIVE authentication.

private boolean
validAuthenticationProvider()

Return true if AUTHENTICATION_PROVIDER_PARAMETER was well formatted.

private StandardException
Inherited from org.apache.derby.impl.jdbc.authentication.AuthenticationServiceBase:
applyauthenticategetDatabasePropertiesgetDatabasePropertygetPropertygetServiceModulegetServiceNamegetSystemPropertygetTransactionhashPasswordSHA1SchemehashUsingDefaultAlgorithminitmapparsePasswordLifetimeparsePasswordThresholdrequireAuthenticationsetAuthenticationServicestopsubstitutePasswordvalidate

Field Detail

_authenticateDatabaseOperationsLocallyback to summary
private boolean _authenticateDatabaseOperationsLocally
_badlyFormattedPasswordPropertyback to summary
private String _badlyFormattedPasswordProperty
_creatingCredentialsDBback to summary
private boolean _creatingCredentialsDB
_credentialsDBback to summary
private String _credentialsDB
_passwordExpirationThresholdback to summary
private double _passwordExpirationThreshold
_passwordLifetimeMillisback to summary
private long _passwordLifetimeMillis

Constructor Detail

NativeAuthenticationServiceImplback to summary
public NativeAuthenticationServiceImpl()

Method Detail

authenticateLocallyback to summary
private boolean authenticateLocally(String userName, String userPassword, String databaseName) throws StandardException, SQLException

Authenticate the passed-in credentials against the local database.

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.

authenticateRemotelyback to summary
private boolean authenticateRemotely(String userName, String userPassword, String databaseName) throws StandardException, SQLWarning

Authenticate the passed-in credentials against another Derby database. This is done by getting a connection to the credentials database using the supplied username and password. If the connection attempts succeeds, then authentication succeeds.

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.

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.

authenticatingInThisDatabaseback to summary
private boolean authenticatingInThisDatabase(String userVisibleDatabaseName) throws StandardException

Return true if we are authenticating in this database.

authenticatingInThisServiceback to summary
private boolean authenticatingInThisService(String canonicalDatabaseName) throws StandardException

Return true if we are authenticating in this service.

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.

getCanonicalServiceNameback to summary
private String getCanonicalServiceName() throws StandardException

Get the canonical name of the current database service

getCanonicalServiceNameback to summary
private String getCanonicalServiceName(String rawName) throws StandardException

Turn a service name into its normalized, standard form

getMonitorback to summary
private static ModuleFactory getMonitor()

Must be private so that user code can't call this entry point.

getServiceNameback to summary
private static String getServiceName(final Object serviceModule)

Hides org.apache.derby.impl.jdbc.authentication.AuthenticationServiceBase.getServiceName.

Must be private so that user code can't call this entry point.

getSystemCredentialsDatabaseNameback to summary
public String getSystemCredentialsDatabaseName()

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

Implements org.apache.derby.iapi.jdbc.AuthenticationService.getSystemCredentialsDatabaseName.

Override behavior in superclass

Returns:String

Doc from org.apache.derby.iapi.jdbc.AuthenticationService.getSystemCredentialsDatabaseName.

the name of the system-wide credentials database

isCredentialsServiceback to summary
private boolean isCredentialsService(String canonicalDatabaseName) throws StandardException

Return true if the passed in service is the credentials database.

parseNativeSpecificationback to summary
private void parseNativeSpecification(Properties properties)

Parse the specification of NATIVE authentication. It can take 3 forms:

  • NATIVE:$credentialsDB - Here $credentialsDB is the name of a Derby database. This means that all authentication should take place in $credentialsDB.
  • NATIVE:$credentialsDB:LOCAL- This means that system-wide operations (like engine shutdown) are authenticated in $credentialsDB but connections to existing databases are authenticated in those databases.
  • NATIVE::LOCAL - This means that connections to a given database are authenticated in that database.
validAuthenticationProviderback to summary
private boolean validAuthenticationProvider() throws StandardException

Return true if AUTHENTICATION_PROVIDER_PARAMETER was well formatted. The property must have designated some database as the authentication authority.

wrapback to summary
private StandardException wrap(Throwable t)