Documentation ¶
Index ¶
- Constants
- Variables
- func LoadOptions(json gjson.Result) (*options.Options, error)
- func SetLogger(log wrapper.Log)
- type OAuthProxy
- func (p *OAuthProxy) ClearSessionCookie(rw http.ResponseWriter, req *http.Request) error
- func (p *OAuthProxy) IsAllowedRequest(req *http.Request) bool
- func (p *OAuthProxy) OAuthCallback(rw http.ResponseWriter, req *http.Request)
- func (p *OAuthProxy) OAuthStart(rw http.ResponseWriter, req *http.Request)
- func (p *OAuthProxy) Proxy(rw http.ResponseWriter, req *http.Request)
- func (p *OAuthProxy) SaveSession(rw http.ResponseWriter, req *http.Request, s *sessionsapi.SessionState) error
- func (p *OAuthProxy) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (p *OAuthProxy) SetContext(ctx wrapper.HttpContext)
- func (p *OAuthProxy) SetVerifier(opts *options.Options)
- func (p *OAuthProxy) SignOut(rw http.ResponseWriter, req *http.Request)
- func (p *OAuthProxy) ValidateVerifier() error
Constants ¶
View Source
const (
SetCookieHeader = "Set-Cookie"
)
Variables ¶
View Source
var ( // ErrNeedsLogin means the user should be redirected to the login page ErrNeedsLogin = errors.New("redirect to login page") // ErrAccessDenied means the user should receive a 401 Unauthorized response ErrAccessDenied = errors.New("access denied") )
Functions ¶
Types ¶
type OAuthProxy ¶
type OAuthProxy struct { CookieOptions *options.Cookie ProxyPrefix string // contains filtered or unexported fields }
OAuthProxy is the main authentication proxy
func NewOAuthProxy ¶
func NewOAuthProxy(opts *options.Options) (*OAuthProxy, error)
NewOAuthProxy creates a new instance of OAuthProxy from the options provided
func (*OAuthProxy) ClearSessionCookie ¶
func (p *OAuthProxy) ClearSessionCookie(rw http.ResponseWriter, req *http.Request) error
ClearSessionCookie creates a cookie to unset the user's authentication cookie stored in the user's session
func (*OAuthProxy) IsAllowedRequest ¶
func (p *OAuthProxy) IsAllowedRequest(req *http.Request) bool
IsAllowedRequest is used to check if auth should be skipped for this request
func (*OAuthProxy) OAuthCallback ¶
func (p *OAuthProxy) OAuthCallback(rw http.ResponseWriter, req *http.Request)
OAuthCallback is the OAuth2 authentication flow callback that finishes the OAuth2 authentication flow
func (*OAuthProxy) OAuthStart ¶
func (p *OAuthProxy) OAuthStart(rw http.ResponseWriter, req *http.Request)
OAuthStart starts the OAuth2 authentication flow
func (*OAuthProxy) Proxy ¶
func (p *OAuthProxy) Proxy(rw http.ResponseWriter, req *http.Request)
Proxy proxies the user request if the user is authenticated else it prompts them to authenticate
func (*OAuthProxy) SaveSession ¶
func (p *OAuthProxy) SaveSession(rw http.ResponseWriter, req *http.Request, s *sessionsapi.SessionState) error
SaveSession creates a new session cookie value and sets this on the response
func (*OAuthProxy) ServeHTTP ¶
func (p *OAuthProxy) ServeHTTP(w http.ResponseWriter, req *http.Request)
func (*OAuthProxy) SetContext ¶
func (p *OAuthProxy) SetContext(ctx wrapper.HttpContext)
func (*OAuthProxy) SetVerifier ¶
func (p *OAuthProxy) SetVerifier(opts *options.Options)
func (*OAuthProxy) SignOut ¶
func (p *OAuthProxy) SignOut(rw http.ResponseWriter, req *http.Request)
SignOut sends a response to clear the authentication cookie
func (*OAuthProxy) ValidateVerifier ¶
func (p *OAuthProxy) ValidateVerifier() error
Directories ¶
Path | Synopsis |
---|---|
pkg
|
|
mapstructure
Package mapstructure exposes functionality to convert one arbitrary Go type into another, typically to convert a map[string]interface{} into a native Go structure.
|
Package mapstructure exposes functionality to convert one arbitrary Go type into another, typically to convert a map[string]interface{} into a native Go structure. |
Click to show internal directories.
Click to hide internal directories.