flwr_oauth2/revocation
This module implements RFC7009 for OAuth 2.0 token revocation. It offers functions to revoke provided tokens, such as access and refresh tokens. Which token types are supported depends on the OAuth 2.0 server. If the server implements RFC7009 it must support revocation of refresh tokens and should support the revocation of access tokens.
Types
Defines a RFC7009 Revocation Request.
pub type RevocationRequest {
RevocationRequest(
oauth_server: uri.Uri,
token: String,
token_type_hint: option.Option(TokenTypeHint),
credentials: flwr_oauth2.ClientAuthentication,
)
}
Constructors
-
RevocationRequest( oauth_server: uri.Uri, token: String, token_type_hint: option.Option(TokenTypeHint), credentials: flwr_oauth2.ClientAuthentication, )
pub type RevocationResponse {
RevocationResponse
}
Constructors
-
RevocationResponse
Defines the type hint of a revocation request.
pub type TokenTypeHint {
AccessToken
RefreshToken
Other(hint: String)
}
Constructors
-
AccessTokenThis defines that the revocation request is for an access token. The revocation of access tokens might not be supported by the OAuth 2.0 server
-
RefreshTokenThis defines that the revocation request is for a refresh token. The revocation of refresh tokens must be supported by the OAuth 2.0 server if it implements RFC 7009.
-
Other(hint: String)An OAuth 2.0 server may define its own token type hints, use this constructor if this is the case.
Values
pub fn parse_revocation_response(
revocation_response: response.Response(String),
) -> Result(RevocationResponse, flwr_oauth2.ResponseError)
Parses a revocation response as defined in RFC7009. If the response status is 200 the body is ignored. Any other status code is an error response and will be parsed accordingly.
pub fn to_http_request(
revocation_request revocation_request: RevocationRequest,
) -> Result(request.Request(String), flwr_oauth2.RequestError)
Formats a revocation request into a valid gleam http request.