Append offline_access to authorization scope when AS advertises it (SEP-2207) (#1479)

This commit is contained in:
Copilot 2026-05-19 14:47:10 -07:00 • committed by GitHub
commit 74788af04d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -78,6 +78,16 @@ public sealed class Program
/// </remarks>
public bool ExpectResource { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether the authorization server advertises support for
/// <c>offline_access</c> in its <c>scopes_supported</c> metadata. This simulates an OIDC-flavored
/// authorization server that issues refresh tokens when the client requests the <c>offline_access</c> scope.
/// </summary>
/// <remarks>
/// The default value is <c>false</c>.
/// </remarks>
public bool IncludeOfflineAccessInMetadata { get; set; }
public HashSet<string> DisabledMetadataPaths { get; } = new(StringComparer.OrdinalIgnoreCase);
public IReadOnlyCollection<string> MetadataRequests => _metadataRequests.ToArray();
@ -188,7 +198,9 @@ public sealed class Program
ResponseTypesSupported = ["code"],
SubjectTypesSupported = ["public"],
IdTokenSigningAlgValuesSupported = ["RS256"],
ScopesSupported = ["openid", "profile", "email", "mcp:tools"],
ScopesSupported = IncludeOfflineAccessInMetadata
? ["openid", "profile", "email", "mcp:tools", "offline_access"]
: ["openid", "profile", "email", "mcp:tools"],
TokenEndpointAuthMethodsSupported = ["client_secret_post"],
ClaimsSupported = ["sub", "iss", "name", "email", "aud"],
CodeChallengeMethodsSupported = ["S256"],