Documentation ¶
Index ¶
- type Oauth2Wrapper
- func (wr *Oauth2Wrapper) Error(w http.ResponseWriter, r *http.Request, err error)
- func (wr *Oauth2Wrapper) HandleWrapper(prefix string) http.Handler
- func (wr *Oauth2Wrapper) Provider() string
- func (wr *Oauth2Wrapper) RedirectParams(w http.ResponseWriter, r *http.Request, isLogin bool) (res []elogin.URLParam)
- func (wr *Oauth2Wrapper) Success(w http.ResponseWriter, r *http.Request, token *elogin.Token, ...)
- type Option
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
type Option ¶
type Option func(*Oauth2Wrapper)
func WithErrorRedirectURL ¶
WithErrorRedirectURL sets the error redirect URL
func WithSessionProvider ¶
WithSessionProvider sets the session provider
func WithSocialAuthUsecase ¶
func WithSocialAuthUsecase(usecase socialauth.Usecase) Option
WithSocialAuthUsecase sets the social auth usecase
func WithSuccessRedirectURL ¶
WithSuccessRedirectURL sets the success redirect URL