You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

github.com/washanhanzi/connectrpc-middleware

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/washanhanzi/connectrpc-middleware

v0.6.2
Source
Go
Version published
Created
Source

connectrpc-middleware

Go Reference

auth middleware

default jwt middleware

	//a default jwt handler
	jwtHandler := handler.NewJWTHandler(
		//add skip, before, success, error to shim()
		handler.NewShim(),
		//no extractor specified, it default to extract token from "Authorization": Bearer <token>
		//default jwt parser, the default result is jwt.MapClaims which can be retrieved by middleware.FromContext[jwt.MapClaims](ctx)
		handler.WithJwtMapClaimsParser([]byte("secret_key")),
	)
	//create new middleware
	authMiddleware, err := middleware.NewAuthMiddleware(middleware.WithHandler(jwtHandler))
	if err != nil {
		panic(err)
	}

	//...

	http.ListenAndServe(
		"localhost:8080",
		// Use h2c so we can serve HTTP/2 without TLS.
		h2c.NewHandler(authMiddleware.Wrap(mux), &http2.Server{}),
	)

TODO

  • tests for cookie
  • test for kid field

refs

FAQs

Package last updated on 12 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts