module
Version:
v0.0.4
Opens a new window with list of versions in this module.
Published: Feb 6, 2021
License: MIT
Opens a new window with license information.
README
¶
go-oidc-middleware
A middleware for validating JWT tokens made by an OpenID Connect compliant provider
How it works
By fetching information from the discovery URL (.well-known) it can validate a JWT token sent with an Authentication header.
Middlewares
General
Relevant middleware function
NewAuthenticationMiddleware(discoveryURL url.URL) *jwtmiddleware.JWTMiddleware
Gin
Relevant middleware function
NewGinAuthenticationMiddleware(discoveryURL url.URL) *gin.HandlerFunc
Usage
import github.com/oslokommune/go-oidc-middleware/pkg/v1/middleware"
func NewRouter() *gin.Engine {
router := gin.Default()
discoveryURL, err := url.Parse("https://auth-provider.url/.well-known/openid-configuration")
if err != nil {
panic(err)
}
router.Use(middleware.NewGinAuthenticationMiddleware(*discoveryURL))
return router
}
Directories
¶
pkg
|
|
|
|
|
|
|
|
Click to show internal directories.
Click to hide internal directories.