CredentialIssuerMetaData.fromJson constructor

CredentialIssuerMetaData.fromJson(
  1. dynamic data
)

Implementation

CredentialIssuerMetaData.fromJson(dynamic data) {
  var jsonObject = credentialToMap(data);
  if (jsonObject.containsKey('credential_issuer')) {
    credentialIssuer = jsonObject['credential_issuer'];
  } else {
    throw Exception('credential_issuer property is needed');
  }

  if (jsonObject.containsKey('credential_endpoint')) {
    credentialEndpoint = jsonObject['credential_endpoint'];
  } else {
    throw Exception('credential_endpoint property is needed');
  }

  authorizationServer = jsonObject['authorization_server'];
  batchCredentialEndpoint = jsonObject['batch_credential_endpoint'];

  if (jsonObject.containsKey('display')) {
    display = [];
    List tmp = jsonObject['display'];
    for (var d in tmp) {
      display!.add(OidcDisplayObject.fromJson(d));
    }
  }

  credentialsSupported = [];
  if (jsonObject.containsKey('credentials_supported')) {
    var tmp = jsonObject['credentials_supported'];
    for (var s in tmp) {
      credentialsSupported.add(CredentialsSupportedObject.fromJson(s));
    }
  }
}