Class BasicCredentials

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>
The BasicCredentials describes 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

    Nested classes/interfaces inherited from interface org.refcodes.mixin.SecretAccessor

    org.refcodes.mixin.SecretAccessor.SecretBuilder<B extends org.refcodes.mixin.SecretAccessor.SecretBuilder<B>>, org.refcodes.mixin.SecretAccessor.SecretMutator, org.refcodes.mixin.SecretAccessor.SecretProperty
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected String
     
    protected String
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Instantiates a new basic credentials impl.
     
    BasicCredentials(String aIdentity, String aSecret)
    Instantiates a new basic credentials impl.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    isValid(String aUserName, String aSecret)
    Validates the provided user-name and secret against this BasicCredentials user-name and secret.
    boolean
    isValid(BasicCredentials aCredentials)
    Validates the provided BasicCredentials against this BasicCredentials user-name and secret.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • _identity

      protected String _identity
    • _secret

      protected String _secret
  • Constructor Details

    • BasicCredentials

      protected BasicCredentials()
      Instantiates a new basic credentials impl.
    • BasicCredentials

      public BasicCredentials(String aIdentity, String aSecret)
      Instantiates a new basic credentials impl.
      Parameters:
      aIdentity - the user name
      aSecret - the secret
  • Method Details

    • isValid

      public boolean isValid(BasicCredentials aCredentials)
      Validates the provided BasicCredentials against this BasicCredentials user-name and secret. If this BasicCredentials instance's user-name or password are null, then false is returned.
      Specified by:
      isValid in interface org.refcodes.mixin.Validatable<BasicCredentials>
      Parameters:
      aCredentials - The BasicCredentials to be tested if them fit with the this BasicCredentials instance.
      Returns:
      True if the BasicCredentials match with the this BasicCredentials instance and this BasicAuthCredentials instance's user-name and secret are not null.
    • isValid

      public boolean isValid(String aUserName, String aSecret)
      Validates the provided user-name and secret against this BasicCredentials user-name and secret. If this BasicCredentials instance'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 this BasicCredentials instance.
      aSecret - The secret part to be tested if it fits with the this BasicCredentials instance.
      Returns:
      True if the user-name and secret match with the this BasicCredentials instance and this BasicAuthCredentials instance's user-name and secret are not null.
    • getIdentity

      public String getIdentity()
      Specified by:
      getIdentity in interface org.refcodes.mixin.IdentityAccessor
    • getSecret

      public String getSecret()
      Specified by:
      getSecret in interface org.refcodes.mixin.SecretAccessor