Interface SignedTokenService
- All Known Implementing Classes:
NimbusSignedTokenService
public interface SignedTokenService
Port that issues and verifies signed, purpose-bound tokens. See the package documentation for its contract.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of the claim that carries the purpose of a signed token. -
Method Summary
-
Field Details
-
PURPOSE_CLAIM
Name of the claim that carries the purpose of a signed token. A bearer-token consumer can reject any token carrying it, so a purpose-bound token is never mistaken for an access token.- See Also:
-
-
Method Details
-
issue
Issues a signed token.- Parameters:
subject- who or what the token is about.purpose- what the token allows; it must be presented again to verify it.ttl- how long the token stays valid.- Returns:
- the compact token.
-
verify
Verifies a token.- Parameters:
token- the compact token.purpose- purpose the token must have been issued for.- Returns:
- the subject of the token, or an empty optional when the token is not valid for that purpose.
-