Class IssuerRepository


  • public class IssuerRepository
    extends Object
    A repository to store and create all the OAuth2 issuers.
    • Constructor Detail

      • IssuerRepository

        public IssuerRepository​(Handler defaultIssuerHandler)
        Creates an IssuerRepository.
        Parameters:
        defaultIssuerHandler - The default handler to use to fetch issuer's data from well-known endpoint.
    • Method Detail

      • findByName

        public Promise<Issuer,​DiscoveryException> findByName​(String issuerName)
        Find a registered Issuer whose name matches issuerName.
        Parameters:
        issuerName - the name of the Issuer to find
        Returns:
        the issuer matching the given issuerName or null if none found.
      • findBySupportedDomainNames

        public Promise<Issuer,​DiscoveryException> findBySupportedDomainNames​(String givenDomainName)
        Find a registered Issuer that supports the given {code domainName}. The given domain name can match one or none domain names supported by Issuers declared in this route. If the given domain name matches the patterns given by an Issuer 'supportedDomains' attributes, then the corresponding Issuer is returned to be used.
        Parameters:
        givenDomainName - The domain name to match from the registered domain names.
        Returns:
        A promise completed with either an OAuth 2.0 issuer on success or a DiscoveryException on failure
      • register

        public Promise<Issuer,​DiscoveryException> register​(String issuerName,
                                                                 JsonValue config,
                                                                 List<Pattern> supportedDomains)
        Register an Issuer into the repository.
        Parameters:
        issuerName - The issuer's identifier. Usually, it's the host name or a given name.
        config - The configuration of the issuer.
        supportedDomains - List of the supported domains for this issuer.
        Returns:
        A promise completed with either an OAuth 2.0 issuer on success or a DiscoveryException on failure
      • findOrCreateFromWellKnownUri

        public Promise<Issuer,​DiscoveryException> findOrCreateFromWellKnownUri​(String issuerName,
                                                                                     URI wellKnownUri)
        Try to find an already registered Issuer named issuerName. If none is found, then build a new Issuer based on the given well-known URI.
        Parameters:
        issuerName - The issuer's identifier. Usually, it's the host name or a given name.
        wellKnownUri - The well-known URI of this issuer.
        Returns:
        A promise completed with either an OAuth 2.0 issuer on success or a DiscoveryException on failure
      • findOrCreateFromWellKnownUri

        public Promise<Issuer,​DiscoveryException> findOrCreateFromWellKnownUri​(String issuerName,
                                                                                     URI wellKnownUri,
                                                                                     List<Pattern> supportedDomains,
                                                                                     Handler handler)
        Tries to find an already registered Issuer named issuerName. If none is found, then build a new Issuer based on the given well-known URI. Furthermore, this Issuer will be associated to the provided domain names.
        Parameters:
        issuerName - The issuer's identifier. Usually, it's the host name or a given name.
        wellKnownUri - The well-known URI of this issuer.
        supportedDomains - List of the supported domains for this issuer.
        handler - The issuer handler that does the call to the given well-known URI.
        Returns:
        A promise completed with either an OAuth 2.0 issuer on success or a DiscoveryException on failure