-
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(EF)!: remove useless specialized stores
BREAKING CHANGE: EF SchemeDefinition doesn't exist any more. ExtenalProvider is used instead. The DB schema changes
- Loading branch information
github-actions
committed
Apr 21, 2021
1 parent
ae2c3fc
commit 3b48e80
Showing
49 changed files
with
1,955 additions
and
306 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
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
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
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
44 changes: 44 additions & 0 deletions
44
src/IdentityServer/Aguacongas.IdentityServer.Admin/Filters/ExternalProviderFilter.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,44 @@ | ||
// Project: Aguafrommars/TheIdServer | ||
// Copyright (c) 2021 @Olivier Lefebvre | ||
using Aguacongas.AspNetCore.Authentication; | ||
using Aguacongas.IdentityServer.Store; | ||
using Aguacongas.IdentityServer.Store.Entity; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.Filters; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace Aguacongas.IdentityServer.Admin.Filters | ||
{ | ||
class ExternalProviderFilter : IAsyncResultFilter | ||
{ | ||
private readonly IAuthenticationSchemeOptionsSerializer _serializer; | ||
public ExternalProviderFilter(IAuthenticationSchemeOptionsSerializer serializer) | ||
{ | ||
_serializer = serializer ?? throw new ArgumentNullException(nameof(serializer)); | ||
} | ||
public Task OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next) | ||
{ | ||
var result = context.Result as ObjectResult; | ||
var value = result?.Value; | ||
if (value is PageResponse<ExternalProvider> page) | ||
{ | ||
foreach (var item in page.Items) | ||
{ | ||
SetKindName(item); | ||
} | ||
} else if (value is ExternalProvider provider) | ||
{ | ||
SetKindName(provider); | ||
} | ||
return next(); | ||
} | ||
|
||
private void SetKindName(ExternalProvider provider) | ||
{ | ||
var hanlderType = _serializer.DeserializeType(provider.SerializedHandlerType); | ||
var optionsType = hanlderType.GetAuthenticationSchemeOptionsType(); | ||
provider.KindName = optionsType.Name.Replace("Options", ""); | ||
} | ||
} | ||
} |
Oops, something went wrong.