Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update InteractiveChallengeRequest and InteractiveSignOutRequest to support attaching an identity token or login hint #2247

Merged
merged 1 commit into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ await _service.RevokeTokenAsync(new()
var nonce = (await _service.SignOutInteractivelyAsync(new()
{
CancellationToken = stoppingToken,
IdentityTokenHint = response.BackchannelIdentityToken ?? response.FrontchannelIdentityToken,
ProviderName = provider
})).Nonce;

Expand Down
22 changes: 22 additions & 0 deletions src/OpenIddict.Client/OpenIddictClientModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,17 @@ public sealed record class InteractiveChallengeRequest
[EditorBrowsable(EditorBrowsableState.Advanced)]
public string? GrantType { get; init; }

/// <summary>
/// Gets or sets the optional identity token hint that will
/// be sent to the authorization server, if applicable.
/// </summary>
public string? IdentityTokenHint { get; set; }

/// <summary>
/// Gets or sets the optional login hint that will be sent to the authorization server, if applicable.
/// </summary>
public string? LoginHint { get; set; }

/// <summary>
/// Gets or sets the application-specific properties that will be added to the context.
/// </summary>
Expand Down Expand Up @@ -253,6 +264,17 @@ public sealed record class InteractiveSignOutRequest
/// </summary>
public CancellationToken CancellationToken { get; init; }

/// <summary>
/// Gets or sets the optional identity token hint that will
/// be sent to the authorization server, if applicable.
/// </summary>
public string? IdentityTokenHint { get; set; }

/// <summary>
/// Gets or sets the optional login hint that will be sent to the authorization server, if applicable.
/// </summary>
public string? LoginHint { get; set; }

/// <summary>
/// Gets or sets the application-specific properties that will be added to the context.
/// </summary>
Expand Down
4 changes: 4 additions & 0 deletions src/OpenIddict.Client/OpenIddictClientService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,9 @@ public async ValueTask<InteractiveChallengeResult> ChallengeInteractivelyAsync(I
CancellationToken = request.CancellationToken,
CodeChallengeMethod = request.CodeChallengeMethod,
GrantType = request.GrantType,
IdentityTokenHint = request.IdentityTokenHint,
Issuer = request.Issuer,
LoginHint = request.LoginHint,
Principal = new ClaimsPrincipal(new ClaimsIdentity()),
ProviderName = request.ProviderName,
RegistrationId = request.RegistrationId,
Expand Down Expand Up @@ -1399,7 +1401,9 @@ public async ValueTask<InteractiveSignOutResult> SignOutInteractivelyAsync(Inter
var context = new ProcessSignOutContext(transaction)
{
CancellationToken = request.CancellationToken,
IdentityTokenHint = request.IdentityTokenHint,
Issuer = request.Issuer,
LoginHint = request.LoginHint,
Principal = new ClaimsPrincipal(new ClaimsIdentity()),
ProviderName = request.ProviderName,
RegistrationId = request.RegistrationId,
Expand Down