public interface Authenticator
An authenticator.
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<Authenticator> Returns the client type for which to use this authenticator.default voidclose()Disposes of all resources used by this authenticator, after a call to this method the authenticator should be regarded as unusable.login(RemoteSession session) Performs login validation for the user specified by the remote session and returns a remote session with the same connectionId and user but possibly a different databaseUser to propagate to further login procedures.default voidlogout(RemoteSession session) Called after the given session has been disconnected
-
Method Details
-
clientType
Returns the client type for which to use this authenticator. If none is specified, this authenticator is shared between all client types.- Returns:
- the String identifying the client type for which to use this authenticator or an empty optional in case this authenticator should be shared
-
login
Performs login validation for the user specified by the remote session and returns a remote session with the same connectionId and user but possibly a different databaseUser to propagate to further login procedures.
Called once per session, that is, once per connection: a client holding more than one connection logs in once for each and is logged out once for each, so an authenticator keeping state per user, a licence seat say, should expect several sessions per user.
The returned session must be for the same connection as the one received, the server rejecting the login otherwise;
RemoteSession.withDatabaseUser(User)guarantees that.- Parameters:
session- the session- Returns:
- a new session with the same connectionId but not necessarily the same databaseUser
- Throws:
LoginException- in case the login fails- See Also:
-
logout
Called after the given session has been disconnected- Parameters:
session- the remote session
-
close
default void close()Disposes of all resources used by this authenticator, after a call to this method the authenticator should be regarded as unusable. This method should be called by a server using this authenticator on shutdown, giving the authenticator a chance to release resources in an orderly manner. Any exception thrown by this method is logged and ignored. -
authenticators
- Returns:
- a list containing all the authenticators registered with
ServiceLoader.
-