Skip to content

CarpUser

Represents a CARP Web Service (CAWS) account and user.

Annotations
  • @JsonSerializable(fieldRename: FieldRename.snake, includeIfNull: false, explicitToJson: true)

Constructors

CarpUser.fromJWT

CarpUser.fromJWT(
  1. Map<String, dynamic> jwt,
  2. OidcToken token
)

CarpUser.fromJWTOAuth

CarpUser.fromJWTOAuth(
  1. Map<String, dynamic> jwt,
  2. OAuthToken token
)

CarpUser.fromJson

CarpUser.fromJson(
  1. Map<String, dynamic> json
)

CarpUser

CarpUser({
  1. required String username,
  2. required String id,
  3. String? firstName,
  4. String? lastName,
  5. String? email,
  6. List roles = const [],
  7. OAuthToken? token,
})

Properties

accountId

  1. @Deprecated('Use id instead')
String get accountId

email

String? email
getter/setter pair

The user's email

firstName

String? firstName
getter/setter pair

User's first name

id

String id
getter/setter pair

Unique CARP ID

isAuthenticated

bool get isAuthenticated

Whether this user has a token. Does not check expiry or server-side validity.

isEmailVerified

bool get isEmailVerified

Currently returns whether this user has a token; the email verification status is not inspected.

lastName

String? lastName
getter/setter pair

User's last name

roles

List roles
getter/setter pair

The list of roles that this user has in CARP.

token

OAuthToken? token
getter/setter pair

The OAuth 2.0 OAuthToken for this user, once authenticated to CARP. Is null if user is not authenticated.

username

String username
getter/setter pair

Unique CARP username

Methods

authenticated

void authenticated(
  1. OAuthToken token
)

Set or update the authenticated OAuthToken token for this user.

signOut

Future<void> signOut()

Sign out the current user.

toJson

Map<String, dynamic> toJson()

toString

String toString()
override

A string representation of this object.

Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.

Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.