-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Indented * Update packages again. * Update libs again. * Custom auth. * Custom auth settings. * Tests more stable.
- Loading branch information
1 parent
814e5bf
commit f503a13
Showing
139 changed files
with
3,008 additions
and
1,591 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
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,23 @@ | ||
// ========================================================================== | ||
// Notifo.io | ||
// ========================================================================== | ||
// Copyright (c) Sebastian Stehle | ||
// All rights reserved. Licensed under the MIT license. | ||
// ========================================================================== | ||
|
||
namespace Notifo.Domain.Apps; | ||
|
||
public sealed class AppAuthScheme | ||
{ | ||
public string Domain { get; init; } | ||
|
||
public string DisplayName { get; init; } | ||
|
||
public string ClientId { get; init; } | ||
|
||
public string ClientSecret { get; init; } | ||
|
||
public string Authority { get; init; } | ||
|
||
public string? SignoutRedirectUrl { get; init; } | ||
} |
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,19 @@ | ||
// ========================================================================== | ||
// Notifo.io | ||
// ========================================================================== | ||
// Copyright (c) Sebastian Stehle | ||
// All rights reserved. Licensed under the MIT license. | ||
// ========================================================================== | ||
|
||
namespace Notifo.Domain.Apps; | ||
|
||
public sealed class DeleteAppAuthScheme : AppCommand | ||
{ | ||
public override ValueTask<App?> ExecuteAsync(App target, IServiceProvider serviceProvider, | ||
CancellationToken ct) | ||
{ | ||
target = target with { AuthScheme = null }; | ||
|
||
return new ValueTask<App?>(target); | ||
} | ||
} |
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
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,62 @@ | ||
// ========================================================================== | ||
// Notifo.io | ||
// ========================================================================== | ||
// Copyright (c) Sebastian Stehle | ||
// All rights reserved. Licensed under the MIT license. | ||
// ========================================================================== | ||
|
||
using FluentValidation; | ||
using Notifo.Infrastructure.Validation; | ||
|
||
namespace Notifo.Domain.Apps; | ||
|
||
public sealed class UpsertAppAuthScheme : AppCommand | ||
{ | ||
public string Domain { get; init; } | ||
|
||
public string DisplayName { get; init; } | ||
|
||
public string ClientId { get; init; } | ||
|
||
public string ClientSecret { get; init; } | ||
|
||
public string Authority { get; init; } | ||
|
||
public string? SignoutRedirectUrl { get; init; } | ||
|
||
private sealed class Validator : AbstractValidator<UpsertAppAuthScheme> | ||
{ | ||
public Validator() | ||
{ | ||
RuleFor(x => x.Domain).NotNull().NotEmpty().Domain(); | ||
RuleFor(x => x.DisplayName).NotNull().NotEmpty(); | ||
RuleFor(x => x.ClientId).NotNull().NotEmpty(); | ||
RuleFor(x => x.ClientSecret).NotNull().NotEmpty(); | ||
RuleFor(x => x.Authority).NotNull().NotEmpty().Url(); | ||
RuleFor(x => x.SignoutRedirectUrl).Url(); | ||
} | ||
} | ||
|
||
public override ValueTask<App?> ExecuteAsync(App target, IServiceProvider serviceProvider, | ||
CancellationToken ct) | ||
{ | ||
Validate<Validator>.It(this); | ||
|
||
var newScheme = new AppAuthScheme | ||
{ | ||
Authority = Authority, | ||
ClientId = ClientId, | ||
ClientSecret = ClientSecret, | ||
DisplayName = DisplayName, | ||
Domain = Domain, | ||
SignoutRedirectUrl = SignoutRedirectUrl, | ||
}; | ||
|
||
if (!Equals(target.AuthScheme, newScheme)) | ||
{ | ||
target = target with { AuthScheme = newScheme }; | ||
} | ||
|
||
return new ValueTask<App?>(target); | ||
} | ||
} |
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
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
21 changes: 21 additions & 0 deletions
21
backend/src/Notifo.Identity/Dynamic/DynamicOpenIdConnectHandler.cs
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,21 @@ | ||
// ========================================================================== | ||
// Notifo.io | ||
// ========================================================================== | ||
// Copyright (c) Sebastian Stehle | ||
// All rights reserved. Licensed under the MIT license. | ||
// ========================================================================== | ||
|
||
using System.Text.Encodings.Web; | ||
using Microsoft.AspNetCore.Authentication.OpenIdConnect; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Extensions.Options; | ||
|
||
namespace Notifo.Identity.Dynamic; | ||
|
||
public sealed class DynamicOpenIdConnectHandler : OpenIdConnectHandler | ||
{ | ||
public DynamicOpenIdConnectHandler(IOptionsMonitor<DynamicOpenIdConnectOptions> options, ILoggerFactory logger, HtmlEncoder htmlEncoder, UrlEncoder encoder) | ||
: base(options, logger, htmlEncoder, encoder) | ||
{ | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
backend/src/Notifo.Identity/Dynamic/DynamicOpenIdConnectOptions.cs
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,14 @@ | ||
// ========================================================================== | ||
// Notifo.io | ||
// ========================================================================== | ||
// Copyright (c) Sebastian Stehle | ||
// All rights reserved. Licensed under the MIT license. | ||
// ========================================================================== | ||
|
||
using Microsoft.AspNetCore.Authentication.OpenIdConnect; | ||
|
||
namespace Notifo.Identity.Dynamic; | ||
|
||
public sealed class DynamicOpenIdConnectOptions : OpenIdConnectOptions | ||
{ | ||
} |
Oops, something went wrong.