Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AvatarSaver ¶
AvatarSaver defines minimal interface to save avatar
type DevAuthServer ¶
type DevAuthServer struct {
logger.L
Provider Service
Automatic bool
// contains filtered or unexported fields
}
DevAuthServer is a fake oauth server for development it provides stand-alone server running on its own port and pretending to be the real oauth2. It also provides Dev Provider the same way as normal providers do, i.e. like github, google and others. can run in interactive and non-interactive mode. In interactive mode login attempts will show login form to select desired user name, this is the mode used for development. Non-interactive mode for tests only.
func (*DevAuthServer) Run ¶
func (d *DevAuthServer) Run(ctx context.Context)
Run oauth2 dev server on port devAuthPort
type Params ¶
type Params struct {
logger.L
URL string
JwtService TokenService
AvatarSaver AvatarSaver
Cid string
Csecret string
Issuer string
}
Params to make initialized and ready to use provider
type Service ¶
type Service struct {
Params
Name string
RedirectURL string
InfoURL string
Endpoint oauth2.Endpoint
Scopes []string
MapUser func(userData, []byte) token.User // map info from InfoURL to User
// contains filtered or unexported fields
}
Service represents oauth2 provider
func (Service) Handler ¶
func (p Service) Handler(w http.ResponseWriter, r *http.Request)
Handler returns auth routes for given provider
func (Service) LogoutHandler ¶
func (p Service) LogoutHandler(w http.ResponseWriter, r *http.Request)
LogoutHandler - GET /logout
type TokenService ¶
type TokenService interface {
Parse(tokenString string) (claims token.Claims, err error)
Set(w http.ResponseWriter, claims token.Claims) error
Get(r *http.Request) (claims token.Claims, token string, err error)
Reset(w http.ResponseWriter)
}
TokenService defines interface accessing tokens