oauth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResponseTypeCode           = "code"
	GrantTypeAuthorizationCode = "authorization_code"
	GrantTypeRefreshToken      = "refresh_token"
)

Variables

View Source
var (
	ErrUnauthorized        = errors.New("unauthorized")
	ErrForbidden           = errors.New("forbidden")
	ErrClientNotFound      = errors.New("client not found")
	ErrUserNotFound        = errors.New("user not found")
	ErrTokenNotFound       = errors.New("token not found")
	ErrSessionNotFound     = errors.New("session not found")
	ErrInvalidUserPassword = errors.New("invalid user password")
	ErrInvalidResponseType = errors.New("invalid response type")
	ErrInvalidRedirectUri  = errors.New("invalid redirect uri")
)

Functions

This section is empty.

Types

type InputAuthorizeByCode

type InputAuthorizeByCode struct {
	ClientId     string
	ResponseType string
	RedirectUri  string
	State        string
	Login        string
	Password     string
	UserIP       string
	UserAgent    string
}

type InputAuthorizeBySession

type InputAuthorizeBySession struct {
	ClientId     string
	ResponseType string
	RedirectUri  string
	State        string
	SessionId    string
}

type InputAuthorizeParams

type InputAuthorizeParams struct {
	ClientId     string
	ResponseType string
	RedirectUri  string
}

type InputForgotPassword

type InputForgotPassword struct {
	ClientId    string
	RedirectUri string
	Query       string
	Login       string
	IP          string
	Agent       string
}

type InputResetPassword

type InputResetPassword struct {
	Hash     string
	Password string
}

type InputTokenByCode

type InputTokenByCode struct {
	ClientId     string
	ClientSecret string
	Code         string
}

type InputTokenByRefresh

type InputTokenByRefresh struct {
	ClientId     string
	ClientSecret string
	Refresh      string
}

type OAuth

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

func NewOAuth

func NewOAuth(repo *repository.Repository, tm repository.Transaction, token *token.Token, mailing *mailing.Mailing) *OAuth

func (*OAuth) AuthorizeByCode

func (s *OAuth) AuthorizeByCode(ctx context.Context, inp InputAuthorizeByCode) (*entity.Client, *entity.Token, *url.URL, error)

func (*OAuth) AuthorizeBySession

func (s *OAuth) AuthorizeBySession(ctx context.Context, inp InputAuthorizeBySession) (*entity.Client, *entity.Token, *url.URL, error)

func (*OAuth) AuthorizeCheckParams

func (s *OAuth) AuthorizeCheckParams(ctx context.Context, inp InputAuthorizeParams) (*entity.Client, error)

func (*OAuth) ForgotPassword

func (s *OAuth) ForgotPassword(ctx context.Context, inp InputForgotPassword) error

func (*OAuth) ResetPassword

func (s *OAuth) ResetPassword(ctx context.Context, inp InputResetPassword) (*url.URL, error)

func (*OAuth) TokenByCode

func (s *OAuth) TokenByCode(ctx context.Context, inp InputTokenByCode) (*entity.Token, *entity.Token, error)

func (*OAuth) TokenByRefresh

func (s *OAuth) TokenByRefresh(ctx context.Context, inp InputTokenByRefresh) (*entity.Token, *entity.Token, error)

func (*OAuth) ValidateAccessToken

func (s *OAuth) ValidateAccessToken(ctx context.Context, token string) (*token.AccessClaims, error)

func (*OAuth) ValidateForgotToken

func (s *OAuth) ValidateForgotToken(ctx context.Context, token string) (*entity.Token, *entity.Client, error)

func (*OAuth) ValidateRefreshToken

func (s *OAuth) ValidateRefreshToken(ctx context.Context, token string) (*entity.Token, error)

Jump to

Keyboard shortcuts

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