Documentation ¶
Index ¶
- type FirebaseAuthenticationStrategy
- func (strategy FirebaseAuthenticationStrategy) CreateUser(account *businesslogic.Account) error
- func (strategy FirebaseAuthenticationStrategy) GetCurrentUser(r *http.Request) (businesslogic.Account, error)
- func (strategy FirebaseAuthenticationStrategy) GetUserByEmail(email string) (businesslogic.Account, error)
- func (strategy FirebaseAuthenticationStrategy) GetUserByUID(uid string) (businesslogic.Account, error)
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)