You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 line
1.5KB

  1. namespace Campaign_Tracker.Server.Authentication;
  2. public sealed class KeycloakOptions
  3. {
  4. public const string SectionName = "Keycloak";
  5. public string Authority { get; init; } = "https://kci-app01.ntp.kentcommunications.com/realms/KCI";
  6. public string? MetadataAddress { get; init; }
  7. public string? ValidIssuer { get; init; }
  8. public string PublicAuthority { get; init; } = "https://kci-app01.ntp.kentcommunications.com/realms/KCI";
  9. public string ClientId { get; init; } = "canopy-web";
  10. public string? ClientSecret { get; init; }
  11. public string? Audience { get; init; }
  12. public string[]? Audiences { get; init; }
  13. public bool DisableHttpsMetadata { get; init; }
  14. public string? TestSigningKey { get; init; }
  15. public string TokenAudience => string.IsNullOrWhiteSpace(Audience) ? ClientId : Audience;
  16. // Keycloak's default access token carries aud="account" (the realm's
  17. // built-in account client). Resource-server audience validation must
  18. // accept that alongside our own ClientId, otherwise every legitimate
  19. // token fails validation with SecurityTokenInvalidAudienceException.
  20. public string[] TokenAudiences =>
  21. Audiences is { Length: > 0 } configured
  22. ? configured
  23. : [TokenAudience, "account"];
  24. public string TokenIssuer =>
  25. string.IsNullOrWhiteSpace(ValidIssuer) ? PublicAuthority : ValidIssuer;
  26. public string TokenEndpointAuthority =>
  27. string.IsNullOrWhiteSpace(PublicAuthority) ? Authority : PublicAuthority;
  28. }

Powered by TurnKey Linux.