auth

package
v0.0.0-...-4e1b13b Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartServer

func StartServer(config config.Config, done chan interface{})

StartServer starts up the little web server serving up the page needed for the authentication.

Types

type AuthCredential

type AuthCredential struct {
	IdToken     string
	AccessToken string
	Provider    string
}

type AuthData

type AuthData struct {
	User       AuthUser
	Credential AuthCredential
	Token      TokenBody
}

type AuthUser

type AuthUser struct {
	Uid             string
	DisplayName     string
	Email           string
	EmailVerified   bool
	APIKey          string
	AppName         string
	AuthDomain      string
	StsTokenManager StsTokenManager
}

type Profile

type Profile struct {
	Email          string
	FirebaseUserId string
	Id             int
	IsEnabled      bool
	IsVerified     bool
	Name           string
	PublisherId    string
}

Profile structs

type ProfileBody

type ProfileBody struct {
	HasProfile bool
	Profile    Profile
}

func FetchDeveloperProfile

func FetchDeveloperProfile(tokenBody TokenBody, developerProfileURL string) (ProfileBody, error)

FetchDeveloperProfile gets the profile of the current user from the Profile Api.

type StsTokenManager

type StsTokenManager struct {
	ApiKey         string
	RefreshToken   string
	AccessToken    string
	ExpirationTime int
}

Auth structs

type TokenBody

type TokenBody struct {
	AccessToken  string    `json:"access_token"`
	ExpiresIn    string    `json:"expires_in"`
	ExpiresAt    time.Time `json:"expires_at"`
	IdToken      string    `json:"id_token"`
	ProjectId    string    `json:"project_id"`
	RefreshToken string    `json:"refresh_token"`
	TokenType    string    `json:"token_type"`
	UserId       string    `json:"user_id"`
}

Token structs

func LoadAuthToken

func LoadAuthToken(config config.Config, logger *appixLogger.Logger) (TokenBody, error)

LoadAuthToken checks if the user is already logged in, it tries to load the locally stored Authentication token, and refreshes it. If the user is not logged in, it returns an error.

Jump to

Keyboard shortcuts

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