session

package
v0.0.0-...-b8a7cb5 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWTToken

type JWTToken struct {
	AccessToken      string `json:"access_token"`
	ExpiresIn        int    `json:"expires_in"`
	RefreshExpiresIn int    `json:"refresh_expires_in"`
	RefreshToken     string `json:"refresh_token"`
	TokenType        string `json:"token_type"`
	IdToken          string `json:"id_token"`
	NotBeforePolicy  int    `json:"not-before-policy"`
	SessionState     string `json:"session_state"`
	Scope            string `json:"scope"`
}

func (*JWTToken) Decode

func (token *JWTToken) Decode() (map[string]any, error)

type Session

type Session struct {
	Token      JWTToken             `json:"token" yaml:"token"`
	ExpiryTime time.Time            `json:"expiry_time" yaml:"expiry_time"`
	Resources  *resources.Resources `json:"resources,omitempty" yaml:"resources,omitempty"`
	ID         *string              `json:"id,omitempty" yaml:"id,omitempty"`
	ApiKey     *body.ApiKeyCreated  `json:"api_key,omitempty" yaml:"api_key,omitempty"`
	Cookies    []*http.Cookie       `json:"cookies,omitempty" yaml:"cookies,omitempty"`
}

func Load

func Load(filepath string) (*Session, error)

func New

func New(token JWTToken) *Session

func (*Session) IsExpired

func (s *Session) IsExpired() bool

func (*Session) RefreshAuthToken

func (s *Session) RefreshAuthToken(newToken JWTToken)

func (*Session) Save

func (s *Session) Save(filepath string) error

func (*Session) TimeUntilExpiry

func (s *Session) TimeUntilExpiry() time.Duration

Jump to

Keyboard shortcuts

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