All Projects → brianvoe → Sjwt

brianvoe / Sjwt

Licence: mit
Simple JWT Golang

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Sjwt

Django Graphql Jwt
JSON Web Token (JWT) authentication for Graphene Django
Stars: ✭ 649 (+654.65%)
Mutual labels:  authentication, jwt, jsonwebtoken
Djwt
Create and verify JSON Web Tokens (JWT) with deno.
Stars: ✭ 93 (+8.14%)
Mutual labels:  authentication, jwt, jsonwebtoken
Hapi Auth Keycloak
JSON Web Token based Authentication powered by Keycloak
Stars: ✭ 29 (-66.28%)
Mutual labels:  authentication, jwt, jsonwebtoken
Spring Boot Jwt
JWT auth service using Spring Boot, Spring Security and MySQL
Stars: ✭ 795 (+824.42%)
Mutual labels:  authentication, jwt, jsonwebtoken
Jose
Universal "JSON Web Almost Everything" - JWA, JWS, JWE, JWT, JWK with no dependencies
Stars: ✭ 1,029 (+1096.51%)
Mutual labels:  jwt, jsonwebtoken
Paseto
Java Implementation of Platform-Agnostic Security Tokens - https://paseto.io
Stars: ✭ 32 (-62.79%)
Mutual labels:  authentication, jwt
Dashboard Server
A JSON file RESTful API with authorization based on json-server
Stars: ✭ 48 (-44.19%)
Mutual labels:  jwt, jsonwebtoken
Flask Restful Authentication
An example for RESTful authentication using nginx, uWSGI, Flask, MongoDB and JSON Web Token(JWT).
Stars: ✭ 63 (-26.74%)
Mutual labels:  authentication, jwt
Devise Jwt
JWT token authentication with devise and rails
Stars: ✭ 881 (+924.42%)
Mutual labels:  authentication, jwt
Google Auth Library Nodejs
🔑 Google Auth Library for Node.js
Stars: ✭ 1,094 (+1172.09%)
Mutual labels:  authentication, jwt
Cierge
🗝️ Passwordless OIDC authentication done right
Stars: ✭ 1,245 (+1347.67%)
Mutual labels:  authentication, jwt
Bottle Jwt
JWT Authentication Plugin for bottle.py applications.
Stars: ✭ 30 (-65.12%)
Mutual labels:  authentication, jwt
Go Alone
A simple to use, high-performance, Go (golang) MAC signer.
Stars: ✭ 82 (-4.65%)
Mutual labels:  authentication, jwt
Authentication Server
A simple authentication service to deliver JWT with Hasura claims, based on users with multiples roles stored in a Postgres database.
Stars: ✭ 48 (-44.19%)
Mutual labels:  authentication, jwt
Guardian auth
The Guardian Authentication Implementation Using Ecto/Postgresql Elixir Phoenix [ User Authentication ]
Stars: ✭ 15 (-82.56%)
Mutual labels:  simple, authentication
Ldap Jwt
Lightweight node.js based web service that provides user authentication against LDAP server (Active Directory / Windows network) credentials and returns a JSON Web Token.
Stars: ✭ 58 (-32.56%)
Mutual labels:  authentication, jwt
Codeigniter4 Auth
A simple authentication library for CodeIgniter 4.
Stars: ✭ 70 (-18.6%)
Mutual labels:  simple, authentication
Spring Boot Webflux Jjwt
Example Spring Boot and WebFlux (Reactive Web) with Spring Security and JWT for token Authentication and Authorization
Stars: ✭ 71 (-17.44%)
Mutual labels:  authentication, jwt
Angular Full Stack
Angular Full Stack project built using Angular, Express, Mongoose and Node. Whole stack in TypeScript.
Stars: ✭ 1,261 (+1366.28%)
Mutual labels:  jwt, jsonwebtoken
Emqx Auth Jwt
EMQ X JWT Authentication Plugin
Stars: ✭ 26 (-69.77%)
Mutual labels:  authentication, jwt

alt text

sjwt Go Report Card Build Status codecov.io GoDoc license

Simple JSON Web Token - Uses HMAC SHA-256

Buy Me A Coffee

Example

// Set Claims
claims := New()
claims.Set("username", "billymister")
claims.Set("account_id", 8675309)

// Generate jwt
secretKey := []byte("secret_key_here")
jwt := claims.Generate(secretKey)

Example parse

// Parse jwt
jwt := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
claims, _ := Parse(jwt)

// Get claims
name, err := claims.GetStr("name") // John Doe

Example verify and validate

jwt := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
secretKey := []byte("secret_key_here")

// Verify that the secret signature is valid
hasVerified := Verify(jwt, secretKey)

// Parse jwt
claims, _ := Parse(jwt)

// Validate will check(if set) Expiration At and Not Before At dates
err := claims.Validate()

Example usage of registered claims

// Set Claims
claims := New()
claims.SetTokenID()                                  // UUID generated
claims.SetSubject("Subject Title")                   // Subject of the token
claims.SetIssuer("Google")                           // Issuer of the token
claims.SetAudience([]string{"Google", "Facebook"})   // Audience the toke is for
claims.SetIssuedAt(time.Now())                       // IssuedAt in time, value is set in unix
claims.SetNotBeforeAt(time.Now().Add(time.Hour * 1)) // Token valid in 1 hour
claims.SetExpiresAt(time.Now().Add(time.Hour * 24))  // Token expires in 24 hours

// Generate jwt
secretKey := []byte("secret_key_here")
jwt := claims.Generate(secretKey)

Example usage of struct to claims

type Info struct {
    Name string `json:"name"`
}

// Marshal your struct into claims
info := Info{Name: "Billy Mister"}
claims, _ := ToClaims(info)

// Generate jwt
secretKey := []byte("secret_key_here")
jwt := claims.Generate(secretKey)

Why?

For all the times I have needed the use of a jwt, its always been a simple HMAC SHA-256 and thats normally the use of most jwt tokens.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].