Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FirebaseAuthVerifier ¶
type FirebaseAuthVerifier interface {
// Set custom logger.
SetLogger(logger *Logger)
// Support Original JWT Token.
// sub = your GCP Project
// default = deny.
AcceptOriginalToken()
// Verify Firebase Auth token.
// supported)
// - JWT: Firebase Custom Token source
// - JWT: Firebase Auth Token
// see) https://firebase.google.com/docs/auth/android/custom-auth?hl=en
Verify(ctx context.Context, token string) (*VerifiedFirebaseAuthToken, error)
}
Verifier for Firebase Auth token.
type FirebaseUser ¶
type FirebaseUser struct {
/*
Firebase user id.
*/
Id string
}
func (*FirebaseUser) String ¶
func (it *FirebaseUser) String() string
type GoogleApiKeyVerifier ¶
type GoogleApiKeyVerifier interface {
// Set custom logger.
SetLogger(logger *Logger)
// Set custom service name for 'Service Control' check API.
// Default is 'your-gcp-name.appspot.com'
// https://cloud.google.com/service-infrastructure/docs/service-control/getting-started?hl=en
SetServiceName(serviceName string)
// Verify your API Key.
Verify(ctx context.Context, apiKey string) error
}
Google Cloud Platform API Key verify.
type SecurityContext ¶
type SecurityContext interface {
// Returns Firebase auth based JWT verifier.
//
// see)
// - https://firebase.google.com/docs/auth?hl=en
// - https://github.com/firebase/firebase-admin-go/tree/master/auth
NewFirebaseAuthVerifier() FirebaseAuthVerifier
// Returns Google API Key verifier.
// see)
// - https://cloud.google.com/docs/authentication/api-keys?hl=en
NewGoogleApiKeyVerifier() GoogleApiKeyVerifier
}
func NewSecurityContext ¶
func NewSecurityContext(ctx context.Context, configs *SecurityContextConfigs) (SecurityContext, error)
New instance.
type SecurityContextConfigs ¶
type SecurityContextConfigs struct {
/*
Custom logger.
*/
Logger *Logger
/*
Custom GCP service account's json file.
If this value is nil, then load from 'GOOGLE_APPLICATION_CREDENTIALS'.
see) https://cloud.google.com/docs/authentication/getting-started?hl=en
*/
GoogleServiceAccountJson []byte
}
logger function
type VerifiedFirebaseAuthToken ¶
type VerifiedFirebaseAuthToken struct {
/*
Authorize user.
*/
User *FirebaseUser
/*
Token expire time.
*/
ExpireAt time.Time
/*
JWT Claims.
*/
Claims map[string]interface{}
}
Verified JWT Data.
func (*VerifiedFirebaseAuthToken) GetFloatClaim ¶
func (it *VerifiedFirebaseAuthToken) GetFloatClaim(key string) (float64, error)
func (*VerifiedFirebaseAuthToken) GetIntClaim ¶
func (it *VerifiedFirebaseAuthToken) GetIntClaim(key string) (int64, error)
func (*VerifiedFirebaseAuthToken) GetStringClaim ¶
func (it *VerifiedFirebaseAuthToken) GetStringClaim(key string) (string, error)
Source Files
¶
- firebase_auth_verifier.go
- firebase_auth_verifier_impl.go
- firebase_user.go
- google_api_key_verifier.go
- google_api_key_verifier_impl.go
- google_public_key.go
- google_public_key_cache.go
- internal_utils.go
- logger.go
- security_context.go
- security_context_configs.go
- security_context_impl.go
- valid_google_api_key.go
- verified_firebase_auth_token.go
Click to show internal directories.
Click to hide internal directories.