oauth_repo

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OauthRepository

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

OauthRepository handles oauth2 database operations

func NewOauthRepository

func NewOauthRepository(db *ent.Client) *OauthRepository

NewOauthRepository creates a new repository

func (*OauthRepository) CleanTokenStore

func (self *OauthRepository) CleanTokenStore(ctx context.Context) (result error)

func (*OauthRepository) CreateAuthCode

func (self *OauthRepository) CreateAuthCode(ctx context.Context, code, clientID, scope string, user *ent.User, expiresAt time.Time) (*ent.Oauth2Code, error)

func (*OauthRepository) CreateToken

func (self *OauthRepository) CreateToken(ctx context.Context, accessToken, refreshToken, clientID, scope string, expiresAt time.Time, user *ent.User) (*ent.Oauth2Token, error)

func (*OauthRepository) DeleteAuthCode

func (self *OauthRepository) DeleteAuthCode(ctx context.Context, code string) error

func (*OauthRepository) GetAuthCode

func (self *OauthRepository) GetAuthCode(ctx context.Context, code string) (*ent.Oauth2Code, error)

func (*OauthRepository) GetByAccessToken

func (self *OauthRepository) GetByAccessToken(ctx context.Context, accessToken string) (*ent.Oauth2Token, error)

func (*OauthRepository) GetByRefreshToken

func (self *OauthRepository) GetByRefreshToken(ctx context.Context, refreshToken string) (*ent.Oauth2Token, error)

func (*OauthRepository) GetOrGenerateJWTPrivateKey

func (self *OauthRepository) GetOrGenerateJWTPrivateKey(ctx context.Context) (*rsa.PrivateKey, []byte, error)

func (*OauthRepository) RevokeAccessToken

func (self *OauthRepository) RevokeAccessToken(ctx context.Context, accessToken string) error

func (*OauthRepository) RevokeRefreshToken

func (self *OauthRepository) RevokeRefreshToken(ctx context.Context, refreshToken string) error

type OauthRepositoryInterface

type OauthRepositoryInterface interface {
	GetOrGenerateJWTPrivateKey(ctx context.Context) (*rsa.PrivateKey, []byte, error)
	CreateAuthCode(ctx context.Context, code, clientID, scope string, user *ent.User, expiresAt time.Time) (*ent.Oauth2Code, error)
	DeleteAuthCode(ctx context.Context, code string) error
	GetAuthCode(ctx context.Context, code string) (*ent.Oauth2Code, error)
	CreateToken(ctx context.Context, accessToken, refreshToken, clientID, scope string, expiresAt time.Time, user *ent.User) (*ent.Oauth2Token, error)
	RevokeAccessToken(ctx context.Context, accessToken string) error
	RevokeRefreshToken(ctx context.Context, refreshToken string) error
	GetByAccessToken(ctx context.Context, accessToken string) (*ent.Oauth2Token, error)
	GetByRefreshToken(ctx context.Context, refreshToken string) (*ent.Oauth2Token, error)
	CleanTokenStore(ctx context.Context) (result error)
}

OauthRepositoryInterface ...

Jump to

Keyboard shortcuts

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