Class IssuerRepository
- java.lang.Object
-
- org.forgerock.openig.filter.oauth2.client.IssuerRepository
-
public class IssuerRepository extends Object
A repository to store and create all the OAuth2 issuers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IssuerRepository.Heaplet
Creates and initializes anIssuerRepository
in a heap environment.
-
Constructor Summary
Constructors Constructor Description IssuerRepository(Handler defaultIssuerHandler)
Creates an IssuerRepository.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Promise<Issuer,DiscoveryException>
findByName(String issuerName)
Find a registeredIssuer
whose name matches issuerName.Promise<Issuer,DiscoveryException>
findBySupportedDomainNames(String givenDomainName)
Find a registeredIssuer
that supports the given {code domainName}.Promise<Issuer,DiscoveryException>
findOrCreateFromWellKnownUri(String issuerName, URI wellKnownUri)
Try to find an already registered Issuer named issuerName.Promise<Issuer,DiscoveryException>
findOrCreateFromWellKnownUri(String issuerName, URI wellKnownUri, List<Pattern> supportedDomains, Handler handler)
Tries to find an already registered Issuer named issuerName.Promise<Issuer,DiscoveryException>
register(String issuerName, JsonValue config, List<Pattern> supportedDomains)
Register anIssuer
into the repository.
-
-
-
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 registeredIssuer
whose name matches issuerName.- Parameters:
issuerName
- the name of theIssuer
to find- Returns:
- the issuer matching the given issuerName or null if none found.
-
findBySupportedDomainNames
public Promise<Issuer,DiscoveryException> findBySupportedDomainNames(String givenDomainName)
Find a registeredIssuer
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 anIssuer
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 newIssuer
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
-
-