ManagedAuthToken.fromToken constructor

ManagedAuthToken.fromToken(
  1. AuthToken t
)

Instance from an AuthToken.

Implementation

ManagedAuthToken.fromToken(AuthToken t) : super() {
  final tokenResourceOwner =
      entity.relationships["resourceOwner"]!.destinationEntity.instanceOf();
  tokenResourceOwner["id"] = t.resourceOwnerIdentifier;
  this
    ..accessToken = t.accessToken
    ..refreshToken = t.refreshToken
    ..issueDate = t.issueDate
    ..expirationDate = t.expirationDate
    ..type = t.type
    ..scope = t.scopes?.map((s) => s.toString()).join(" ")
    ..resourceOwner = tokenResourceOwner as ResourceOwnerTableDefinition
    ..client = (ManagedAuthClient()..id = t.clientID);
}