TokenRequestSpec.fromJson constructor

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

Creates a TokenRequestSpec from JSON data.

Implementation

factory TokenRequestSpec.fromJson(Map<String, dynamic> json) {
  final tempAudiencesJson = json['audiences'];
  final tempBoundObjectRefJson = json['boundObjectRef'];
  final tempExpirationSecondsJson = json['expirationSeconds'];

  final List<String> tempAudiences = List<String>.from(tempAudiencesJson);
  final BoundObjectReference? tempBoundObjectRef =
      tempBoundObjectRefJson != null
          ? BoundObjectReference.fromJson(tempBoundObjectRefJson)
          : null;
  final int? tempExpirationSeconds = tempExpirationSecondsJson;

  return TokenRequestSpec(
    audiences: tempAudiences,
    boundObjectRef: tempBoundObjectRef,
    expirationSeconds: tempExpirationSeconds,
  );
}