public virtual IEnumerable <string> GetValidationErrors() { if (Authority.IsMissing() && TokenEndpoint.IsMissing()) { yield return($"You must either set {nameof(Authority)} or {nameof(TokenEndpoint)}."); } if (ClientId.IsMissing()) { yield return($"You must set {nameof(ClientId)}."); } if (ClientSecret.IsMissing()) { yield return($"You must set {nameof(ClientSecret)}."); } if (AuthorityHttpClientName.IsMissing()) { yield return($"You must set {nameof(AuthorityHttpClientName)}."); } if (Events == null) { yield return($"You must set {nameof(Events)}."); } }
/// <summary> /// Check that the options are valid. Should throw an exception if things are not ok. /// </summary> /// <exception cref="InvalidOperationException"> /// You must either set Authority or IntrospectionEndpoint /// or /// You must either set a ClientId or set an introspection HTTP handler /// </exception> /// <exception cref="ArgumentException">TokenRetriever must be set - TokenRetriever</exception> public override void Validate() { base.Validate(); if (Authority.IsMissing() && IntrospectionEndpoint.IsMissing()) { throw new InvalidOperationException("You must either set Authority or IntrospectionEndpoint"); } if (ClientId.IsMissing() && IntrospectionHttpHandler == null) { throw new InvalidOperationException("You must either set a ClientId or set an introspection HTTP handler"); } if (GetClaimsFromUserinfoEndpoint) { if (Authority.IsMissing() && UserinfoEndpoint.IsMissing()) { throw new InvalidOperationException("You must either set Authority or UserinfoEndpoint"); } } if (TokenRetriever == null) { throw new ArgumentException("TokenRetriever must be set", nameof(TokenRetriever)); } }