oauth2-jwt-bearer-0.0.1: OAuth2 jwt-bearer client flow as per rfc7523

Safe HaskellNone
LanguageHaskell2010

Network.OAuth2.JWT.Client.AuthorizationGrant

Description

Authorization grant flow implementation. You probably want Client.

Synopsis

Documentation

sign :: UTCTime -> Claims -> JWK -> ExceptT JWTError IO Assertion Source #

Sign a JWT with the specified claims and key.

The format and signature of the JWT are defined by rfc7519.

The specific of the claims are defined by the OAuth2 JWT Profile rfc7523.

refresh :: UTCTime -> Manager -> TokenEndpoint -> Claims -> JWK -> ExceptT GrantError IO Response Source #

Request a new access token as per the specified claims.

This request is defined in 2.1 of rfc7523.

local :: UTCTime -> TokenState -> Maybe AccessToken Source #

Obtain an already aquired access token iff it is still valid.

grant :: Store -> IO (Either GrantError AccessToken) Source #

Obtain an access token, if we have already aquired one (and it is still valid) we will re-use that token, if we don't already have a token or the token has expired, we go and ask for a new one.

This operation is safe to call from multiple threads. If we are using a current token reads will happen concurrently, If we have to go to the network the request will be serialised so that only one request is made for a new token.