Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthConfig ¶ added in v0.0.15
type AuthConfig struct { // Enable Firebase auth FirebaseEnabled bool `env:"AUTH_FIREBASE_ENABLED"` // Path to Firebase credentials JSON file FirebaseCredentialsFile string `env:"AUTH_FIREBASE_CREDENTIALS_FILE"` // Firebase credentials JSON FirebaseCredentialsJSON string `env:"AUTH_FIREBASE_CREDENTIALS_JSON"` }
type FirebaseAuth ¶
type FirebaseAuth struct {
// contains filtered or unexported fields
}
func FirebaseAuthFromContext ¶ added in v0.0.23
func FirebaseAuthFromContext(ctx context.Context) *FirebaseAuth
FirebaseAuthFromContext retrives FirebaseAuth from the current context
func NewFirebaseAuth ¶
func NewFirebaseAuth(cfg AuthConfig) FirebaseAuth
func (*FirebaseAuth) FirebaseAuthMiddleware ¶
func (a *FirebaseAuth) FirebaseAuthMiddleware() gin.HandlerFunc
FirebaseAuthMiddleware retrieves and verifies a Firebase auth token via a header or cookie and passes the token into the current context. It also adds the FirebaseAuth instance to the current context
func (*FirebaseAuth) FirebaseAuthSetUserClaims ¶
func (a *FirebaseAuth) FirebaseAuthSetUserClaims(ctx context.Context, uid string, claims map[string]interface{}) error
FirebaseAuthSetUserClaims sets the user with the passed uid's token claims. This can then be verified either with the middleware associated with this struct or with any standard JWT verification process.
Click to show internal directories.
Click to hide internal directories.