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