middlewares

package
v2.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 6 Imported by: 5

README

Middlewares

github.com/dragonfish/pkg/middlewares provides the following middlewares

Firebase auth middleware

Authenticate requests with firebase auth jwt token.

Exmaple:
package main

import (
  "net/http"

  "github.com/dragonfish/pkg/connect/middlewares"

  "connectrpc.com/authn"
  "connectrpc.com/authn/internal/gen/authn/ping/v1/pingv1connect"
)

func main() {
  mux := http.NewServeMux()
  service := &pingv1connect.UnimplementedPingServiceHandler{}
  mux.Handle(pingv1connect.NewPingServiceHandler(service))

  middleware := authn.NewMiddleware(middlewares.FirebaseAuth)
  handler := middleware.Wrap(mux)
  http.ListenAndServe("localhost:8080", handler)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirebaseAuth

func FirebaseAuth(context context.Context, req *http.Request) (any, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL