Principal class

An authenticated identity, as resolved by an Authenticator.

A principal may be a human user or a node account. roles drive authorization decisions (e.g. admin, developer, ci, node).

Annotations
  • @immutable

Constructors

Principal({required PrincipalId id, required String displayName, Set<String> roles = const {}})
Creates a principal.
const

Properties

displayName String
A human-friendly display name.
final
hashCode int
The hash code for this object.
no setterinherited
id PrincipalId
The principal's stable identity.
final
roles Set<String>
The roles granted to this principal.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

hasRole(String role) bool
Whether the principal holds role.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serializes to a JSON map (used by whoami and audit records).
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited