コード例 #1
0
        public async Task <ClientResponse> CreateClient(string accessToken, List <string> grantTypes, List <string> redirectUris, string logoutUri, string[] allowedScopes, string organizationName, string organizationEnhId)
        {
            var clientRequest = new ClientRequest
            {
                ClientName = $"{organizationName} ({organizationEnhId})",
                Secrets    = new[]
                {
                    new Secret
                    {
                        Type  = SecretTypes.RsaPrivateKey,
                        Value = RSAKeyGenerator.CreateNewKey(false, organizationEnhId)
                    }
                },
                RequireClientSecret    = false,
                AlwaysSendClientClaims = true,
                GrantTypes             = grantTypes,
                RedirectUris           = redirectUris,
                LogoutUri     = logoutUri,
                AllowedScopes = allowedScopes,
                AllowAccessTokensViaBrowser      = true,
                AlwaysIncludeUserClaimsInIdToken = true,
                AllowOfflineAccess = true
            };

            client.SetBearerToken(accessToken);
            return(await client.StoreClient(clientRequest));
        }
コード例 #2
0
        public async Task <ClientResponse> CreateClient(string accessToken, List <string> grantTypes, List <string> redirectUris, string logoutUri, string[] allowedScopes)
        {
            var clientRequest = new ClientRequest
            {
                ClientName = "Dcr created client" + Guid.NewGuid(),
                Secrets    = new[] {
                    new Secret {
                        Type  = SecretTypes.RsaPrivateKey,
                        Value = RSAKeyGenerator.CreateNewKey(false)
                    }
                },
                RequireClientSecret    = true,
                AlwaysSendClientClaims = true,
                GrantTypes             = grantTypes,
                RedirectUris           = redirectUris,
                LogoutUri     = logoutUri,
                AllowedScopes = allowedScopes
            };

            _client.SetBearerToken(accessToken);
            return(await _client.StoreClient(clientRequest));
        }