auth

package
v0.0.0-...-3fe7dee Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetUserID

func SetUserID(ctx context.Context, userID UserID) context.Context

SetUserID sets the user id to the context.

Types

type FirebaseAuthenticator

type FirebaseAuthenticator struct {
	// contains filtered or unexported fields
}

FirebaseAuthenticator is a authenticator for Firebase.

func NewFirebaseAuthenticator

func NewFirebaseAuthenticator(cred []byte) (*FirebaseAuthenticator, error)

func (*FirebaseAuthenticator) Authenticate

func (f *FirebaseAuthenticator) Authenticate(ctx context.Context, session string) (context.Context, error)

Authenticate returns a new context with the user ID if the session is valid.

func (*FirebaseAuthenticator) DeleteUser

func (f *FirebaseAuthenticator) DeleteUser(ctx context.Context, uid UserID) error

DeleteUser deletes the user from Firebase.

func (*FirebaseAuthenticator) GetUser

func (f *FirebaseAuthenticator) GetUser(ctx context.Context, uid UserID) (*auth.UserRecord, error)

GetUser returns the user from Firebase.

func (*FirebaseAuthenticator) SessionCookie

func (f *FirebaseAuthenticator) SessionCookie(ctx context.Context, idToken string) (string, error)

VerifyIDToken returns a new session if the ID token is valid.

type UserID

type UserID string

UserID is the identifier of the user.

func GetUserID

func GetUserID(ctx context.Context) (UserID, bool)

GetUserID returns the user id from the context.

func MustGetUserID

func MustGetUserID(ctx context.Context) UserID

MustGetUserID returns the user id from the context or panics if it's not set.

func (UserID) String

func (s UserID) String() string

Jump to

Keyboard shortcuts

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