auth

package
v0.5.12 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auther

type Auther interface {
	CustomToken(ctx context.Context, uid string) (string, error)
	AuthenticateToken(ctx context.Context, customToken string) (string, error)
}

Auther is an auth abstraction layer interface

type Client

type Client struct{}

Client to interact with auth API

func (*Client) AuthenticateToken

func (c *Client) AuthenticateToken(ctx context.Context, customToken string) (string, error)

AuthenticateToken Verifies provided token and if valid, extracts eHRID from it.

func (*Client) CustomToken

func (c *Client) CustomToken(ctx context.Context, uid string) (string, error)

CustomToken creates a signed custom authentication token with the specified user ID. The resulting JWT can be used in a Firebase client SDK to trigger an authentication flow. See https://firebase.google.com/docs/auth/admin/create-custom-tokens#sign_in_using_custom_tokens_on_clients for more details on how to use custom tokens for client authentication.

type MockClient

type MockClient struct{}

MockClient mocks auth client functionaly for unit tests

func (*MockClient) AuthenticateToken

func (c *MockClient) AuthenticateToken(ctx context.Context, customToken string) (string, error)

AuthenticateToken Verifies provided token and if valid, extracts eHRID from it.

func (*MockClient) CustomToken

func (c *MockClient) CustomToken(uid string) (string, error)

CustomToken creates a signed custom authentication token with the specified user ID.

Jump to

Keyboard shortcuts

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