Package io.datareplication.consumer
Class Authorization
- java.lang.Object
-
- io.datareplication.consumer.Authorization
-
public final class Authorization extends java.lang.ObjectThe value of an HTTPAuthorizationheader.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static @NonNull Authorizationbasic(@NonNull java.lang.String username, @NonNull java.lang.String password)Create an Authorization using the Basic scheme with the given username and password.booleanequals(java.lang.Object o)inthashCode()static Authorizationof(@NonNull java.lang.String scheme, @NonNull java.lang.String parameters)Creates a newAuthorizationinstance.@NonNull java.lang.Stringparameters()The parameters for the authorization.@NonNull java.lang.Stringscheme()Specifies the authentication scheme, which determines the format of theparameters()field.@NonNull HttpHeadertoHeader()Return this Authorization as anHttpHeader.java.lang.StringtoString()
-
-
-
Method Detail
-
toHeader
@NonNull public @NonNull HttpHeader toHeader()
Return this Authorization as anHttpHeader.- Returns:
- an
AuthorizationHttpHeadercontaining 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 newAuthorizationinstance.- 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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-