Class OAuthClient

java.lang.Object
eu.webtoolkit.jwt.auth.OAuthClient

public class OAuthClient
extends java.lang.Object
OAuth 2.0 client implementing OpenID Connect, a.k.a. relying party.

This class represents a client. It is a value class that stores only the id and a reference to an AbstractUserDatabase to access its properties.

An object can point to a valid client, or be invalid. Invalid clients are typically used as return value for database queries which did not match with an existing client.

See Also:
AbstractUserDatabase
  • Constructor Summary

    Constructors
    Constructor Description
    OAuthClient()
    Default constructor that creates an invalid OAuthClient.
    OAuthClient​(java.lang.String id, AbstractUserDatabase db)
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    ClientSecretMethod getAuthMethod()
    Returns the client authentication method (see OIDC Core chapter 9)
    java.lang.String getClientId()
    Returns the ID used to identify the client with the OpenID Connect provider and user.
    java.lang.String getId()
    Returns the ID used to identify the client in the database.
    java.util.Set<java.lang.String> getRedirectUris()
    Returns the set of redirect URI's that are valid for this client.
    boolean isCheckValid()
    Returns whether the user is valid.
    boolean isConfidential()
    Returns whether the client is confidential or public.
    boolean verifySecret​(java.lang.String secret)
    Returns true if the given secret is correct for the given client.

    Methods inherited from class java.lang.Object

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

    • OAuthClient

      public OAuthClient()
      Default constructor that creates an invalid OAuthClient.

      See Also:
      isCheckValid()
    • OAuthClient

      public OAuthClient​(java.lang.String id, AbstractUserDatabase db)
      Constructor.

      Creates a client with id id, and whose information is stored in the database.

  • Method Details

    • isCheckValid

      public boolean isCheckValid()
      Returns whether the user is valid.

      A invalid user is a sentinel value returned by methods that query the database but could not identify a matching user.

    • getId

      public java.lang.String getId()
      Returns the ID used to identify the client in the database.

      This returns the id that uniquely identifies the user, and acts as a "primary key" to obtain other information for the user in the database.

    • getClientId

      public java.lang.String getClientId()
      Returns the ID used to identify the client with the OpenID Connect provider and user.

      This is the id that the client uses to identify itself with the identity provider.

      See Also:
      AbstractUserDatabase.idpClientId(OAuthClient client)
    • verifySecret

      public boolean verifySecret​(java.lang.String secret)
      Returns true if the given secret is correct for the given client.
    • getRedirectUris

      public java.util.Set<java.lang.String> getRedirectUris()
      Returns the set of redirect URI's that are valid for this client.

      See Also:
      AbstractUserDatabase.idpClientRedirectUris(OAuthClient client)
    • isConfidential

      public boolean isConfidential()
      Returns whether the client is confidential or public.

      See Also:
      AbstractUserDatabase.idpClientConfidential(OAuthClient client)
    • getAuthMethod

      public ClientSecretMethod getAuthMethod()
      Returns the client authentication method (see OIDC Core chapter 9)

      See Also:
      AbstractUserDatabase.idpClientAuthMethod(OAuthClient client)