< Summary

Class:Microsoft.Azure.ServiceBus.Primitives.AzureActiveDirectoryTokenProvider
Assembly:Microsoft.Azure.ServiceBus
File(s):C:\Git\azure-sdk-for-net\sdk\servicebus\Microsoft.Azure.ServiceBus\src\Primitives\AzureActiveDirectoryTokenProvider.cs
Covered lines:0
Uncovered lines:8
Coverable lines:8
Total lines:39
Line coverage:0% (0 of 8)
Covered branches:0
Total branches:4
Branch coverage:0% (0 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
GetTokenAsync()-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\servicebus\Microsoft.Azure.ServiceBus\src\Primitives\AzureActiveDirectoryTokenProvider.cs

#LineLine coverage
 1// Copyright (c) Microsoft. All rights reserved.
 2// Licensed under the MIT license. See LICENSE file in the project root for full license information.
 3
 4namespace Microsoft.Azure.ServiceBus.Primitives
 5{
 6    using System;
 7    using System.Threading.Tasks;
 8
 9    /// <summary>
 10    /// Represents the Azure Active Directory token provider for the Service Bus.
 11    /// </summary>
 12    public class AzureActiveDirectoryTokenProvider : TokenProvider
 13    {
 14        readonly string authority;
 15        readonly object authCallbackState;
 16        event AuthenticationCallback AuthCallback;
 17
 18        public delegate Task<string> AuthenticationCallback(string audience, string authority, object state);
 19
 020        public AzureActiveDirectoryTokenProvider(AuthenticationCallback authenticationCallback, string authority, object
 21        {
 022            this.AuthCallback = authenticationCallback ?? throw Fx.Exception.ArgumentNull(nameof(authenticationCallback)
 023            this.authority = authority ?? throw Fx.Exception.ArgumentNull(nameof(authority));
 024            this.authCallbackState = state;
 025        }
 26
 27        /// <summary>
 28        /// Gets a <see cref="SecurityToken"/> for the given audience and duration.
 29        /// </summary>
 30        /// <param name="appliesTo">The URI which the access token applies to</param>
 31        /// <param name="timeout">The time span that specifies the timeout value for the message that gets the security 
 32        /// <returns><see cref="SecurityToken"/></returns>
 33        public override async Task<SecurityToken> GetTokenAsync(string appliesTo, TimeSpan timeout)
 34        {
 035            var tokenString = await this.AuthCallback(Constants.AadServiceBusAudience, this.authority, this.authCallback
 036            return new JsonSecurityToken(tokenString, appliesTo);
 037        }
 38    }
 39}

Methods/Properties

.ctor(...)
GetTokenAsync()