mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.2 KiB
46 lines
1.2 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Security.Claims;
|
|
using Microsoft.AspNetCore.Identity;
|
|
using Squidex.Shared.Users;
|
|
|
|
namespace Squidex.Domain.Users
|
|
{
|
|
internal sealed class UserWithClaims : IUser
|
|
{
|
|
public IdentityUser Identity { get; }
|
|
|
|
public string Id
|
|
{
|
|
get => Identity.Id;
|
|
}
|
|
|
|
public string Email
|
|
{
|
|
get => Identity.Email;
|
|
}
|
|
|
|
public bool IsLocked
|
|
{
|
|
get => Identity.LockoutEnd > DateTime.UtcNow;
|
|
}
|
|
|
|
public IReadOnlyList<Claim> Claims { get; }
|
|
|
|
object IUser.Identity => Identity;
|
|
|
|
public UserWithClaims(IdentityUser user, IReadOnlyList<Claim> claims)
|
|
{
|
|
Identity = user;
|
|
|
|
Claims = claims;
|
|
}
|
|
}
|
|
}
|
|
|