Skip to content

Releases: BlitzkriegSoftware/JwtDotNetCoreDemo

Updated w. Tmore tests

Choose a tag to compare

@BlitzkriegSoftware BlitzkriegSoftware released this 22 Sep 02:41
  • update nugets
  • updated tests
  • better jwt defaults

Working Demo + NuGet

Choose a tag to compare

@BlitzkriegSoftware BlitzkriegSoftware released this 29 Sep 00:13

JwtDotNetCoreDemo

A small demo of creating and consuming JWT tokens in C#

Example

// Create 
var identity = new JwtIdentity("user2");

var secret = JwtHelper.MakeRandomSecret(256);
var helper = new JwtHelper(secret);

var rC = new Models.JwtCreateRequest()
{
	Identity = identity,
	Audiance = TestAudiance,
	Issuer = TestIssuer,
	Expires = new System.TimeSpan(0, 15, 0)
};

var jwt = helper.Create(rC);

// Validate

var result = helper.Validate(new Models.JwtValidationRequest()
{
	Audiance = TestAudiance,
	Issuer = TestIssuer,
	Token = jwt
});

About

Stuart Williams