by
0
6
1,781
1
Top 1% !
Famous
Easy-to-find
Specified
Refined
OpenSource
Popularity: 13174th place

Published on:

InputName0webToken
InputName1signingCert
InputType0JsonWebToken
InputType1X509Certificate2
LanguageCSharp
LicenseMIT_X11
MethodNameGenerateAccessToken
OSWindows
OutputTypestring

GenerateAccessToken: Generates a serialized access token using the web token that is passed.           Bearer {Header}.{Body}.Thumbprint           All the 3 components are Base64 encoded individually.           Since a lot of cryptography is performed...

<summary>
Generates a serialized access token using the web token that is passed.
Bearer {Header}.{Body}.Thumbprint
All the 3 components are Base64 encoded individually.
Since a lot of cryptography is performed here, this function will be CPU intensive
</summary>
<param name="webToken">Json Web Security Token</param>
<param name="signingCert">Signing certificate.</param>
<returns>OAuth bearer token (self-signed).</returns>
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/286871/GenerateAccessToken--Generates-a-seriali?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
/// <summary> /// Prefix for bearer tokens. /// </summary> private const string BearerTokenPrefix = "Bearer "; #region Not for sample app /// <summary> /// Generates a serialized access token using the web token that is passed. /// Bearer {Header}.{Body}.Thumbprint /// All the 3 components are Base64 encoded individually. /// Since a lot of cryptography is performed here, this function will be CPU intensive /// </summary> /// <param name="webToken">Json Web Security Token</param> /// <param name="signingCert">Signing certificate.</param> /// <returns>OAuth bearer token (self-signed).</returns> public static string GenerateAccessToken( JsonWebToken webToken, X509Certificate2 signingCert) { return String.Format( "{0}{1}", JWTTokenHelper.BearerTokenPrefix, JWTTokenHelper.GenerateAssertion(webToken, signingCert)); }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus