Documentation ¶
Index ¶
- Constants
- type Server
- func (s *Server) ClientInfoHandler(r *http.Request) (clientID, clientSecret string, err error)
- func (s *Server) HandleAuthorizeRequest(w http.ResponseWriter, r *http.Request)
- func (s *Server) HandleRevoke(w http.ResponseWriter, r *http.Request)
- func (s *Server) HandleTokenRequest(w http.ResponseWriter, r *http.Request)
- func (s *Server) HandleValidate(w http.ResponseWriter, r *http.Request)
- func (s *Server) HasBearer(r *http.Request) bool
- func (s *Server) HasCookie(r *http.Request) bool
- func (s *Server) UserAuthorizationHandler(_ http.ResponseWriter, r *http.Request) (userID string, err error)
- func (s *Server) Validate(ctx context.Context, r *http.Request) (context.Context, oauth2.TokenInfo, *http.Cookie, error)
- type Token
Constants ¶
const AuthHeaderName = "Authorization"
const CookieName = "highlightOAuth"
const CookieRefreshThreshold = 15 * time.Minute
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func CreateServer ¶
func (*Server) ClientInfoHandler ¶
ClientInfoHandler provides the clientID and clientSecret based on the request. The data either exists in the `Authorization` header or in a query parameter for SPAs where the secret must be retrieved from our database.
func (*Server) HandleAuthorizeRequest ¶
func (s *Server) HandleAuthorizeRequest(w http.ResponseWriter, r *http.Request)
HandleAuthorizeRequest will process a request for oauth /authorize command per the RFC spec.
func (*Server) HandleRevoke ¶
func (s *Server) HandleRevoke(w http.ResponseWriter, r *http.Request)
HandleRevoke will revoke the oauth token for header or cookie authentication.
func (*Server) HandleTokenRequest ¶
func (s *Server) HandleTokenRequest(w http.ResponseWriter, r *http.Request)
HandleTokenRequest will process a request for oauth /token command per the RFC spec.
func (*Server) HandleValidate ¶
func (s *Server) HandleValidate(w http.ResponseWriter, r *http.Request)
HandleValidate will ensure the request authorization is valid and return oauth session metadata.
func (*Server) UserAuthorizationHandler ¶
func (s *Server) UserAuthorizationHandler(_ http.ResponseWriter, r *http.Request) (userID string, err error)
UserAuthorizationHandler provides the user ID for further `model.Admin` resolution based on the firebase session. This method is used during the OAuth token creation to associate a token with the firebase user.
func (*Server) Validate ¶
func (s *Server) Validate(ctx context.Context, r *http.Request) (context.Context, oauth2.TokenInfo, *http.Cookie, error)
Validate ensures the request is authenticated and configures the context to contain necessary authorization context variables. the function returns the auth token cookie, refreshed if applicable.