- java.lang.Object
-
- org.refcodes.web.BasicCredentials
-
- All Implemented Interfaces:
org.refcodes.mixin.CredentialsAccessor,org.refcodes.mixin.IdentityAccessor,org.refcodes.mixin.SecretAccessor,org.refcodes.mixin.Validatable<BasicCredentials>
- Direct Known Subclasses:
BasicAuthCredentials
public class BasicCredentials extends Object implements org.refcodes.mixin.CredentialsAccessor, org.refcodes.mixin.Validatable<BasicCredentials>
TheBasicCredentialsdescribes the attributes required by a Basic-Auth authentication over HTTP(S).
-
-
Nested Class Summary
-
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
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBasicCredentials()Instantiates a new basic credentials impl.BasicCredentials(String aIdentity, String aSecret)Instantiates a new basic credentials impl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetIdentity()StringgetSecret()booleanisValid(String aUserName, String aSecret)Validates the provided user-name and secret against thisBasicCredentialsuser-name and secret.booleanisValid(BasicCredentials aCredentials)Validates the providedBasicCredentialsagainst thisBasicCredentialsuser-name and secret.
-
-
-
Method Detail
-
isValid
public boolean isValid(BasicCredentials aCredentials)
Validates the providedBasicCredentialsagainst thisBasicCredentialsuser-name and secret. If thisBasicCredentialsinstance's user-name or password are null, then false is returned.- Specified by:
isValidin interfaceorg.refcodes.mixin.Validatable<BasicCredentials>- Parameters:
aCredentials- TheBasicCredentialsto be tested if them fit with the thisBasicCredentialsinstance.- Returns:
- True if the
BasicCredentialsmatch with the thisBasicCredentialsinstance and thisBasicAuthCredentialsinstance's user-name and secret are not null.
-
isValid
public boolean isValid(String aUserName, String aSecret)
Validates the provided user-name and secret against thisBasicCredentialsuser-name and secret. If thisBasicCredentialsinstance's user-name or password are null, then false is returned.- Parameters:
aUserName- The user-name part to be tested if it fits with the thisBasicCredentialsinstance.aSecret- The secret part to be tested if it fits with the thisBasicCredentialsinstance.- Returns:
- True if the user-name and secret match with the this
BasicCredentialsinstance and thisBasicAuthCredentialsinstance's user-name and secret are not null.
-
getIdentity
public String getIdentity()
- Specified by:
getIdentityin interfaceorg.refcodes.mixin.IdentityAccessor
-
getSecret
public String getSecret()
- Specified by:
getSecretin interfaceorg.refcodes.mixin.SecretAccessor
-
-