Class IssuerAcceptabilityHandlerImpl
java.lang.Object
uk.co.spudsoft.jwtvalidatorvertx.impl.IssuerAcceptabilityHandlerImpl
- All Implemented Interfaces:
IssuerAcceptabilityHandler
The standard IssuerAcceptabilityHandler.
Provides two approaches, which can be used in isolation or together:
- A list of acceptable issuers can be provided in a file. The file can be changed whilst the system is up, but the path to the file is fixed. It is recommended that the file be updated atomically (e.g. by changing a soft link).
- A list of regular expressions can be provided. Each regular expression will be checked, one at a time.
- Author:
- yaytay
-
Constructor Summary
ConstructorsConstructorDescriptionIssuerAcceptabilityHandlerImpl(List<String> acceptableIssuerRegexes, String acceptableIssuersFile, Duration pollPeriod) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisAcceptable(String issuer) Confirm that the issuer matches at least one of the configured acceptable issuer regular expressions or is found in the acceptableIssuersFile.voidvalidate()Validate the configuration.
-
Constructor Details
-
IssuerAcceptabilityHandlerImpl
public IssuerAcceptabilityHandlerImpl(List<String> acceptableIssuerRegexes, String acceptableIssuersFile, Duration pollPeriod) Constructor.- Parameters:
acceptableIssuerRegexes- The List of regular expressions (as Strings) that are acceptable.acceptableIssuersFile- The path to a file that contains valid issuers, one per line.pollPeriod- The time period between file checks (the check just looks at the last modified time, so make this about a minute).
-
-
Method Details
-
validate
Description copied from interface:IssuerAcceptabilityHandlerValidate the configuration.- Specified by:
validatein interfaceIssuerAcceptabilityHandler- Throws:
IllegalArgumentException- if the configuration is not usable, or is not configured with usable values.
-
isAcceptable
Description copied from interface:IssuerAcceptabilityHandlerConfirm that the issuer matches at least one of the configured acceptable issuer regular expressions or is found in the acceptableIssuersFile.- Specified by:
isAcceptablein interfaceIssuerAcceptabilityHandler- Parameters:
issuer- the issuer to confirm.- Returns:
- true if the issuer is acceptable.
-