| 1 |
/* |
| 2 |
* Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, |
| 3 |
* and the EPL 1.0 (https://h2database.com/html/license.html). |
| 4 |
* Initial Developer: Alessandro Ventura |
| 5 |
*/ |
| 6 |
package org.h2.security.auth; |
| 7 |
|
| 8 |
import org.h2.engine.Database; |
| 9 |
import org.h2.engine.User; |
| 10 |
|
| 11 |
/** |
| 12 |
* Low level interface to implement full authentication process. |
| 13 |
*/ |
| 14 |
public interface Authenticator { |
| 15 |
|
| 16 |
/** |
| 17 |
* Perform user authentication. |
| 18 |
* |
| 19 |
* @param authenticationInfo authentication info. |
| 20 |
* @param database target database instance. |
| 21 |
* @return valid database user or null if user doesn't exists in the |
| 22 |
* database |
| 23 |
* @throws AuthenticationException on failure |
| 24 |
*/ |
| 25 |
User authenticate(AuthenticationInfo authenticationInfo, Database database) throws AuthenticationException; |
| 26 |
|
| 27 |
/** |
| 28 |
* Initialize the authenticator. This method is invoked by databases when |
| 29 |
* the authenticator is set when the authenticator is set. |
| 30 |
* |
| 31 |
* @param database target database |
| 32 |
*/ |
| 33 |
void init(Database database) throws AuthConfigException; |
| 34 |
} |