Categorygithub.com/dchahla/jwks
modulepackage
0.0.0-20240319032723-858805ff83b5
Repository: https://github.com/dchahla/jwks.git
Documentation: pkg.go.dev

# README

What?

Go implementation of jwks-rsa

How does it work?

  • Pulls modulus
  • Creates []Public Keys
  • Verifies tokens based Audience and []Public Keys

Why?

  • Same reason the node one exists. The Firebase Admin SDK is clunky just for verifying tokens. Also, versioning becomes a pain.

Basic Example

import (
	...
	"github.com/dchahla/jwks"
  	"github.com/gorilla/mux"
	"github.com/joho/godotenv"
	"github.com/rs/cors"

)

router := mux.NewRouter()
router.Use(cors.New(cors.Options{
	AllowedHeaders: []string{"Authorization", "Content-Type"},
}).Handler)

//  define audience (string)
AUDIENCE := os.Getenv("AUDIENCE")

//  cache public keys
keys := jwks.InitKeySet() 

//  set up middleware to use audience and keys
middleware := jwks.Verify(AUDIENCE, "RS256", &keys)

//  release the hounds! (apply the middleware.)
router.PathPrefix("/api/v1/app/delegation/groups").Handler(middleware(http.HandlerFunc(getGroupsHandler)))

# Functions

No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author