Skip to content

auth10/SimpleWebToken

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimpleWebToken

The minimum library to handle SimpleWebTokens

Credits to @kzu and @zahmed

Usage

Install-Package Auth10.SimpleWebToken

And the simplest validation is

var validator = new SimpleWebTokenValidator 
{
	SharedKeyBase64 = "...base64key..."	
}
var swt = validator.ValidateToken(token); // this will throw an exception if the token is invalid
// if valid you can access claims with: swt.Claims

If you want to validate audience and issuer. Setting the properties will instruct the library to validate them.

var validator = new SimpleWebTokenValidator 
{
	SharedKeyBase64 = "...base64key...",
	Issuer = "issuer-identifier"  // e.g.: https://auth10.accesscontrol.windows.net	
}
validator.AllowedAudiences.Add(new Uri("http://server/myapi"));
var swt = validator.ValidateToken(token); // this will throw an exception if the token is invalid

About

The minimum library to handle SimpleWebTokens

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages