server

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewManager

func NewManager(
	cfg *configs.Auth,
	clientStore oauth2.ClientStore,
	tokenStore oauth2.TokenStore,
	accessGenerate *AccessGenerate,
) *manage.Manager

func NewServer

func NewServer(
	logger *slog.Logger,
	manager oauth2.Manager,
) *server.Server

Types

type AccessGenerate

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

func NewAccessGenerate

func NewAccessGenerate(
	tokenManager jwt.Manager,
) *AccessGenerate

func (*AccessGenerate) Token

func (g *AccessGenerate) Token(ctx context.Context, data *oauth2.GenerateBasic, isGenRefresh bool) (string, string, error)

type ClientStore

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

func NewClientStore

func NewClientStore(clientManager manager.Client) *ClientStore

func (*ClientStore) Create

func (s *ClientStore) Create(ctx context.Context, info oauth2.ClientInfo) error

func (*ClientStore) GetByID

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

type TokenStore

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

Store mysql token store

func NewTokenStore

func NewTokenStore(cfg *configs.Auth, db *gorm.DB) *TokenStore

func (*TokenStore) Close

func (s *TokenStore) Close()

Close close the store

func (*TokenStore) Create

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

Create create and store the new token information

func (*TokenStore) GetByAccess

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

GetByAccess use the access token for token information data

func (*TokenStore) GetByCode

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

GetByCode use the authorization code for token information data

func (*TokenStore) GetByRefresh

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

GetByRefresh use the refresh token for token information data

func (*TokenStore) RemoveByAccess

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

RemoveByAccess use the access token to delete the token information

func (*TokenStore) RemoveByCode

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

RemoveByCode delete the authorization code

func (*TokenStore) RemoveByRefresh

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

RemoveByRefresh use the refresh token to delete the token information

func (*TokenStore) SetStdout

func (s *TokenStore) SetStdout(stdout io.Writer) *TokenStore

SetStdout set error output

Jump to

Keyboard shortcuts

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