public async Task <ClaimsPrincipal> TransformAsync(ClaimsPrincipal principal)
        {
            if (principal?.Identity?.Name == null || principal?.Identities?.FirstOrDefault()?.HasClaim(c => c.Type == Claims.PermissionsType) == true)
            {
                return(principal);
            }

            var userId          = principal.Identity.Name;
            var applicationName = _permissionApplicationNameProvider.ApplicationName(principal);

            var pdpResponse = await _pdpProvider.GetPermissionsAsync(userId, applicationName);

            pdpResponse?.permissions?.ToList().ForEach(permission =>
            {
                principal.Identities.First().AddClaim(new Claim(Claims.PermissionsType, permission));
            });

            return(principal);
        }
        public async Task <IActionResult> GetPermissions()
        {
            var permissions = await _policyDecisionProvider.GetPermissionsAsync(User.Identity.Name, _authOptions.ApplicationName);

            return(Ok(permissions.permissions));
        }