oauth2
ModuleRequest values an OAuth2 / OpenID Connect authorization server parses and checks: prompts, redirect URIs, resource indicators, authorization details, pushed authorization requests and client metadata documents.
Contents
7 submodules, and what the module defines itself.
use utopia_auth::oauth2::AuthorizationDetail;pub enum AuthorizationDetailA common field of an authorization_details entry (RFC 9396).
use utopia_auth::oauth2::Prompt;pub enum PromptA value of the OpenID Connect prompt request parameter.
use utopia_auth::oauth2::authorization_details::AuthorizationDetails;pub struct AuthorizationDetails(Vec<Array>)The authorization_details of a request (RFC 9396): the object entries
of a list. Anything malformed contributes nothing.
oauth2::client_id_metadata_document
Own pageClient ID Metadata Documents: the metadata an OAuth2 client publishes at its client identifier URL.
use utopia_auth::oauth2::client_id_metadata_document::ClientIdMetadataDocument;pub struct ClientIdMetadataDocumentA validated OAuth Client ID Metadata Document. Unknown metadata is kept.
oauth2::client_identifier_url
Own pageClient identifier URLs: OAuth2 clients identified by the URL of their metadata document.
use utopia_auth::oauth2::client_identifier_url::ClientIdentifierUrl;pub struct ClientIdentifierUrlA client identifier URL, from the OAuth Client ID Metadata Document draft.
It is kept verbatim: client ids compare as plain strings.
oauth2::par
Own pagePushed authorization request URIs (RFC 9126).
use utopia_auth::oauth2::par::Par;pub struct ParA pushed authorization request request_uri (RFC 9126): a deployment
prefix plus a stored request id.
use utopia_auth::oauth2::Par;
let prefix = b"urn:ietf:params:oauth:request_uri:";
let par = Par::from_id(prefix, b"abc123")?;
assert_eq!(par.request_uri(), b"urn:ietf:params:oauth:request_uri:abc123");
assert_eq!(Par::from_request_uri(prefix, &par.request_uri())?.id(), b"abc123");oauth2::prompts
Own pageThe parsed OpenID Connect prompt request parameter.
use utopia_auth::oauth2::prompts::Prompts;pub struct Prompts(Vec<Prompt>)The parsed OpenID Connect prompt parameter: distinct values in
first-seen order, where none stands alone.
use utopia_auth::oauth2::{Prompt, Prompts};
let prompts = Prompts::from_string(b"login consent login")?;
assert_eq!(prompts.to_vec(), ["login", "consent"]);
assert!(prompts.contains(Prompt::Consent));
assert!(Prompts::from_string(b"none login").is_err());oauth2::redirect_uris
Own pageA client's registered redirect URIs and how a presented one matches.
use utopia_auth::oauth2::redirect_uris::RedirectUris;pub struct RedirectUris(Vec<Vec<u8>>)A client's registered redirect URIs: exact matching, plus any port on http loopback URIs when asked for (RFC 8252 §7.3, public clients only).
use utopia_auth::oauth2::RedirectUris;
let uris = RedirectUris::from_strings([&b"https://app.example/callback"[..], b"http://127.0.0.1/cb"]);
assert!(uris.matches(b"https://app.example/callback", false));
assert!(!uris.matches(b"https://app.example/other", false));
// Loopback redirects may use any port, when allowed.
assert!(uris.matches(b"http://127.0.0.1:51004/cb", true));oauth2::resource_indicators
Own pageResource indicators: the resource request parameter (RFC 8707).
use utopia_auth::oauth2::resource_indicators::ResourceIndicators;pub struct ResourceIndicators(Vec<Vec<u8>>)The resource indicators of a request (RFC 8707): distinct absolute http(s) URIs without fragments.
use utopia_auth::oauth2::resource_indicators::Resources;pub enum Resources<'a>The resource request parameter: absent, one value, or several.