using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;

namespace DFS.Core.Mvc.Authorize
{
    /// <summary>
    /// 权限认证处理
    /// </summary>
    public class DfsAuthorizationRequirement : IAuthorizationRequirement
    {
        /// <summary>
        /// Constructs a new instance of <see cref="DfsAuthorizationRequirement"/>.
        /// </summary>
        /// <param name="requiredName">The required name that the current user must have.</param>
        public DfsAuthorizationRequirement(string requiredName)
        {
            RequiredName = requiredName;
        }

        /// <summary>
        /// Gets the required name that the current user must have.
        /// </summary>
        public string RequiredName { get; }


        /// <inheritdoc />
        public override string ToString()
        {
            return $"{nameof(DfsAuthorizationRequirement)}:Requires a user identity with Name equal to {RequiredName}";
        }

    }
}
