Package io.datareplication.consumer
Class Authorization
- java.lang.Object
-
- io.datareplication.consumer.Authorization
-
public final class Authorization extends java.lang.Object
The value of an HTTPAuthorization
header.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static @NonNull Authorization
basic(@NonNull java.lang.String username, @NonNull java.lang.String password)
Create an Authorization using the Basic scheme with the given username and password.boolean
equals(java.lang.Object o)
int
hashCode()
static Authorization
of(@NonNull java.lang.String scheme, @NonNull java.lang.String parameters)
Creates a newAuthorization
instance.@NonNull java.lang.String
parameters()
The parameters for the authorization.@NonNull java.lang.String
scheme()
Specifies the authentication scheme, which determines the format of theparameters()
field.@NonNull HttpHeader
toHeader()
Return this Authorization as anHttpHeader
.java.lang.String
toString()
-
-
-
Method Detail
-
toHeader
@NonNull public @NonNull HttpHeader toHeader()
Return this Authorization as anHttpHeader
.- Returns:
- an
Authorization
HttpHeader
containing the scheme and parameters
-
basic
@NonNull public static @NonNull Authorization basic(@NonNull @NonNull java.lang.String username, @NonNull @NonNull java.lang.String password)
Create an Authorization using the Basic scheme with the given username and password.
For Basic auth, the username and password are joined with a
':'
and the resulting string is base64-encoded.- Parameters:
username
- the username to authenticate aspassword
- the password for the given username- Returns:
- an Authorization with the encoded username and password
-
of
public static Authorization of(@NonNull @NonNull java.lang.String scheme, @NonNull @NonNull java.lang.String parameters)
Creates a newAuthorization
instance.- Parameters:
scheme
- Specifies the authentication scheme, which determines the format of theparameters()
field. Common schemes are:parameters
- The parameters for the authorization. The format and contents of this field are entirely determined by thescheme()
.
-
scheme
@NonNull public @NonNull java.lang.String scheme()
Specifies the authentication scheme, which determines the format of theparameters()
field. Common schemes are:
-
parameters
@NonNull public @NonNull java.lang.String parameters()
The parameters for the authorization. The format and contents of this field are entirely determined by thescheme()
.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-