Add project files.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// Copyright (c) Jan Škoruba. All Rights Reserved.
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using Duende.IdentityServer.Events;
|
||||
using Duende.IdentityServer.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace LiteCharmsSecurity.STS.Identity.Services
|
||||
{
|
||||
public class AuditEventSink : DefaultEventSink
|
||||
{
|
||||
public AuditEventSink(ILogger<DefaultEventService> logger) : base(logger)
|
||||
{
|
||||
}
|
||||
|
||||
public override Task PersistAsync(Event evt)
|
||||
{
|
||||
return base.PersistAsync(evt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Duende.IdentityServer.Hosting.DynamicProviders;
|
||||
using Duende.IdentityServer.Models;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using LiteCharmsSecurity.STS.Identity.Helpers;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
|
||||
namespace LiteCharmsSecurity.STS.Identity.Services;
|
||||
|
||||
public class OpenIdClaimsMappingConfig : ConfigureAuthenticationOptions<OpenIdConnectOptions, OidcProvider>
|
||||
{
|
||||
public OpenIdClaimsMappingConfig(IHttpContextAccessor httpContextAccessor, ILogger<ConfigureAuthenticationOptions<OpenIdConnectOptions, OidcProvider>> logger) : base(httpContextAccessor, logger)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Configure(ConfigureAuthenticationContext<OpenIdConnectOptions, OidcProvider> context)
|
||||
{
|
||||
var oidcProvider = context.IdentityProvider;
|
||||
|
||||
context.IdentityProvider.Properties.TryGetValue("MapInboundClaims", out var resultMapInboundClaims);
|
||||
|
||||
var mapInboundClaims = resultMapInboundClaims == null || "true".Equals(resultMapInboundClaims);
|
||||
|
||||
context.AuthenticationOptions.MapInboundClaims = mapInboundClaims;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user