Example #1
0
        public HealthEndpointOptions(IConfiguration config)
            : base(MANAGEMENT_INFO_PREFIX, config)
        {
            if (string.IsNullOrEmpty(Id))
            {
                Id = "health";
            }

            if (RequiredPermissions == Permissions.UNDEFINED)
            {
                RequiredPermissions = Permissions.RESTRICTED;
            }

            if (Claim == null && !string.IsNullOrEmpty(Role))
            {
                Claim = new EndpointClaim
                {
                    Type  = ClaimTypes.Role,
                    Value = Role
                };
            }

            ExactMatch = false;

            AddDefaultGroups();
        }
        public bool HasClaim(EndpointClaim claim)
        {
            var user = _context.User;

            return(claim != null &&
                   user != null &&
                   user.Identity.IsAuthenticated && ((ClaimsIdentity)user.Identity).HasClaim(claim.Type, claim.Value));
        }
 public bool HasClaim(EndpointClaim claim)
 {
     return(_context != null &&
            _context.User != null &&
            claim != null && _context.User.HasClaim(claim.Type, claim.Value));
 }
Example #4
0
        public bool HasClaim(EndpointClaim claim)
        {
            var user = _owinContext.Authentication.User;

            return(user != null && claim != null && user.HasClaim(claim.Type, claim.Value));
        }