Ejemplo n.º 1
0
        public async Task <IdentityServer4.Models.Client> FindClientByIdAsync(string clientId)
        {
            var clientInfo = await GetInfo(clientId, true);

            if (clientInfo == null)
            {
                return(null);
            }

            // Get identity client object.
            //var listAllowedGrantTypes = await _clientAllowedGrantTypeRepository.GetByClientId(clientId);
            var listClientSecrets = await _clientSecretRepository.GetByClientId(clientId);

            //var listPostLogoutRedirectUris =
            //    await _clientPostLogoutRedirectUrisRepository.GetByClientId(clientId);
            //var listRedirectUris = await _clientRedirectUrisRepository.GetByClientId(clientId);
            //var listProperties = await _clientPropertyRepository.GetsByClientId(clientId);
            //var listClaims = await _clientClaimRepository.GetsClaimByClienId(clientId);
            //var listIdentityProviderRestriction =
            //    await _clientIdentityProviderRestrictionRepository.GetsByClientId(clientId);
            //var listAllowedCorsOrigins = await _clientAllowedCorsOriginsRepository.GetsByClientId(clientId);
            var listAllowedScope = await _clientAllowedScopesRepository.GetsByClientId(clientId);

            //return new IdentityServer4.Models.Client
            //{
            //    ClientId = "2e624d77-973b-4a70-9773-a6134597938b",
            //    AllowedGrantTypes = GrantTypes.ClientCredentials,
            //    RequireClientSecret = true,
            //    ClientSecrets =
            //    {
            //        new Secret("SG9hbmdEZXBUcmFp".Sha256())
            //    },
            //    AllowedScopes = listAllowedScope.Distinct().Select(x => x.Scope).ToList()
            //};

            //return MapToIdentityClient(clientInfo, listPostLogoutRedirectUris, listRedirectUris, listClientSecrets,
            //    listProperties, listClaims, listIdentityProviderRestriction, listAllowedCorsOrigins, listAllowedScope);
            return(MapToIdentityClient(clientInfo, new List <ClientPostLogoutRedirectUris>(), new List <ClientRedirectUris>(), listClientSecrets,
                                       new List <ClientProperty>(), new List <Domain.Models.ClientClaim>(), new List <ClientIdentityProviderRestriction>(), new List <ClientAllowedCorsOrigin>(), listAllowedScope));
        }
Ejemplo n.º 2
0
 public async Task <IEnumerable <SecretViewModel> > GetSecrets(string clientId)
 {
     return(_mapper.Map <IEnumerable <SecretViewModel> >(await _clientSecretRepository.GetByClientId(clientId)));
 }