public interface ILinkTokenProvider<T extends IGenerateLinkTokenRequest>
ILinkTokenProvider
defines contract for link token generation and
validation APIs.Modifier and Type | Method and Description |
---|---|
LinkTokenContainer |
generateLinkToken(T request)
Generates a new LinkToken.
|
LinkTokenSchema |
getTokenSchema()
Returns link token schema supported by the implementation.
|
LinkTokenInfo |
validateLinkToken(LinkToken linkToken,
IRequestContext requestContext)
Validates the given LinkToken.
|
LinkTokenInfo |
validateLinkToken(SSITokenInfo ssiTokenInfo,
IRequestContext requestContext)
Validates the LinkToken unwrapped from an SSI token.
|
LinkTokenContainer generateLinkToken(T request) throws TokenException
request
- IGenerateLinkTokenRequest
Object holding details
required for generating link token.TokenException
- is thrown to indicate unexpected errors encountered
while generating token.LinkTokenInfo validateLinkToken(LinkToken linkToken, IRequestContext requestContext) throws TokenException
NOTE that for validating link token during the authentication flow, another
variant of this method validateLinkToken(SSITokenInfo, IRequestContext)
must be used. This method doesn't enforce that a link token being validated
is obtained as part of an SSI token. SSI token is essential to verify that
account linking is still valid at this moment and link token is used for
authentication on intended devices. Link token obtained through any other
means might represent a stale or invalid account linking and doesn't
provide authorization to be used for customer authentication.
LinkToken validation entails the following:
linkToken
- LinkToken
Link token to decode.requestContext
- IRequestContext
object which holds additional
contextual information about the request.LinkTokenInfo
object containing information decoded from
the link token.InvalidTokenException
- is thrown for malformed tokens that cannot
be decoded.TokenException
- is thrown to indicate other unexpected
errors encountered while decoding token.LinkTokenInfo validateLinkToken(SSITokenInfo ssiTokenInfo, IRequestContext requestContext) throws TokenException
In addition to the validation steps done in validateLinkToken(LinkToken, IRequestContext)
,
this method verifies that the token is being used within its scope by matching
Amazon user id from the enclosing SSI token (which represents the current
active user on the device) with Amazon user id which link token has been
scoped to.
ssiTokenInfo
- Decoded information from an SSI token.requestContext
- IRequestContext
object which holds additional
contextual information about the request.LinkTokenInfo
object containing information decoded from
the link token.InvalidTokenException
- is thrown when the token cannot be decoded
when it's malformed.InvalidTokenUsageException
- is thrown when the token usage is found
to be not within the approved scope.TokenException
- is thrown to indicate other unexpected
errors encountered while decoding token.LinkTokenSchema getTokenSchema()
LinkTokenSchema