コード例 #1
0
            public override async Task <ClientCertificateToken> GetToken(ClientCertificateInfo clientInfo, IHttpClientFactory clientFactory)
            {
                HttpClient httpClient = clientFactory.CreateClient(HTTP_CLIENT_NAME);

                if (!string.IsNullOrEmpty(clientInfo.AuthUrl))
                {
                    httpClient.BaseAddress = new Uri(clientInfo.AuthUrl);
                }

                var token = await _proc(clientInfo, httpClient);

                return(token);
            }
 public ClientCertificateManager(
     ClientCertificateInfo client,
     CertificateProcessor processor,
     SetTokenProcessor tokenSetter,
     CheckResponseProcessor responseChecker,
     TokenCacheManager cacheManager,
     ILogger <ClientCertificateManager> logger,
     IHttpClientFactory clientFactory)
 {
     Client           = client;
     _processor       = processor;
     _tokenSetter     = tokenSetter;
     _responseChecker = responseChecker;
     _cacheManager    = cacheManager;
     _clientFactory   = clientFactory;
     _logger          = logger;
 }
コード例 #3
0
            public override async Task <ClientCertificateToken> GetToken(ClientCertificateInfo clientInfo, IHttpClientFactory clientFactory)
            {
                Dictionary <String, string> dic = new Dictionary <string, string>()
                {
                    { "grant_type", "client_credentials" },
                    { "client_id", clientInfo.ClientID },
                    { "client_secret", clientInfo.ClientSecret }
                };
                var httpClient = clientFactory.CreateClient(HTTP_CLIENT_NAME);

                httpClient.BaseAddress = new Uri(clientInfo.AuthUrl);
                ClientCertificateToken bt = await httpClient.SubmitFormAsync <ClientCertificateToken>("/connect/token", dic);

                if (bt != null && !String.IsNullOrEmpty(bt.access_token))
                {
                    return(bt);
                }

                return(null);
            }
コード例 #4
0
 public abstract Task <ClientCertificateToken> GetToken(ClientCertificateInfo clientInfo, IHttpClientFactory clientFactory);