-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* attempt to add openid connect support * update dotnet ef tool version * disable openId in production using a config option. This lets us figure out how to we want to do key storage in production * fix redirect loop trying to send the user to the login page, if that's handled by aspnet it'll result in a redirect loop * trim down claims check list since most aren't used, allow name claim to end up in ID token for testing purposes * correct vite proxy to send traces to the collector and not dotnet. * configure the login page to handle return urls * allow application manager to be null in seeding data to allow for case where openId is disabled * require pkce and disable implicit flow, enable oauth to work over http and with proper CORS headers * create approval flow for oauth login * correct vite proxy so https isn't used incorrectly when the backend redirects somewhere * pass redirect uri along via google login, fix bug where redirect url was always null in `CompleteGoogleLogin` due to using the wrong property. * Redesign authorize page * extract oauth code out of LoginController.cs and into OauthController.cs, revert some changes made to vite.config.ts --------- Co-authored-by: Tim Haasdyk <[email protected]>
- Loading branch information
Showing
30 changed files
with
2,392 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.