public override void validate() { if (RedirectUris != null && ResponseTypes != null && RedirectUris.Count != ResponseTypes.Count) { throw new OIDCException("The redirect_uris do not match response_types."); } if (RedirectUris != null && SectorIdentifierUri != null) { List <string> siUris = new List <string>(); dynamic uris = OpenIdRelyingParty.GetUrlContent(WebRequest.Create(SectorIdentifierUri)); foreach (string uri in uris) { siUris.Add(uri); } foreach (string uri in RedirectUris) { if (!siUris.Contains(uri)) { throw new OIDCException("The sector_identifier_uri json must include URIs from the redirect_uri array."); } } } if (ResponseTypes != null && GrantTypes != null) { foreach (string responseType in ResponseTypes) { if ((responseType == "code" && !GrantTypes.Contains("authorization_code")) || (responseType == "id_token" && !GrantTypes.Contains("implicit")) || (responseType == "token" && !GrantTypes.Contains("implicit")) || (responseType == "id_token" && !GrantTypes.Contains("implicit"))) { throw new OIDCException("The response_types do not match grant_types."); } } } }
/// <summary> /// <see cref="OIDClientSerializableMessage.Validate()"/> /// </summary> public override void Validate() { if (RedirectUris != null && ResponseTypes != null && RedirectUris.Count != ResponseTypes.Count) { throw new OIDCException("The redirect_uris do not match response_types."); } if (RedirectUris != null && SectorIdentifierUri != null) { List <string> siUris = new List <string>(); dynamic uris = WebOperations.GetUrlContent(WebRequest.Create(SectorIdentifierUri)); foreach (string uri in uris) { siUris.Add(uri); } foreach (string uri in RedirectUris) { if (!siUris.Contains(uri)) { throw new OIDCException("The sector_identifier_uri json must include URIs from the redirect_uri array."); } } } if (ResponseTypes != null && GrantTypes != null) { foreach (ResponseType responseType in ResponseTypes) { if ((responseType == ResponseType.Code && !GrantTypes.Contains("authorization_code")) || (responseType == ResponseType.IdToken && !GrantTypes.Contains("implicit")) || (responseType == ResponseType.Token && !GrantTypes.Contains("implicit"))) { throw new OIDCException("The response_types do not match grant_types."); } } } List <string> listUri = new List <string>() { LogoUri, ClientUri, PolicyUri, TosUri, JwksUri, SectorIdentifierUri, InitiateLoginUri, RegistrationClientUri }; if (RedirectUris != null) { listUri.AddRange(RedirectUris); } if (RequestUris != null) { listUri.AddRange(RequestUris); } foreach (string uri in listUri) { if (uri == null) { continue; } if (new Uri(uri).Scheme != "https") { throw new OIDCException("Some of the URIs for the client is not on https"); } } }