authorizationServerMetadataUrls function

List<Uri> authorizationServerMetadataUrls(
  1. String issuer
)

Where the metadata of the authorization server issuer may be, in the order to try (RFC 8414 ยง3.1 with OpenID Connect Discovery).

Implementation

List<Uri> authorizationServerMetadataUrls(String issuer) {
  final u = Uri.parse(issuer);
  final path = u.path.endsWith('/') ? u.path.substring(0, u.path.length - 1) : u.path;
  Uri at(String p) => u.replace(path: p, query: null, fragment: null);
  if (path.isEmpty) {
    return [at('/.well-known/oauth-authorization-server'), at('/.well-known/openid-configuration')];
  }
  return [
    at('/.well-known/oauth-authorization-server$path'),
    at('/.well-known/openid-configuration$path'),
    at('$path/.well-known/openid-configuration'),
  ];
}