Пример #1
0
        private Task <TokenResponse> AuthorizeByHandshakeSecretAsync(CertificateAuthenticationResponse authResponse, IOpenIdClient openId, OpenIdAuthenticationOptions options, TimeSpan?timeout)
        {
            var request = new CertificateTokenRequest(
                cryptoProvider.Decrypt(authResponse.EncryptedKey),
                credentials.PublicKeyCertificate.Thumbprint,
                options.Scope,
                options.ClientId,
                options.ApiKey);

            return(openId.RequestTokenAsync(request, timeout));
        }
Пример #2
0
        private Task <CertificateAuthenticationResponse> AuthorizeByPublicKeyAsync(IOpenIdClient openId, OpenIdAuthenticationOptions options, TimeSpan?timeout)
        {
            var request = new CertificateAuthenticationRequest(
                credentials.PublicKeyCertificate,
                credentials.Free,
                options.ClientId,
                options.ApiKey);

            return(openId.CertificateAuthenticationAsync(request, timeout));
        }
Пример #3
0
        public async Task <TokenResponse> AuthenticateAsync(IOpenIdClient openId, OpenIdAuthenticationOptions options, TimeSpan?timeout = null)
        {
            var authResponse = await AuthorizeByPublicKeyAsync(openId, options, timeout).ConfigureAwait(false);

            return(await AuthorizeByHandshakeSecretAsync(authResponse, openId, options, timeout).ConfigureAwait(false));
        }