-
-
Notifications
You must be signed in to change notification settings - Fork 4
configure openid connect #809
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
Changes from all commits
8bb01b1
906d2a2
347cebb
79a028c
b37c112
6d2909c
c348d2b
493dce6
c189fb9
c01cebc
a318639
22e8864
d4940a6
c475d7b
dd593df
040eac8
aabb651
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace LexBoxApi.Auth; | ||
|
||
public class OpenIdOptions | ||
{ | ||
[Required] | ||
public required bool Enable { get; set; } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using OpenIddict.Abstractions; | ||
using OpenIddict.Server; | ||
|
||
namespace LexBoxApi.Auth; | ||
|
||
/// <summary> | ||
/// the MSAL library makes requests with the scope parameter, which is invalid, this attempts to remove the scope before it's rejected | ||
/// </summary> | ||
public sealed class ScopeRequestFixer : IOpenIddictServerHandler<OpenIddictServerEvents.ValidateTokenRequestContext> | ||
{ | ||
public static OpenIddictServerHandlerDescriptor Descriptor { get; } | ||
= OpenIddictServerHandlerDescriptor.CreateBuilder<OpenIddictServerEvents.ValidateTokenRequestContext>() | ||
.UseSingletonHandler<ScopeRequestFixer>() | ||
.SetOrder(OpenIddictServerHandlers.Exchange.ValidateResourceOwnerCredentialsParameters.Descriptor.Order + 1) | ||
.SetType(OpenIddictServerHandlerType.Custom) | ||
.Build(); | ||
|
||
public ValueTask HandleAsync(OpenIddictServerEvents.ValidateTokenRequestContext context) | ||
{ | ||
if (!string.IsNullOrEmpty(context.Request.Scope) && (context.Request.IsAuthorizationCodeGrantType() || | ||
context.Request.IsDeviceCodeGrantType())) | ||
{ | ||
context.Request.Scope = null; | ||
} | ||
|
||
return default; | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.