org.hsqldb.auth
Class AuthBeanMultiplexer
- java.lang.Object
-
- org.hsqldb.auth.AuthBeanMultiplexer
-
public class AuthBeanMultiplexer extends java.lang.ObjectThis class provides a method which can be used directly as a HyperSQL static Java function method. Manages a set of AuthFunctionBean implementations- Since:
- 2.0.1
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static java.sql.Arrayauthenticate(java.lang.String database, java.lang.String user, java.lang.String password)HyperSQL Java Function Method.voidclear()Clear the set of AuthFunctionBeansstatic AuthBeanMultiplexergetSingleton()voidsetAuthFunctionBean(java.sql.Connection c, AuthFunctionBean authFunctionBean)Exactly the same as setAuthFunctionBeans(String, List) other than taking an open Connection to identify the database.voidsetAuthFunctionBean(java.lang.String dbName, AuthFunctionBean authFunctionBean)This is not an "adder" function, but a "setter" function for the specified dbName , so do not use this to add to a database's FunctionBeans, but to assign ths single given AuthFunctionBean as the specified database's authenticator.voidsetAuthFunctionBeans(java.sql.Connection c, java.util.List<AuthFunctionBean> authFunctionBeans)Wrapper for setAuthFunctioNBeans(String, List) voidsetAuthFunctionBeans(java.util.Map<java.lang.String,java.util.List<AuthFunctionBean>> authFunctionBeanMap)Primary purpose of this class is to manage this static map.voidsetAuthFunctionBeans(java.lang.String dbName, java.util.List<AuthFunctionBean> authFunctionBeans)This is not an "adder" function, but a "setter" function for the specified dbName , so do not use this to add to a database's FunctionBeans, but to assign the entire list for that database.
-
-
-
Method Detail
-
getSingleton
public static AuthBeanMultiplexer getSingleton()
-
clear
public void clear()
Clear the set of AuthFunctionBeans
-
setAuthFunctionBeans
public void setAuthFunctionBeans(java.util.Map<java.lang.String,java.util.List<AuthFunctionBean>> authFunctionBeanMap)
Primary purpose of this class is to manage this static map. From dbNames to ordered-lists-of-AuthFunctionBeans. This is not an "adder" function, but a "setter" function, so do not use this to add to a partial set, but to assign the entire set.The given entries are copied, to limit side-effects and concurrency issues.
-
setAuthFunctionBeans
public void setAuthFunctionBeans(java.sql.Connection c, java.util.List<AuthFunctionBean> authFunctionBeans) throws java.sql.SQLExceptionWrapper for setAuthFunctioNBeans(String, List) - Parameters:
c- An open Connection to the desired database.- Throws:
java.sql.SQLException- if failed to obtain unique name from given Connection.
-
setAuthFunctionBeans
public void setAuthFunctionBeans(java.lang.String dbName, java.util.List<AuthFunctionBean> authFunctionBeans)This is not an "adder" function, but a "setter" function for the specified dbName , so do not use this to add to a database's FunctionBeans, but to assign the entire list for that database.The given entries are copied, to limit side-effects and concurrency issues.
Use this method instead of setAuthFunctionBean(String, AuthFunctionBean) in order to set up multiple authenticators for a single database for redundancy purposes.
-
setAuthFunctionBean
public void setAuthFunctionBean(java.sql.Connection c, AuthFunctionBean authFunctionBean) throws java.sql.SQLExceptionExactly the same as setAuthFunctionBeans(String, List) other than taking an open Connection to identify the database.- Throws:
java.sql.SQLException
-
setAuthFunctionBean
public void setAuthFunctionBean(java.lang.String dbName, AuthFunctionBean authFunctionBean)This is not an "adder" function, but a "setter" function for the specified dbName , so do not use this to add to a database's FunctionBeans, but to assign ths single given AuthFunctionBean as the specified database's authenticator.To set up multiple authenticators for a single database for redundancy purposes, use the method setAuthFunctionBeans(String, List) instead.
- See Also:
setAuthFunctionBeans(String, List)
-
authenticate
public static java.sql.Array authenticate(java.lang.String database, java.lang.String user, java.lang.String password) throws java.lang.ExceptionHyperSQL Java Function Method.Registered AuthFunctionBeans matching the specified database and password will be tried in order.
- If the AuthFunctionBean being tried throws a non-runtime Exception, then that RuntimeException is passed through (re-thrown), resulting in a SQLException for the authenticating application.
- If the AuthFunctionBean being tried doesn't throw anything, then the return value is passed through (returned) and HyperSQL will allow access and set roles according to HyperSQL's authentication function contract.
- If the AuthFunctionBean being tried throws a RuntimeException, then the next AuthFunctionBean in turn will be tried. If all matching AuthFunctionBeans throw RuntimeExceptions, then the first RuntimeException that was thrown will be passed through (re-thrown), resulting in a SQLException for the authenticating application.
- If there are no AuthFunctionBeans registered for the specified dbName, then this method will throw an IllegalArgumentException, resulting in a SQLException for the authenticating application.
- Returns:
- Null or java.sql.Array to indicate successful authentication according to the contract for HyperSQL authentication functions.
- Throws:
java.lang.IllegalArgumentException- if no AuthFunctionBean has been set for specified dbName.java.lang.RuntimeException- if all matching AuthFunctionBeans threw RuntimeExceptions. (This indicates that no matching AuthFunctionBean functioned properly, not that authentication was purposefully denied by any AuthFunctionBean).java.lang.Exception- (non-runtime). A matching AuthFunctionBean threw this Exception.- See Also:
User Guide, System Management chapter, Authentication Settings subsection.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG