ClaimAccessor mixin
Typed reading of a claim map: text, booleans, lists and times.
The ID token, the user info and the OIDC user mix it in; read claims of your own with the same getters:
final tenant = user.getClaimAsString('tenant');
final groups = user.getClaimAsStringList('groups') ?? const [];
Spring (Java): ClaimAccessor.
Properties
Methods
-
getClaimAsBoolean(
String name) → bool? -
The claim
nameas a boolean:true/falseor the strings"true"/"false";nullwhen absent or anything else. -
getClaimAsInstant(
String name) → DateTime? -
The claim
nameas a time: seconds since 1970 (a NumericDate), in UTC;nullwhen absent or not a number. -
getClaimAsMap(
String name) → Map< String, Object?> ? -
The claim
nameas a JSON object;nullwhen absent or not an object. -
getClaimAsString(
String name) → String? -
The claim
nameas text (toString()of a number);nullwhen absent. -
getClaimAsStringList(
String name) → List< String> ? -
The claim
nameas a list of text: a single string gives a list of one;nullwhen absent. -
hasClaim(
String name) → bool -
Whether the claim
nameis present (even with anullvalue). -
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