< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
get_Audience()-0%100%
get_ExpiresAtUtc()-0%100%
get_TokenValue()-0%100%
get_TokenType()-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\servicebus\Microsoft.Azure.ServiceBus\src\Primitives\SecurityToken.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
 8    /// <summary>
 9    /// Provides information about a security token such as audience, expiry time, and the string token value.
 10    /// </summary>
 11    public class SecurityToken
 12    {
 13        /// <summary>
 14        /// Token literal
 15        /// </summary>
 16        string token;
 17
 18        /// <summary>
 19        /// Expiry date-time
 20        /// </summary>
 21        DateTime expiresAtUtc;
 22
 23        /// <summary>
 24        /// Token audience
 25        /// </summary>
 26        string audience;
 27
 28        /// <summary>
 29        /// Token type
 30        /// </summary>
 31        string tokenType;
 32
 33        /// <summary>
 34        /// Creates a new instance of the <see cref="SecurityToken"/> class.
 35        /// </summary>
 36        /// <param name="tokenString">The token</param>
 37        /// <param name="expiresAtUtc">The expiration time</param>
 38        /// <param name="audience">The audience</param>
 39        /// <param name="tokenType">The type of the token</param>
 040        public SecurityToken(string tokenString, DateTime expiresAtUtc, string audience, string tokenType)
 41        {
 042            if (string.IsNullOrEmpty(tokenString))
 43            {
 044                throw Fx.Exception.ArgumentNullOrWhiteSpace(nameof(tokenString));
 45            }
 46
 047            if (string.IsNullOrEmpty(audience))
 48            {
 049                throw Fx.Exception.ArgumentNullOrWhiteSpace(nameof(audience));
 50            }
 51
 052            this.token = tokenString;
 053            this.expiresAtUtc = expiresAtUtc;
 054            this.audience = audience;
 055            this.tokenType = tokenType;
 056        }
 57
 58        /// <summary>
 59        /// Gets the audience of this token.
 60        /// </summary>
 061        public string Audience => this.audience;
 62
 63        /// <summary>
 64        /// Gets the expiration time of this token.
 65        /// </summary>
 066        public DateTime ExpiresAtUtc => this.expiresAtUtc;
 67
 68        /// <summary>
 69        /// Gets the actual token.
 70        /// </summary>
 071        public virtual string TokenValue => this.token;
 72
 73        /// <summary>
 74        /// Gets the token type.
 75        /// </summary>
 076        public virtual string TokenType => this.tokenType;
 77    }
 78}