< Summary

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

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\servicebus\Microsoft.Azure.ServiceBus\src\Primitives\JsonSecurityToken.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.Collections.ObjectModel;
 8    using System.IdentityModel.Tokens;
 9    using System.IdentityModel.Tokens.Jwt;
 10
 11    /// <summary>
 12    /// Extends SecurityToken for JWT specific properties
 13    /// </summary>
 14    public class JsonSecurityToken : SecurityToken
 15    {
 16        /// <summary>
 17        /// Creates a new instance of the <see cref="JsonSecurityToken"/> class.
 18        /// </summary>
 19        /// <param name="rawToken">Raw JSON Web Token string</param>
 20        /// <param name="audience">The audience</param>
 21        public JsonSecurityToken(string rawToken, string audience)
 022            : base(rawToken, GetExpirationDateTimeUtcFromToken(rawToken), audience, Constants.JsonWebTokenType)
 23        {
 024        }
 25
 26        static DateTime GetExpirationDateTimeUtcFromToken(string token)
 27        {
 028            var jwtSecurityToken = new JwtSecurityToken(token);
 029            return jwtSecurityToken.ValidTo;
 30        }
 31    }
 32}