Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 3
0
        private void GetRsaPublicKeyButton_Click(object sender, RoutedEventArgs e)
        {
            var rsaPublicKey = RSAKeyGenerator.CreateNewKey(false);

            RsaPublicKey = rsaPublicKey;
        }