OidcIdToken class
The OpenID Connect ID token: the provider's signed statement of who logged in, for which client, and when.
The token endpoint returns it next to the access token when the login
asked for the openid scope. The login checks it (issuer, audience,
expiry, nonce) and builds the claims of the user from it. It is also
the id_token_hint that ends the provider's session on logout. Its
value is a JWT (header.payload.signature).
final user = login.user as OidcUser;
final idToken = user.idToken;
log.info('${idToken.subject} logged in at ${idToken.authenticatedAt}');
Spring (Java): OidcIdToken.
- Inheritance
-
- Object
- AbstractOAuth2Token
- OidcIdToken
- Mixed-in types
Constructors
-
OidcIdToken(String tokenValue, {required Map<
String, Object?> claims, DateTime? issuedAt, DateTime? expiresAt}) -
An ID token with
tokenValueand itsclaims, issued atissuedAtand expiring atexpiresAt. - OidcIdToken.parse(String tokenValue)
-
Reads the JWT
tokenValue: its header must be a JSON object whosealgis notnone, its payload a JSON object of claims.factory
Properties
- accessTokenHash → String?
-
at_hash.no setterinherited -
address
→ Map<
String, Object?> ? -
address: a JSON object (street_address,locality, ...).no setterinherited -
audience
→ List<
String> -
aud: the clients the token is for; it must name this one.no setterinherited - authenticatedAt → DateTime?
-
auth_time: when the user last entered credentials (UTC).no setterinherited - authenticationContextClass → String?
-
acr.no setterinherited -
authenticationMethods
→ List<
String> ? -
amr.no setterinherited -
c_hash.no setterinherited -
azp: the client the token was issued to.no setterinherited - birthdate → String?
-
birthdate, as written (YYYY-MM-DD, or a year alone).no setterinherited -
claims
→ Map<
String, Object?> -
The claims, by name; cannot be modified.
final
- email → String?
-
email.no setterinherited - emailVerified → bool?
-
email_verified: whether the provider checked the email.no setterinherited - expiresAt → DateTime?
-
exp: when the token expires (UTC).no setterinherited - familyName → String?
-
family_name.no setterinherited - fullName → String?
-
name: the full name.no setterinherited - gender → String?
-
gender.no setterinherited - givenName → String?
-
given_name.no setterinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- issuedAt → DateTime?
-
iat: when the token was issued (UTC).no setterinherited - issuer → String?
-
iss: the provider that issued the token.no setterinherited - locale → String?
-
locale, such asen-US.no setterinherited - middleName → String?
-
middle_name.no setterinherited - nickName → String?
-
nickname.no setterinherited - nonce → String?
-
nonce: what the client sent in the authorization request (here, its SHA-256 hash).no setterinherited - phoneNumber → String?
-
phone_number.no setterinherited - phoneNumberVerified → bool?
-
phone_number_verified.no setterinherited - picture → String?
-
picture: the URL of the picture.no setterinherited - preferredUsername → String?
-
preferred_username: the name the user goes by, not unique.no setterinherited - profile → String?
-
profile: the URL of the profile page.no setterinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- subject → String?
-
sub: the user's id at the provider; never changes for one user.no setterinherited - tokenValue → String
-
The token itself, as the provider issued it; a credential, never log
it.
finalinherited
- updatedAt → DateTime?
-
updated_at: when the profile last changed.no setterinherited - website → String?
-
website.no setterinherited - zoneInfo → String?
-
zoneinfo: the time zone, such asEurope/Paris.no setterinherited
Methods
-
getClaimAsBoolean(
String name) → bool? -
The claim
nameas a boolean:true/falseor the strings"true"/"false";nullwhen absent or anything else.inherited -
getClaimAsInstant(
String name) → DateTime? -
The claim
nameas a time: seconds since 1970 (a NumericDate), in UTC;nullwhen absent or not a number.inherited -
getClaimAsMap(
String name) → Map< String, Object?> ? -
The claim
nameas a JSON object;nullwhen absent or not an object.inherited -
getClaimAsString(
String name) → String? -
The claim
nameas text (toString()of a number);nullwhen absent.inherited -
getClaimAsStringList(
String name) → List< String> ? -
The claim
nameas a list of text: a single string gives a list of one;nullwhen absent.inherited -
hasClaim(
String name) → bool -
Whether the claim
nameis present (even with anullvalue).inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- maxLength → const int
- The longest raw token OidcIdToken.parse reads.