Enum ScramAttributes
- java.lang.Object
-
- java.lang.Enum<ScramAttributes>
-
- com.impossibl.postgres.protocol.sasl.scram.ScramAttributes
-
- All Implemented Interfaces:
CharAttribute
,Serializable
,Comparable<ScramAttributes>
public enum ScramAttributes extends Enum<ScramAttributes> implements CharAttribute
SCRAM Attributes as defined in Section 5.1 of the RFC. Not all the available attributes may be available in this implementation.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description AUTHZID
This is an optional attribute, and is part of the GS2 [RFC5801] bridge between the GSS-API and SASL.CHANNEL_BINDING
This REQUIRED attribute specifies the base64-encoded GS2 header and channel binding data.CLIENT_PROOF
This attribute specifies a base64-encoded ClientProof.ERROR
This attribute specifies an error that occurred during authentication exchange.ITERATION
This attribute specifies an iteration count for the selected hash function and user.NONCE
This attribute specifies a sequence of random printable ASCII characters excluding ',' (which forms the nonce used as input to the hash function).SALT
This attribute specifies the base64-encoded salt used by the server for this user.SERVER_SIGNATURE
This attribute specifies a base64-encoded ServerSignature.USERNAME
This attribute specifies the name of the user whose password is used for authentication (a.k.a.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ScramAttributes
byChar(char c)
Find a SCRAMAttribute by its character.char
getChar()
Return the char used to represent this attributestatic ScramAttributes
valueOf(String name)
Returns the enum constant of this type with the specified name.static ScramAttributes[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
USERNAME
public static final ScramAttributes USERNAME
This attribute specifies the name of the user whose password is used for authentication (a.k.a. "authentication identity" [RFC4422]). If the "a" attribute is not specified (which would normally be the case), this username is also the identity that will be associated with the connection subsequent to authentication and authorization. The client SHOULD prepare the username using the "SASLprep" profile [RFC4013] of the "stringprep" algorithm [RFC3454] treating it as a query string (i.e., unassigned Unicode code points are allowed). The characters ',' or '=' in usernames are sent as '=2C' and '=3D' respectively.
-
AUTHZID
public static final ScramAttributes AUTHZID
This is an optional attribute, and is part of the GS2 [RFC5801] bridge between the GSS-API and SASL. This attribute specifies an authorization identity. A client may include it in its first message to the server if it wants to authenticate as one user, but subsequently act as a different user. This is typically used by an administrator to perform some management task on behalf of another user, or by a proxy in some situations. If this attribute is omitted (as it normally would be), the authorization identity is assumed to be derived from the username specified with the (required) "n" attribute. The server always authenticates the user specified by the "n" attribute. If the "a" attribute specifies a different user, the server associates that identity with the connection after successful authentication and authorization checks. The syntax of this field is the same as that of the "n" field with respect to quoting of '=' and ','.
-
NONCE
public static final ScramAttributes NONCE
This attribute specifies a sequence of random printable ASCII characters excluding ',' (which forms the nonce used as input to the hash function). No quoting is applied to this string.
-
CHANNEL_BINDING
public static final ScramAttributes CHANNEL_BINDING
This REQUIRED attribute specifies the base64-encoded GS2 header and channel binding data. The attribute data consist of:- the GS2 header from the client's first message (recall that the GS2 header contains a channel binding flag and an optional authzid). This header is going to include channel binding type prefix (see [RFC5056]), if and only if the client is using channel binding;
- followed by the external channel's channel binding data, if and only if the client is using channel binding.
-
SALT
public static final ScramAttributes SALT
This attribute specifies the base64-encoded salt used by the server for this user.
-
ITERATION
public static final ScramAttributes ITERATION
This attribute specifies an iteration count for the selected hash function and user.
-
CLIENT_PROOF
public static final ScramAttributes CLIENT_PROOF
This attribute specifies a base64-encoded ClientProof.
-
SERVER_SIGNATURE
public static final ScramAttributes SERVER_SIGNATURE
This attribute specifies a base64-encoded ServerSignature.
-
ERROR
public static final ScramAttributes ERROR
This attribute specifies an error that occurred during authentication exchange. Can help diagnose the reason for the authentication exchange failure.
-
-
Method Detail
-
values
public static ScramAttributes[] 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 (ScramAttributes c : ScramAttributes.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ScramAttributes valueOf(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:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getChar
public char getChar()
Description copied from interface:CharAttribute
Return the char used to represent this attribute- Specified by:
getChar
in interfaceCharAttribute
- Returns:
- The character of the attribute
-
byChar
public static ScramAttributes byChar(char c) throws ScramParseException
Find a SCRAMAttribute by its character.- Parameters:
c
- The character.- Returns:
- The SCRAMAttribute that has that character.
- Throws:
ScramParseException
- If no SCRAMAttribute has this character.
-
-