public override async ValueTask AddAuthorizationHeaderAsync(
            INameValueCollection headersCollection,
            Uri requestAddress,
            string verb,
            AuthorizationTokenType tokenType)
        {
            string token = AuthorizationTokenProviderTokenCredential.GenerateAadAuthorizationSignature(
                await this.tokenCredentialCache.GetTokenAsync(EmptyCosmosDiagnosticsContext.Singleton));

            headersCollection.Add(HttpConstants.HttpHeaders.Authorization, token);
        }
 public override async ValueTask <string> GetUserAuthorizationTokenAsync(
     string resourceAddress,
     string resourceType,
     string requestVerb,
     INameValueCollection headers,
     AuthorizationTokenType tokenType,
     CosmosDiagnosticsContext diagnosticsContext)
 {
     return(AuthorizationTokenProviderTokenCredential.GenerateAadAuthorizationSignature(
                await this.tokenCredentialCache.GetTokenAsync(diagnosticsContext)));
 }
        public override async ValueTask <(string token, string payload)> GetUserAuthorizationAsync(
            string resourceAddress,
            string resourceType,
            string requestVerb,
            INameValueCollection headers,
            AuthorizationTokenType tokenType)
        {
            string token = AuthorizationTokenProviderTokenCredential.GenerateAadAuthorizationSignature(
                await this.tokenCredentialCache.GetTokenAsync(EmptyCosmosDiagnosticsContext.Singleton));

            return(token, default);
        }
Esempio n. 4
0
        public override async ValueTask AddAuthorizationHeaderAsync(
            INameValueCollection headersCollection,
            Uri requestAddress,
            string verb,
            AuthorizationTokenType tokenType)
        {
            using (Trace trace = Trace.GetRootTrace(nameof(GetUserAuthorizationTokenAsync), TraceComponent.Authorization, TraceLevel.Info))
            {
                string token = AuthorizationTokenProviderTokenCredential.GenerateAadAuthorizationSignature(
                    await this.tokenCredentialCache.GetTokenAsync(trace));

                headersCollection.Add(HttpConstants.HttpHeaders.Authorization, token);
            }
        }
Esempio n. 5
0
 public override async ValueTask <(string token, string payload)> GetUserAuthorizationAsync(
     string resourceAddress,
     string resourceType,
     string requestVerb,
     INameValueCollection headers,
     AuthorizationTokenType tokenType)
 {
     using (Trace trace = Trace.GetRootTrace(nameof(GetUserAuthorizationTokenAsync), TraceComponent.Authorization, TraceLevel.Info))
     {
         string token = AuthorizationTokenProviderTokenCredential.GenerateAadAuthorizationSignature(
             await this.tokenCredentialCache.GetTokenAsync(trace));
         return(token, default);
     }
 }