auth

package
v0.0.0-...-18d85b2 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0, Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirebaseMiddleware

func FirebaseMiddleware(v FirebaseTokenVerifier) func(http.Handler) http.Handler

func NewContext

func NewContext(ctx context.Context, a Auth) context.Context

NewContext returns a new context that is a copy of the given context with the auth details set within. An Auth can be retrieved from the context using FromContext.

func NewFirebaseAuthClient

func NewFirebaseAuthClient(firebaseProjectID string) (*firebaseauth.Client, error)

func SEP10Middleware

func SEP10Middleware(issuer string, ks jose.JSONWebKeySet) func(http.Handler) http.Handler

SEP10Middleware provides middleware for handling an authentication SEP-10 JWT.

Types

type Auth

type Auth struct {
	Address     string
	PhoneNumber string
	Email       string
}

Auth holds a set of details that have been authenticated about a client.

func FromContext

func FromContext(ctx context.Context) (Auth, bool)

FromContext returns auth details that are stored in the context.

type FirebaseTokenVerifier

type FirebaseTokenVerifier interface {
	Verify(r *http.Request) (*firebaseauth.Token, bool)
}

type FirebaseTokenVerifierFunc

type FirebaseTokenVerifierFunc func(r *http.Request) (*firebaseauth.Token, bool)

func (FirebaseTokenVerifierFunc) Verify

type FirebaseTokenVerifierLive

type FirebaseTokenVerifierLive struct {
	AuthClient *firebaseauth.Client
}

func (FirebaseTokenVerifierLive) Verify

Jump to

Keyboard shortcuts

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