auth

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 2 Imported by: 2

Documentation

Overview

Package auth provides contracts for authentication.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OAuthToken

type OAuthToken struct {
	AccessToken Token     `json:"access_token"`
	ExpiresAt   time.Time `json:"expires_at"`
}

OAuthToken contains all relevant information to access to the service and refresh the token.

func (OAuthToken) IsExpired

func (t OAuthToken) IsExpired(timestamp time.Time) bool

IsExpired checks whether the access token is expired or not.

type Token

type Token string

Token is an oauth2 token.

type TokenProvider

type TokenProvider interface {
	// Token provides a token.
	Token(ctx context.Context) (Token, error)
}

TokenProvider provides oauth2 token.

type TokenStorage

type TokenStorage interface {
	// Get gets OAuthToken from data source.
	Get(ctx context.Context, key string) (OAuthToken, error)
	// Set sets OAuthToken to data source.
	Set(ctx context.Context, key string, token OAuthToken) error
}

TokenStorage persists or gets OAuthToken.

Jump to

Keyboard shortcuts

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