public class JaasAuthBean extends Object implements AuthFunctionBean
JAAS modules used must have both a NameCallback and a PasswordCallback. This is how we pass the JDBC-provided user name and password to the module.
JAAS setup is Java-implementation-specific.
For Sun Java, you set up a JAAS configuration file which resides at
$HOME/.java.login.config
or at the location that you set with
Java system property java.security.auth.login.config
.
You can use this bean to manage just access, or also to manage roles or initial schemas. To use for roles or initial schemas, you must set the roleSchemaValuePattern property to distinguish which of the JAAS-module-provided values to use. By default, all JAAS-module-provided Principles will be candidates. If you set property roleSchemaViaCredential to true, then all JAAS-module-provided public Credentials will be candidates instead.
AuthFunctionBean
,
NameCallback
,
PasswordCallback
Modifier and Type | Class and Description |
---|---|
static class |
JaasAuthBean.UPCallbackHandler |
Constructor and Description |
---|
JaasAuthBean() |
Modifier and Type | Method and Description |
---|---|
String[] |
authenticate(String userName,
String password)
Return a list of authorized roles or null to indicate that the
implementation does not intend to produce a specific role list but only
to indicate whether to allow access or not.
|
void |
init() |
void |
setApplicationKey(String applicationKey)
Set the key into the JAAS runtime configuration.
|
void |
setRoleSchemaValuePattern(Pattern roleSchemaValuePattern)
Assign a pattern to both detect honored values, and optionally
to map from a single principal name or public credential string
to a single HyperSQL role or schema string.
|
void |
setRoleSchemaValuePatternString(String patternString)
String wrapper for method setRoleSchemaValuePattern(Pattern)
Use the (x?) Pattern constructs to set options.
|
void |
setRoleSchemaViaCredential(boolean roleSchemaViaCredential)
By default, If roleSchemaValuePattern is set, then role and schema
values are obtained from principle values; otherwise existing account
privileges are used (if any).
|
public void setRoleSchemaViaCredential(boolean roleSchemaViaCredential)
Do not set roleSchemaViaCredential to true unless roleSchemaValuePattern is set.
public void init()
IllegalStateException
- if any required setting has not been set.public void setApplicationKey(String applicationKey)
public void setRoleSchemaValuePattern(Pattern roleSchemaValuePattern)
If every principal name or public credentials holds only the String values precisely as HyperSQL needs them, then set the pattern to ".+". For example, if the JAAS module returns principals (or credentials) with values "one", "two", "three", then if you set this pattern to ".+", HyperSQL will attempt to assign initial schema and roles for the values "one", "two", and "three".
These are two distinct and important purposes for the specified Pattern.
N.b. this Pattern will be used for the matches() operation, therefore it must match the entire candidate value strings (this is different than the find operation which does not need to satisfy the entire candidate value).
Example1 :
will extract the CN value from matching attribute values.
cn=([^,]+),ou=dbRole,dc=admc,dc=com
Example1 :
will return the entire
cn=[^,]+,ou=dbRole,dc=admc,dc=com
cn...com
string for matching
attribute values.
Matcher.matches()
public void setRoleSchemaValuePatternString(String patternString)
PatternSyntaxException
setRoleSchemaValuePattern(Pattern)
public String[] authenticate(String userName, String password) throws org.hsqldb.auth.DenyException
AuthFunctionBean
authenticate
in interface AuthFunctionBean
org.hsqldb.auth.DenyException
AuthFunctionBean.authenticate(String, String)
Copyright �� 2001 - 2013 HSQL Development Group.