19 lines
958 B
C#
19 lines
958 B
C#
using AutoMapper;
|
|
using DigitalData.Core.Security.Config;
|
|
using Microsoft.IdentityModel.Tokens;
|
|
|
|
namespace DigitalData.Core.Security
|
|
{
|
|
public static class Extension
|
|
{
|
|
/// <summary>
|
|
/// Maps a <see cref="TokenDescription"/> to a <see cref="SecurityTokenDescriptor"/>.
|
|
/// </summary>
|
|
/// <param name="mapper">The <see cref="IMapper"/> instance used for mapping.</param>
|
|
/// <param name="description">The <see cref="TokenDescription"/> instance to be mapped.</param>
|
|
/// <returns>A <see cref="SecurityTokenDescriptor"/> instance populated with the mapped values.</returns>
|
|
/// <exception cref="ArgumentNullException">Thrown if <paramref name="mapper"/> or <paramref name="description"/> is <c>null</c>.</exception>
|
|
public static SecurityTokenDescriptor Map(this IMapper mapper, TokenDescription description)
|
|
=> mapper.Map(description, new SecurityTokenDescriptor());
|
|
}
|
|
} |