Documentation
¶
Index ¶
- Variables
- type Config
- type EventFunc
- type HandleFunc
- type Server
- func (srv *Server) HandleAuthResponse(hw http.ResponseWriter, hr *http.Request)
- func (srv *Server) HandleLogin(hw http.ResponseWriter, hr *http.Request)
- func (srv *Server) HandleLogout(hw http.ResponseWriter, hr *http.Request)
- func (srv *Server) Handler(name string, dot any) http.Handler
- func (srv *Server) Valid() bool
- func (srv *Server) Wrap(h http.Handler) (rh http.Handler)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInconsistentState = errors.New("oauth2 inconsistent state")
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
RedirectURL string // e.g. "https://application.example.com/oauth2/callback"
AuthURL string // e.g. "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/v2.0/authorize"
TokenURL string // e.g. "https://login.microsoftonline.com/00000000-0000-0000-0000-000000000000/oauth2/v2.0/token"
UserInfoURL string // e.g. "https://graph.microsoft.com/v1.0/me?$select=displayName,mail"
Scopes []string // e.g. []string{"user.read"}
ClientID string
ClientSecret string
}
type HandleFunc ¶
type Server ¶
type Server struct {
Jaws *jaws.Jaws
SessionKey string // default is "oauth2userinfo", value will be of type map[string]any
SessionEmailKey string // default is "email", value will be of type string
HandledPaths map[string]struct{} // URI paths we have registered handlers for
LoginEvent EventFunc // if not nil, called after a successful login
LogoutEvent EventFunc // if not nil, called before logout
// contains filtered or unexported fields
}
func (*Server) HandleAuthResponse ¶
func (srv *Server) HandleAuthResponse(hw http.ResponseWriter, hr *http.Request)
func (*Server) HandleLogin ¶
func (srv *Server) HandleLogin(hw http.ResponseWriter, hr *http.Request)
func (*Server) HandleLogout ¶
func (srv *Server) HandleLogout(hw http.ResponseWriter, hr *http.Request)
func (*Server) Handler ¶
Handler returns a http.Handler using a jaws.Template that requires an authenticated user. Sets the jaws Session value srv.SessionKey to what UserInfoURL returned.
Click to show internal directories.
Click to hide internal directories.