Esempio n. 1
0
        private async Task NewMethod(List <GrantViewModel> list, IdentityServer4.Models.Consent grant)
        {
            IdentityServer4.Models.Client client = await _clients.FindClientByIdAsync(grant.ClientId);

            if (client != null)
            {
                IdentityServer4.Models.Resources resources = await _resources.FindResourcesByScopeAsync(grant.Scopes);

                GrantViewModel item = new GrantViewModel()
                {
                    ClientId           = client.ClientId,
                    ClientName         = client.ClientName ?? client.ClientId,
                    ClientLogoUrl      = client.LogoUri,
                    ClientUrl          = client.ClientUri,
                    Created            = grant.CreationTime,
                    Expires            = grant.Expiration,
                    IdentityGrantNames = resources.IdentityResources.Select(x => x.DisplayName ?? x.Name).ToArray(),
                    ApiGrantNames      = resources.ApiResources.Select(x => x.DisplayName ?? x.Name).ToArray()
                };

                list.Add(item);
            }
        }
Esempio n. 2
0
 public static UserConsent ToEntity(this IdentityServer4.Models.Consent model)
 {
     return(model == null ? null : Mapper.Map <UserConsent>(model));
 }