oauth

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientStore

type ClientStore struct {
	Db *gorm.DB
}

func NewClientStore

func NewClientStore(db *gorm.DB) *ClientStore

func (*ClientStore) Create

func (s *ClientStore) Create(info oauth2.ClientInfo) error

func (*ClientStore) GetByID

func (c *ClientStore) GetByID(ctx context.Context, id string) (oauth2.ClientInfo, error)

type OauthClient

type OauthClient struct {
	ID        string `db:"id"`
	Secret    string `gorm:"type:varchar(512)"`
	Domain    string `gorm:"type:varchar(512)"`
	Data      string `gorm:"type:text"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
}

type OauthToken

type OauthToken struct {
	gorm.Model

	CreatedAt time.Time `json:"created_at"`
	ExpiresAt time.Time `json:"expires_at"`

	Code    string `gorm:"type:varchar(512)"`
	Access  string `gorm:"type:varchar(512)"`
	Refresh string `gorm:"type:varchar(512)"`
	Data    []byte `gorm:"type:text"`
}

type TokenStore

type TokenStore struct {
	Db *gorm.DB
}

func NewTokenStore

func NewTokenStore(db *gorm.DB) (*TokenStore, error)

func (*TokenStore) Create

func (ts *TokenStore) Create(ctx context.Context, info oauth2.TokenInfo) error

create and store the new token information

func (*TokenStore) GetByAccess

func (ts *TokenStore) GetByAccess(ctx context.Context, access string) (oauth2.TokenInfo, error)

use the access token for token information data

func (*TokenStore) GetByCode

func (ts *TokenStore) GetByCode(ctx context.Context, code string) (oauth2.TokenInfo, error)

use the authorization code for token information data

func (*TokenStore) GetByRefresh

func (ts *TokenStore) GetByRefresh(ctx context.Context, refresh string) (oauth2.TokenInfo, error)

use the refresh token for token information data

func (*TokenStore) RemoveByAccess

func (ts *TokenStore) RemoveByAccess(ctx context.Context, access string) error

use the access token to delete the token information

func (*TokenStore) RemoveByCode

func (ts *TokenStore) RemoveByCode(ctx context.Context, code string) error

delete the authorization code

func (*TokenStore) RemoveByRefresh

func (ts *TokenStore) RemoveByRefresh(ctx context.Context, refresh string) error

use the refresh token to delete the token information

Jump to

Keyboard shortcuts

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