All Known Implementing Classes:
OAuth2Credentials, TokenCredentials, UsernamePasswordCredentials

public interface Credentials
Abstract representation of a Credentials object.
  • Method Summary

    Modifier and Type
    Method
    Description
    default String
    Encodes this credential as an HTTP Authorization https://tools.ietf.org/html/rfc7235.
    org.json.JSONObject
    Convert the credential information to JSON format.
    default <V> void
    validate(V arg)
    Implementors should override this method to perform validation.
  • Method Details

    • toJSON

      org.json.JSONObject toJSON()
      Convert the credential information to JSON format.
      Returns:
      a JSON object.
    • validate

      default <V> void validate(V arg) throws CredentialValidationException
      Implementors should override this method to perform validation. An argument is allowed to allow custom validation.
      Type Parameters:
      V - the generic type of the argument
      Parameters:
      arg - optional argument or null.
      Throws:
      CredentialValidationException - when the validation fails
    • toHttpAuthorization

      default String toHttpAuthorization()
      Encodes this credential as an HTTP Authorization https://tools.ietf.org/html/rfc7235.
      Returns:
      HTTP header including scheme.
      Throws:
      UnsupportedOperationException - when the credential object cannot be converted to an HTTP Authorization.