rest

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Oauth2Wrapper

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

Oauth2Wrapper provides a wrapper for oauth2 authentication

func NewWrapper

func NewWrapper(auth elogin.AuthAccessor, options ...Option) *Oauth2Wrapper

NewWrapper creates a new instance of Oauth2Wrapper

func (*Oauth2Wrapper) Error

func (wr *Oauth2Wrapper) Error(w http.ResponseWriter, r *http.Request, err error)

Error handles the error occurred during the oauth2 authentication

func (*Oauth2Wrapper) HandleWrapper

func (wr *Oauth2Wrapper) HandleWrapper(prefix string) http.Handler

HandleWrapper returns the http handler which handles the oauth2 authentication endpoints like /login and /callback with the given prefix

func (*Oauth2Wrapper) Provider

func (wr *Oauth2Wrapper) Provider() string

Provider returns the provider name

func (*Oauth2Wrapper) RedirectParams

func (wr *Oauth2Wrapper) RedirectParams(w http.ResponseWriter, r *http.Request, isLogin bool) (res []elogin.URLParam)

RedirectParams returns the redirect parameters for the oauth2 authentication default redirect URL

func (*Oauth2Wrapper) Success

func (wr *Oauth2Wrapper) Success(w http.ResponseWriter, r *http.Request, token *elogin.Token, userData *elogin.UserData)

Success handles the success of the oauth2 authentication

type Option

type Option func(*Oauth2Wrapper)

func WithErrorRedirectURL

func WithErrorRedirectURL(url string) Option

WithErrorRedirectURL sets the error redirect URL

func WithSessionProvider

func WithSessionProvider(provider *jwt.Provider) Option

WithSessionProvider sets the session provider

func WithSocialAuthUsecase

func WithSocialAuthUsecase(usecase socialauth.Usecase) Option

WithSocialAuthUsecase sets the social auth usecase

func WithSuccessRedirectURL

func WithSuccessRedirectURL(url string) Option

WithSuccessRedirectURL sets the success redirect URL

Jump to

Keyboard shortcuts

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