public virtual string WriteTokenAsString(System.IdentityModel.Tokens.SecurityToken token) { Utility.VerifyNonNullArgument("token", token); JsonWebSecurityToken jsonWebSecurityToken = token as JsonWebSecurityToken; if (jsonWebSecurityToken == null) { throw new System.ArgumentException("Unsupported token type", "token"); } if (jsonWebSecurityToken.CanWriteSourceData) { return(jsonWebSecurityToken.WriteSourceData()); } System.Collections.Generic.IDictionary <string, string> self = jsonWebSecurityToken.CreateHeaderClaims(); System.Collections.Generic.IDictionary <string, string> self2 = jsonWebSecurityToken.CreatePayloadClaims(); string text = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}.{1}", new object[] { Base64UrlEncoder.Encode(self.EncodeToJson()), Base64UrlEncoder.Encode(self2.EncodeToJson()) }); string text2 = this.Sign(text, jsonWebSecurityToken.SigningCredentials); return(string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}.{1}", new object[] { text, text2 })); }