pub enum TokenTypeIdentifier {
AccessToken,
RefreshToken,
IdToken,
Saml1,
Saml2,
Jwt,
}token-exchange only.Expand description
The RFC 8693 section 3 token type identifiers.
The URNs are the wire values, verbatim. This is a closed enum rather than a string because the
subject_token_type is a security-relevant statement about how the presented string must be
checked, and “a type identifier this server did not recognise” has to be a REFUSAL rather than
something that falls through to a default (RFC 8693 section 2.2.2: a subject token that is
unacceptable based on policy is an error).
Variants§
AccessToken
urn:ietf:params:oauth:token-type:access_token. The only type this server accepts as a
subject or actor token, and the only type it issues.
RefreshToken
urn:ietf:params:oauth:token-type:refresh_token.
IdToken
urn:ietf:params:oauth:token-type:id_token.
Saml1
urn:ietf:params:oauth:token-type:saml1.
Saml2
urn:ietf:params:oauth:token-type:saml2.
Jwt
urn:ietf:params:oauth:token-type:jwt. Note that RFC 8693 section 3 defines this as “any
JWT”, which is a statement about ENCODING and not about who issued it; this server does not
accept it, because accepting a JWT as a subject token means deciding whose signature to
trust, and that is a policy no library can pick on a host’s behalf.
Implementations§
Source§impl TokenTypeIdentifier
impl TokenTypeIdentifier
Sourcepub fn parse(s: &str) -> Option<Self>
pub fn parse(s: &str) -> Option<Self>
Resolve a wire *_token_type value WITHOUT allocating, returning None for anything RFC
8693 section 3 does not register.
This is the parse the HTTP surface uses, for the reason crate::grant::GrantType::parse
exists: FromStr’s error carries the caller’s value, and the router deliberately does not
echo it (RFC 6749 s5.2 restricts error_description to a charset an attacker-supplied URN
need not respect), so the copy was allocated and dropped unread. The refusal STRING here was
already made a &'static str for exactly this rule; the allocation underneath it was
missed, and it is the worse one, because the caller chooses its SIZE and this refusal
happens before the presented client credential has been checked.
FromStr is unchanged and still carries the value, for the host-side callers that want
to report which URN they got wrong.
Trait Implementations§
Source§impl Clone for TokenTypeIdentifier
impl Clone for TokenTypeIdentifier
Source§fn clone(&self) -> TokenTypeIdentifier
fn clone(&self) -> TokenTypeIdentifier
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more