Documentation ¶
Index ¶
Constants ¶
View Source
const TokenDuration = 25 * time.Minute
Session token's duration (5 minutes less actually)
Variables ¶
View Source
var ( ErrNoCredentials = errors.New("credentials not provided") ErrInvalidCredentials = errors.New("invalid credentials") )
Functions ¶
func Login ¶
func Login( ctx context.Context, domainURL string, creds Credentials, client *http.Client, ) (*http.Client, error)
Login function authenticates user to eclass and stores session to the client provided. After successful login, returns the http.Client.
func Session ¶
func Session( ctx context.Context, domainURL string, creds Credentials, client *http.Client, ) (*http.Client, error)
Session function authenticates user to eclass, stores session to the client provided and ensures that session will not expire. Returns the http.Client to be used, in case no client was provided.
Types ¶
type Credentials ¶
func (*Credentials) Clear ¶
func (crd *Credentials) Clear()
Clear method empties both Username & Password fields
func (Credentials) PasswordEmpty ¶
func (crd Credentials) PasswordEmpty() bool
PasswordEmpty method checks if Password is empty
func (Credentials) UsernameEmpty ¶
func (crd Credentials) UsernameEmpty() bool
UsernameEmpty method checks if Username is empty
type ErrInvalidDomain ¶
type ErrInvalidDomain struct {
DomainURL string
}
func (*ErrInvalidDomain) Error ¶
func (e *ErrInvalidDomain) Error() string
Click to show internal directories.
Click to hide internal directories.