auth

package
v0.0.0-...-5fd49c5 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const LantmaterietURL = "https://api.lantmateriet.se"

Variables

This section is empty.

Functions

func NewNetClient

func NewNetClient() *http.Client

Types

type Lantmateriet

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

func NewLantmateriet

func NewLantmateriet(opts ...LantmaterietOption) *Lantmateriet

func (*Lantmateriet) GetToken

func (l *Lantmateriet) GetToken() (*Token, error)

func (*Lantmateriet) RefreshToken

func (l *Lantmateriet) RefreshToken(token *Token) (*Token, error)

func (*Lantmateriet) RevokeToken

func (l *Lantmateriet) RevokeToken(token *Token) error

type LantmaterietOption

type LantmaterietOption = func(l *Lantmateriet)

func WithClient

func WithClient(client NetClient) LantmaterietOption

func WithConsumerID

func WithConsumerID(id string) LantmaterietOption

func WithConsumerKey

func WithConsumerKey(key string) LantmaterietOption

func WithURL

func WithURL(url string) LantmaterietOption

type NetClient

type NetClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type Token

type Token struct {
	AccessToken string        `json:"access_token"`
	ExpiresAt   time.Time     `json:"expires_at"`
	ExpiresIn   time.Duration `json:"expires_in"`
}

type TokenService

type TokenService interface {
	RevokeToken(token *Token) error
	RefreshToken(token *Token) (*Token, error)
	GetToken() (*Token, error)
}

Jump to

Keyboard shortcuts

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