auth

package
v0.0.0-...-2fddd97 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoginInput

type LoginInput struct {
	CompanyUsername    string `max:"16" json:"company_username"`
	EmployeeIdentifier string `max:"48" json:"employee_identifier"`
	Password           string `min:"8" json:"password"`
}

LoginInput is used as request for login

type LoginOutput

type LoginOutput struct {
	Token string `json:"token"`
}

LoginOutput is used as response for login

type ServiceAuth

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

ServiceAuth contains repositories and Auth use cases

func New

New returns the ServiceAuth service

func (*ServiceAuth) Exchange

func (s *ServiceAuth) Exchange(provider, code string) (*oauth2.Token, error)

Exchange is used to get token from provider using provider's code

func (*ServiceAuth) GenerateStateAndGetAuthURL

func (s *ServiceAuth) GenerateStateAndGetAuthURL(provider string) (string, string, error)

GenerateStateAndGetAuthURL is used to generate state and get Auth URL

func (*ServiceAuth) GetIDFromProvider

func (s *ServiceAuth) GetIDFromProvider(provider string, token *oauth2.Token) (string, error)

GetIDFromProvider is used to get ID from provider.

func (*ServiceAuth) Login

func (s *ServiceAuth) Login(li LoginInput) (*LoginOutput, int, error)

Login is used to logged in a user

Jump to

Keyboard shortcuts

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