Package org.refcodes.net
Class BasicAuthCredentialsImpl
- java.lang.Object
-
- org.refcodes.net.BasicAuthCredentialsImpl
-
- All Implemented Interfaces:
org.refcodes.mixin.CredentialsAccessor
,org.refcodes.mixin.IdentityAccessor
,org.refcodes.mixin.SecretAccessor
,org.refcodes.mixin.Validatable<BasicCredentials>
,AuthTypeAccessor
,AuthTypeCredentials<BasicAuthCredentials,BasicCredentials>
,BasicAuthCredentials
,BasicCredentials
- Direct Known Subclasses:
BasicAuthCredentialsBuilderImpl
public class BasicAuthCredentialsImpl extends Object implements BasicAuthCredentials
This implementation of theBasicAuthCredentials
interface compares the secret (getSecret()
) case sensitive but the username (getIdentity()
) case insensitive with theequals(Object)
method.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.net.AuthTypeAccessor
AuthTypeAccessor.AuthTypeBuilder<B extends AuthTypeAccessor.AuthTypeBuilder<B>>, AuthTypeAccessor.AuthTypeMutator, AuthTypeAccessor.AuthTypeProperty
-
Nested classes/interfaces inherited from interface org.refcodes.net.BasicAuthCredentials
BasicAuthCredentials.BasicAuthCredentialsBuilder
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.CredentialsAccessor
org.refcodes.mixin.CredentialsAccessor.CredentialsBuilder<B extends org.refcodes.mixin.CredentialsAccessor.CredentialsBuilder<B>>, org.refcodes.mixin.CredentialsAccessor.CredentialsMutator, org.refcodes.mixin.CredentialsAccessor.CredentialsProperty
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.IdentityAccessor
org.refcodes.mixin.IdentityAccessor.IdentityBuilder<B extends org.refcodes.mixin.IdentityAccessor.IdentityBuilder<B>>, org.refcodes.mixin.IdentityAccessor.IdentityMutator, org.refcodes.mixin.IdentityAccessor.IdentityProperty
-
-
Field Summary
-
Fields inherited from interface org.refcodes.net.BasicAuthCredentials
DELIMITER_BASIC_AUTH, DELIMITER_CREDENTIALS
-
-
Constructor Summary
Constructors Constructor Description BasicAuthCredentialsImpl()
Instantiates a newBasicAuthCredentials
instance.BasicAuthCredentialsImpl(String aIdentity, String aSecret)
Instantiates a newBasicAuthCredentials
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
void
fromHttpAuthorization(String aHttpAuthorization)
Initializes thisAuthTypeCredentials
instance from theHeaderField.AUTHORIZATION
Header-Fields's value.String
getIdentity()
String
getSecret()
int
hashCode()
String
toHttpAuthorization()
Creates aHeaderField.AUTHORIZATION
HTTP Header-Field value from theAuthTypeCredentials
instance.String
toString()
-
Methods inherited from interface org.refcodes.net.BasicAuthCredentials
getAuthType, validate, validate, withHttpAuthorization
-
Methods inherited from interface org.refcodes.net.BasicCredentials
isValid, isValid
-
-
-
-
Constructor Detail
-
BasicAuthCredentialsImpl
public BasicAuthCredentialsImpl()
Instantiates a newBasicAuthCredentials
instance.
-
BasicAuthCredentialsImpl
public BasicAuthCredentialsImpl(String aIdentity, String aSecret)
Instantiates a newBasicAuthCredentials
instance.- Parameters:
aIdentity
- the user nameaSecret
- the secret
-
-
Method Detail
-
getIdentity
public String getIdentity()
- Specified by:
getIdentity
in interfaceorg.refcodes.mixin.IdentityAccessor
-
getSecret
public String getSecret()
- Specified by:
getSecret
in interfaceorg.refcodes.mixin.SecretAccessor
-
fromHttpAuthorization
public void fromHttpAuthorization(String aHttpAuthorization)
Initializes thisAuthTypeCredentials
instance from theHeaderField.AUTHORIZATION
Header-Fields's value.- Specified by:
fromHttpAuthorization
in interfaceAuthTypeCredentials<BasicAuthCredentials,BasicCredentials>
- Parameters:
aHttpAuthorization
- TheHeaderField.AUTHORIZATION
header field's value
-
toHttpAuthorization
public String toHttpAuthorization()
Creates aHeaderField.AUTHORIZATION
HTTP Header-Field value from theAuthTypeCredentials
instance.- Specified by:
toHttpAuthorization
in interfaceAuthTypeCredentials<BasicAuthCredentials,BasicCredentials>
- Returns:
- The according HTTP Header-Field's value.
-
-