Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var FirebaseCheckModule = fx.Provide( func( l *zap.Logger, sSetting FirebaseSettingParams, ) (out sfx.AuthMiddlewareResult, err error) { ctx := context.Background() c, err := firebase.NewApp(ctx, nil, option.WithCredentialsFile(sSetting.KeyFile)) if err != nil { return } client, err := c.Auth(ctx) if err != nil { return } out.AuthMiddleware = &FirebaseAuthor{ client: client, unAuthMethods: map[string]struct{}{}, } return }, )
FirebaseCheckModule is the firebase Auth module for grpc middleware
var FirebaseSettingsModule = fx.Provide( func() (out FirebaseSettingsResult, err error) { err = out.LoadFromEnv() return }, )
FirebaseSettingsModule is the Firebase settings module
var SupabaseCheckModule = fx.Provide( func( l *zap.Logger, sSetting SupabaseSettingParams, ) (out sfx.AuthMiddlewareResult, err error) { c, err := supabase.NewClient(sSetting.URL, sSetting.Key, nil) if err != nil { return } out.AuthMiddleware = &SupabaseAuthor{ client: c, unAuthMethods: map[string]struct{}{}, } return }, )
SupabaseCheckModule is the supabase Auth module for grpc middleware
var SupabaseSettingsModule = fx.Provide( func() (out SupabaseSettingsResult, err error) { err = out.LoadFromEnv() return }, )
SupabaseSettingsModule is the supabase settings module you can find them in https://app.supabase.io/project/setting/api
Functions ¶
This section is empty.
Types ¶
type FirebaseAuthor ¶
type FirebaseAuthor struct {
// contains filtered or unexported fields
}
FirebaseAuthor is auth for grpc middleware
func (*FirebaseAuthor) AddUnAuthMethod ¶
func (d *FirebaseAuthor) AddUnAuthMethod(method string)
AddUnAuthMethod add unauth method
func (*FirebaseAuthor) Auth ¶
Auth will auth every grpc request with firebase https://firebase.google.com/docs/auth/admin/verify-id-tokens NOTE: here we use firebase verifyIDToken to auth every grpc request,not to check the token has not been revoked or disabled. if you need to check the token has not been revoked please use VerifyIDTokenAndCheckRevoked to replace VerifyIDToken.
type FirebaseSettingParams ¶
FirebaseSettingParams module params for injecting FirebaseSettings
type FirebaseSettingsResult ¶
type FirebaseSettingsResult struct { fx.Out KeyFile string `name:"FirebaseKeyFile" envconfig:"FIREBASE_KEY_FILE" default:"./configs/firebase/serviceAccountKey.json"` }
FirebaseSettingsResult module result for exporting FirebaseSettings
func (*FirebaseSettingsResult) LoadFromEnv ¶
func (g *FirebaseSettingsResult) LoadFromEnv() error
LoadFromEnv load from env
type SupabaseAuthor ¶
type SupabaseAuthor struct {
// contains filtered or unexported fields
}
SupabaseAuthor is auth for grpc middleware
func (*SupabaseAuthor) AddUnAuthMethod ¶
func (d *SupabaseAuthor) AddUnAuthMethod(method string)
AddUnAuthMethod add unauth method
type SupabaseSettingParams ¶
type SupabaseSettingParams struct { fx.In URL string `name:"supabaseUrl"` Key string `name:"supabaseKey"` }
SupabaseSettingParams module params for injecting SupabaseSettings
type SupabaseSettingsResult ¶
type SupabaseSettingsResult struct { fx.Out URL string `name:"supabaseUrl" envconfig:"SUPABASE_URL" default:""` Key string `name:"supabaseKey" envconfig:"SUPABASE_KEY" default:""` }
SupabaseSettingsResult module result for exporting SupabaseSettings
func (*SupabaseSettingsResult) LoadFromEnv ¶
func (g *SupabaseSettingsResult) LoadFromEnv() error
LoadFromEnv load from env