Class BasicCredentials
java.lang.Object
org.refcodes.web.BasicCredentials
- All Implemented Interfaces:
CredentialsAccessor, IdentityAccessor, SecretAccessor, Validatable<BasicCredentials>
- Direct Known Subclasses:
BasicAuthCredentials
public class BasicCredentials
extends Object
implements CredentialsAccessor, Validatable<BasicCredentials>
The
BasicCredentials describes the attributes required by a
Basic-Auth authentication over HTTP(S).-
Nested Class Summary
Nested classes/interfaces inherited from interface CredentialsAccessor
CredentialsAccessor.CredentialsBuilder<B>, CredentialsAccessor.CredentialsMutator, CredentialsAccessor.CredentialsPropertyNested classes/interfaces inherited from interface IdentityAccessor
IdentityAccessor.IdentityBuilder<B>, IdentityAccessor.IdentityMutator, IdentityAccessor.IdentityPropertyNested classes/interfaces inherited from interface SecretAccessor
SecretAccessor.SecretBuilder<B>, SecretAccessor.SecretMutator, SecretAccessor.SecretProperty -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInstantiates a new basic credentials impl.BasicCredentials(String aIdentity, String aSecret) Instantiates a new basic credentials impl. -
Method Summary
Modifier and TypeMethodDescriptionbooleanValidates the provided user-name and secret against thisBasicCredentialsuser-name and secret.booleanisValid(BasicCredentials aCredentials) Validates the providedBasicCredentialsagainst thisBasicCredentialsuser-name and secret.
-
Field Details
-
_identity
-
_secret
-
-
Constructor Details
-
BasicCredentials
protected BasicCredentials()Instantiates a new basic credentials impl. -
BasicCredentials
-
-
Method Details
-
isValid
Validates the providedBasicCredentialsagainst thisBasicCredentialsuser-name and secret. If thisBasicCredentialsinstance's user-name or password are null, then false is returned.- Specified by:
isValidin interfaceValidatable<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
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
- Specified by:
getIdentityin interfaceIdentityAccessor
-
getSecret
- Specified by:
getSecretin interfaceSecretAccessor
-