Top Inners Fields Constructors Methods
org.postgresql.core.v3

pack-priv Class AuthenticationPluginManager

extends Object
Class Inheritance
Imports
org.postgresql.PGProperty, org.postgresql.plugin.AuthenticationPlugin, .AuthenticationRequestType, org.postgresql.util.GT, .ObjectFactory, .PSQLException, .PSQLState, org.checkerframework.checker.nullness.qual.Nullable, java.io.IOException, java.nio.ByteBuffer, .CharBuffer, java.nio.charset.StandardCharsets, java.util.Arrays, .Properties, java.util.logging.Level, .Logger

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <T> T
withEncodedPassword(AuthenticationRequestType
The authentication type that is being requested
type
,
Properties
The connection properties for the connection
info
,
AuthenticationPluginManager.PasswordAction<byte[], T>
The action to invoke with the encoded password
action
)

Helper that wraps withPassword(AuthenticationRequestType, Properties, PasswordAction), checks that it is not-null, and encodes it as a byte array.

public static <T> T
withPassword(AuthenticationRequestType
The authentication type that is being requested
type
,
Properties
The connection properties for the connection
info
,
AuthenticationPluginManager.PasswordAction<@Nullable char[], T>
The action to invoke with the password
action
)

If a password is requested by the server during connection initiation, this method will be invoked to supply the password.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGGERback to summary
private static final Logger LOGGER

Constructor Detail

AuthenticationPluginManagerback to summary
private AuthenticationPluginManager()

Method Detail

withEncodedPasswordback to summary
public static <T> T withEncodedPassword(AuthenticationRequestType type, Properties info, AuthenticationPluginManager.PasswordAction<byte[], T> action) throws PSQLException, IOException

Helper that wraps withPassword(AuthenticationRequestType, Properties, PasswordAction), checks that it is not-null, and encodes it as a byte array. Used by internal code paths that require an encoded password that may be an empty string, but not null.

The caller provides a callback method that will be invoked with the byte[] encoded password. After completion, for security reasons the byte[] array will be wiped by filling it with zeroes. Callers must not rely on being able to read the password byte[] after the callback has completed.

Parameters
type:AuthenticationRequestType

The authentication type that is being requested

info:Properties

The connection properties for the connection

action:AuthenticationPluginManager.PasswordAction<byte[], T>

The action to invoke with the encoded password

Exceptions
PSQLException:
Throws a PSQLException if the plugin class cannot be instantiated or if the retrieved password is null.
IOException:
Bubbles up any thrown IOException from the provided callback
withPasswordback to summary
public static <T> T withPassword(AuthenticationRequestType type, Properties info, AuthenticationPluginManager.PasswordAction<@Nullable char[], T> action) throws PSQLException, IOException

If a password is requested by the server during connection initiation, this method will be invoked to supply the password. This method will only be invoked if the server actually requests a password, e.g. trust authentication will skip it entirely.

The caller provides a action method that will be invoked with the char[] password. After completion, for security reasons the char[] array will be wiped by filling it with zeroes. Callers must not rely on being able to read the password char[] after the action has completed.

Parameters
type:AuthenticationRequestType

The authentication type that is being requested

info:Properties

The connection properties for the connection

action:AuthenticationPluginManager.PasswordAction<@Nullable char[], T>

The action to invoke with the password

Exceptions
PSQLException:
Throws a PSQLException if the plugin class cannot be instantiated
IOException:
Bubbles up any thrown IOException from the provided action
org.postgresql.core.v3 back to summary

public Interface AuthenticationPluginManager.PasswordAction<T, R>

Annotations
@FunctionalInterface

Method Summary

Modifier and TypeMethod and Description
public R
apply(T password)

Method Detail

applyback to summary
public R apply(T password) throws PSQLException, IOException