B2CConfiguration.fromJson constructor

B2CConfiguration.fromJson(
  1. Map<String, dynamic> data
)

Creates a B2CConfiguration from a JSON map.

Implementation

B2CConfiguration.fromJson(Map<String, dynamic> data) {
  this.clientId = data["client_id"];
  this.redirectURI = data["redirect_uri"];
  this.authorities = <B2CAuthority>[];
  for (Map<String, dynamic> authData in data["authorities"]) {
    this.authorities.add(B2CAuthority.fromJson(authData));
  }

  if (data.containsKey("cache_location"))
    this.cacheLocation = data["cache_location"];

  if (data.containsKey("interaction_mode"))
    this.interactionMode = data["interaction_mode"];

  if (data.containsKey("account_mode"))
    this.accountMode = data["account_mode"];

  if (data.containsKey("broker_redirect_uri_registered"))
    this.brokerRedirectUriRegistered = data["broker_redirect_uri_registered"];

  if (data.containsKey("default_scopes")) {
    List<String> defaultScopesData = [];
    for (var scope in data["default_scopes"]) {
      defaultScopesData.add(scope as String);
    }
    this.defaultScopes = defaultScopesData;
  }
}