flwr_oauth2/pkce
This module provides functions to create PKCE Verifiers and Challens as per RFC7636.
Types
pub type AuthorizationCodeGrantTokenRequestWithPKCE {
AuthorizationCodeGrantTokenRequestWithPKCE(
token_endpoint: uri.Uri,
authentication: authentication.ClientAuthentication,
redirect_uri: option.Option(uri.Uri),
code: String,
code_verifier: String,
)
}
Constructors
-
AuthorizationCodeGrantTokenRequestWithPKCE( token_endpoint: uri.Uri, authentication: authentication.ClientAuthentication, redirect_uri: option.Option(uri.Uri), code: String, code_verifier: String, )A token request for the Authorization Code Grant Type with a PKCE code verifier. Use the
AuthorizationCodeGrantRedirectUrito retrieve thecode. See RFC6749 Authorization Code Grant and RFC7636.
The code challenge created from a code verifier
pub type Challenge {
Challenge(value: String)
}
Constructors
-
Challenge(value: String)
Values
pub fn new() -> Verifier
Creates a new code verifier as per RFC7636 4.1. Uses a default length for the verifier of 128.
For the definition of the code verifier see this excerpt from RFC7636:
high-entropy cryptographic random STRING using the unreserved characters [A-Z] / [a-z] / [0-9] / “-” / “.” / “_” / “~” from Section 2.3 of [RFC3986], with a minimum length of 43 characters and a maximum length of 128 characters.
pub fn to_challenge(verifier: Verifier) -> Challenge
Creates a code challenge from a given verifier. The given code verifier should conform to the RFC7636 definition of a code verifier, otherwise the resulting code challenge will be invalid.
pub fn to_http_request(
request: AuthorizationCodeGrantTokenRequestWithPKCE,
) -> Result(request.Request(String), token_request.RequestError)
pub fn to_string(
request: AuthorizationCodeGrantTokenRequestWithPKCE,
) -> String