feat(TokenDescriptorProvider): Erstellt, um eine beliebige TokenDescription auf SecurityTokenDescriptor abzubilden.
This commit is contained in:
parent
5469b20e4f
commit
2d675a16ad
@ -22,7 +22,9 @@ namespace DigitalData.Core.Security
|
|||||||
return services;
|
return services;
|
||||||
|
|
||||||
_mappingProfile.Added = true;
|
_mappingProfile.Added = true;
|
||||||
return services.AddAutoMapper(typeof(MappingProfile).Assembly);
|
return services
|
||||||
|
.AddAutoMapper(typeof(MappingProfile).Assembly)
|
||||||
|
.AddSingleton<TokenDescriptorProvider>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
19
DigitalData.Core.Security/TokenDescriptorProvider.cs
Normal file
19
DigitalData.Core.Security/TokenDescriptorProvider.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using DigitalData.Core.Security.Config;
|
||||||
|
using Microsoft.IdentityModel.Tokens;
|
||||||
|
|
||||||
|
namespace DigitalData.Core.Security
|
||||||
|
{
|
||||||
|
public class TokenDescriptorProvider
|
||||||
|
{
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
|
||||||
|
public TokenDescriptorProvider(IMapper mapper)
|
||||||
|
{
|
||||||
|
_mapper = mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SecurityTokenDescriptor Create(TokenDescription description)
|
||||||
|
=> _mapper.Map(description, new SecurityTokenDescriptor());
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user