ginfirebasemw

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: BSD-3-Clause Imports: 7 Imported by: 1

README

gin-firebase-middleware

Go Reference Go Report Card Maintainability Test Coverage

Assess firebase user info in context

Installation

go get github.com/brokeyourbike/gin-firebase-middleware

Docs

Authors

License

BSD-3-Clause License

Documentation

Index

Constants

View Source
const ProviderApple = "apple.com"
View Source
const ProviderPassword = "password"
View Source
const SecondFactorPhone = "phone"

Variables

This section is empty.

Functions

func GetUserID

func GetUserID(ctx *gin.Context) string

GetUserID returns the firebase user ID from the context.

func Middleware

func Middleware() gin.HandlerFunc

Types

type UserInfo

type UserInfo struct {
	Name          string `json:"name"`
	Sub           string `json:"sub" binding:"required"`
	Email         string `json:"email" binding:"omitempty,email"`
	EmailVerified bool   `json:"email_verified"`
	Firebase      struct {
		SignInProvider     string `json:"sign_in_provider"`
		SignInSecondFactor string `json:"sign_in_second_factor"`
	} `json:"firebase"`
}

func GetUserInfo

func GetUserInfo(ctx *gin.Context) UserInfo

GetUserInfo returns the firebase user info from the context.

func (UserInfo) IsServiceAccount added in v0.3.0

func (u UserInfo) IsServiceAccount() bool

Jump to

Keyboard shortcuts

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