Package org.postgresql.core
Enum AuthMethod
- java.lang.Object
-
- java.lang.Enum<AuthMethod>
-
- org.postgresql.core.AuthMethod
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<AuthMethod>
public enum AuthMethod extends java.lang.Enum<AuthMethod>
Enumeration of PostgreSQL authentication methods.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckAuth(java.util.EnumSet<AuthMethod> allowedMethods, AuthMethod authMethod)Refuses an authentication method thatrequireAuthdoes not allow.static AuthMethodfromString(java.lang.String method)static java.util.EnumSet<AuthMethod>parseRequireAuth(java.lang.String requireAuth)Parses arequireAuthvalue into the authentication methods the server may request.static AuthMethodvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static AuthMethod[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NONE
public static final AuthMethod NONE
-
PASSWORD
public static final AuthMethod PASSWORD
-
MD5
public static final AuthMethod MD5
-
GSS
public static final AuthMethod GSS
-
SSPI
public static final AuthMethod SSPI
-
SCRAM_SHA_256
public static final AuthMethod SCRAM_SHA_256
-
-
Method Detail
-
values
public static AuthMethod[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (AuthMethod c : AuthMethod.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static AuthMethod valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
fromString
public static AuthMethod fromString(java.lang.String method) throws PSQLException
- Throws:
PSQLException
-
parseRequireAuth
public static java.util.EnumSet<AuthMethod> parseRequireAuth(java.lang.String requireAuth) throws PSQLException
Parses arequireAuthvalue into the authentication methods the server may request.- Parameters:
requireAuth- comma-separated method names, either all plain or all prefixed with!- Returns:
nullwhenrequireAuthisnull, andcheckAuth(java.util.EnumSet<org.postgresql.core.AuthMethod>, org.postgresql.core.AuthMethod)allows every method fornull; otherwise the allowed methods, empty when the value excludes every method- Throws:
PSQLException- withPSQLState.INVALID_PARAMETER_VALUEif the value mixes the two forms, names a method twice, names an unknown method, or is written without a method
-
checkAuth
public static void checkAuth(java.util.EnumSet<AuthMethod> allowedMethods, AuthMethod authMethod) throws PSQLException
Refuses an authentication method thatrequireAuthdoes not allow.- Parameters:
allowedMethods- the methods to allow, ornullto allow every method; an empty set refuses every methodauthMethod- the method the server asked for- Throws:
PSQLException- withPSQLState.CONNECTION_REJECTEDif the method is not allowed
-
-