/// <summary> /// Gets a <c>JsonWebToken</c> instance based on the values provided to the assertion. /// </summary> /// <returns>A signed <c>JsonWebToken</c> instance for presentation as a bearer token</returns> public JsonWebToken GetBearerToken() { if (m_bearerToken != null) { return(m_bearerToken); } else { var additionalClaims = new List <Claim>(this.AdditionalClaims ?? new Claim[0]); if (!String.IsNullOrEmpty(m_subject)) { additionalClaims.Add(new Claim(JsonWebTokenClaims.Subject, m_subject)); } additionalClaims.Add(new Claim(JsonWebTokenClaims.TokenId, Guid.NewGuid().ToString())); var nowUtc = DateTime.UtcNow; return(JsonWebToken.Create(m_issuer, m_audience, nowUtc, nowUtc.Add(BearerTokenLifetime), additionalClaims, m_signingCredentials)); } }