firebase

package
Version: v0.0.0-...-99b79bc Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2019 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FirebaseAuthenticationStrategy

type FirebaseAuthenticationStrategy struct {
	// contains filtered or unexported fields
}

FirebaseAuthenticationStrategy implements IAuthenticationStrategy to use Firebase as the identity provider for DAS. Firebase's JWT uses RS256

func NewFirebaseAuthenticationStrategy

func NewFirebaseAuthenticationStrategy(credential string, accountRepo businesslogic.IAccountRepository) FirebaseAuthenticationStrategy

NewFirebaseAuthenticationStrategy takes the credential (service account key) file and a handler to DAS account repository and instantiate an IAuthenticationStrategy that serves as the identity provider of DAS

func (FirebaseAuthenticationStrategy) CreateUser

func (strategy FirebaseAuthenticationStrategy) CreateUser(account *businesslogic.Account) error

CreateUser assume that UID is provided, which will be used to retrieve account from Firebase. This will create a user in DAS instead of Firebase

func (FirebaseAuthenticationStrategy) GetCurrentUser

func (strategy FirebaseAuthenticationStrategy) GetCurrentUser(r *http.Request) (businesslogic.Account, error)

GetCurrentUser attempts to get the user of from the HTTP request. The HTTP request should have an authorization token in its header. If the header is not found, then an empty user and an error will be returned to the caller function

func (FirebaseAuthenticationStrategy) GetUserByEmail

func (strategy FirebaseAuthenticationStrategy) GetUserByEmail(email string) (businesslogic.Account, error)

func (FirebaseAuthenticationStrategy) GetUserByUID

func (strategy FirebaseAuthenticationStrategy) GetUserByUID(uid string) (businesslogic.Account, error)

Source Files

Jump to

Keyboard shortcuts

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