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 theBasicAuthCredentialsinterface 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 newBasicAuthCredentialsinstance.BasicAuthCredentialsImpl(String aIdentity, String aSecret)Instantiates a newBasicAuthCredentialsinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)voidfromHttpAuthorization(String aHttpAuthorization)Initializes thisAuthTypeCredentialsinstance from theHeaderField.AUTHORIZATIONHeader-Fields's value.StringgetIdentity()StringgetSecret()inthashCode()StringtoHttpAuthorization()Creates aHeaderField.AUTHORIZATIONHTTP Header-Field value from theAuthTypeCredentialsinstance.StringtoString()-
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 newBasicAuthCredentialsinstance.
-
BasicAuthCredentialsImpl
public BasicAuthCredentialsImpl(String aIdentity, String aSecret)
Instantiates a newBasicAuthCredentialsinstance.- Parameters:
aIdentity- the user nameaSecret- the secret
-
-
Method Detail
-
getIdentity
public String getIdentity()
- Specified by:
getIdentityin interfaceorg.refcodes.mixin.IdentityAccessor
-
getSecret
public String getSecret()
- Specified by:
getSecretin interfaceorg.refcodes.mixin.SecretAccessor
-
fromHttpAuthorization
public void fromHttpAuthorization(String aHttpAuthorization)
Initializes thisAuthTypeCredentialsinstance from theHeaderField.AUTHORIZATIONHeader-Fields's value.- Specified by:
fromHttpAuthorizationin interfaceAuthTypeCredentials<BasicAuthCredentials,BasicCredentials>- Parameters:
aHttpAuthorization- TheHeaderField.AUTHORIZATIONheader field's value
-
toHttpAuthorization
public String toHttpAuthorization()
Creates aHeaderField.AUTHORIZATIONHTTP Header-Field value from theAuthTypeCredentialsinstance.- Specified by:
toHttpAuthorizationin interfaceAuthTypeCredentials<BasicAuthCredentials,BasicCredentials>- Returns:
- The according HTTP Header-Field's value.
-
-