Community maintained clone of https://github.com/dgrijalva/jwt-go
Go to file
Dave Grijalva cbb3bae3aa readme 2012-07-06 16:27:42 -07:00
test almost working 2012-04-17 18:41:12 -07:00
LICENSE mit license 2012-04-18 12:02:05 -07:00
README.md readme 2012-07-06 16:27:42 -07:00
jwt.go made Keyfunc a fixed type so it could be documented more easily 2012-07-06 16:16:34 -07:00
jwt_test.go gofmt 2012-04-18 12:59:37 -07:00
rs256.go added signing support to RS256 and HS256 2012-07-06 15:43:17 -07:00
rs256_test.go added signing support to RS256 and HS256 2012-07-06 15:43:17 -07:00
sha256.go added signing support to RS256 and HS256 2012-07-06 15:43:17 -07:00
sha256_test.go added signing support to RS256 and HS256 2012-07-06 15:43:17 -07:00
signing_method.go documentation 2012-07-06 16:12:33 -07:00

README.md

A golang implementation of JSON Web Tokens

This library is still a work in progress. Feedback is appreciated. This library supports the parsing and verification as well as the generation and signing of JWTs. Current supported signing algorithms are RSA256 and HMAC SHA256.

Parse and Verify

token, err := jwt.Parse(myToken, func(token *jwt.Token)([]byte, error){
	return myLookupKey(token.Head["kid"])
})

if !err && token.Valid {
	deliverGoodness("!")
} else {
	deliverUtterRejection(":(")
}

Create a token

token := jwt.New(jwt.GetSigningMethod("HS256"))
token.Claims["foo"] = "bar"
token.Claims["exp"] = time.Now().Add(time.Hour * 72).Unix()
tokenString, err := token.SignedString(mySigningKey)