Documentation ¶
Index ¶
- Constants
- func AuthAPIKey(secret string) gin.HandlerFunc
- func AuthAppEngineCron() gin.HandlerFunc
- func AuthInternalOnly() gin.HandlerFunc
- func AuthJWT(client *fbauth.Client) gin.HandlerFunc
- func ElevateToAdmin(ctx context.Context, client *fbauth.Client, uid string) error
- func InitAuth() (*fbauth.Client, error)
- func RevokeAdmin(ctx context.Context, client *fbauth.Client, uid string) error
- func VerifyAdmin(ctx context.Context, client *fbauth.Client, uid string) error
- func VerifyToken(c *gin.Context, client *fbauth.Client) (int, string, error)
- type APIKey
- type RefreshResponse
- type RefreshToken
Constants ¶
View Source
const (
FirebaseContextVal = "FIREBASE_ID_TOKEN"
)
Variables ¶
This section is empty.
Functions ¶
func AuthAPIKey ¶
func AuthAPIKey(secret string) gin.HandlerFunc
func AuthInternalOnly ¶ added in v0.1.13
func AuthInternalOnly() gin.HandlerFunc
only allow internal ip ranges
func ElevateToAdmin ¶
add 'admin' claim to users JWT so they can perform admin actions (they still need to be authenticated with JWT)
func InitAuth ¶
load firebase configuration and create the auth client expecting env variable FIREBASE_CONFIG_FILE
func RevokeAdmin ¶
remove admin claim from users JWT so they can no longer perform admin actions
func VerifyAdmin ¶
use user id to very if user is admin or not
Types ¶
type RefreshResponse ¶ added in v0.2.0
type RefreshResponse struct { ExpiresIn string `json:"expires_in"` TokenType string `json:"token_type"` RefreshToken string `json:"refresh_token"` IDToken string `json:"id_token"` UserID string `json:"user_id"` ProjectID string `json:"project_id"` }
func RefreshFirebaseToken ¶ added in v0.2.0
func RefreshFirebaseToken(token RefreshToken, secret APIKey) (RefreshResponse, error)
type RefreshToken ¶ added in v0.3.3
type RefreshToken string
Click to show internal directories.
Click to hide internal directories.