Documentation
¶
Index ¶
- func AuthAdd(r *http.Request, clientID, clientSecret string, style session.AuthHeaderStyle)
- func NewState() (string, error)
- func RemoveCookie(w http.ResponseWriter, cookie *Cookie)
- func SetBearerAuth(r *http.Request, token string)
- func SetCookie(w http.ResponseWriter, value string, cookie *Cookie)
- type Code
- func (m *Code) AuthCodeRedirectURL(r *http.Request, providerName string) (string, error)
- func (m *Code) AuthCodeURL(r *http.Request, state, providerName string, oauth2 *session.Oauth2) (string, error)
- func (m *Code) CodeToken(ctx context.Context, r *http.Request, code, providerName string, ...) ([]byte, int, error)
- func (m *Code) Init() error
- func (m *Code) RevokeToken(ctx context.Context, token string, oauth2 *session.Oauth2) error
- func (m *Code) UserInfo(ctx context.Context, token string, oauth2 *session.Oauth2) (map[string]interface{}, int, error)
- type Cookie
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthAdd ¶
func AuthAdd(r *http.Request, clientID, clientSecret string, style session.AuthHeaderStyle)
AuthAdd is a function to set Authorization header.
- Style must be AuthHeaderStyleBasic or AuthHeaderStyleBearerSecret, otherwise it does nothing.
- Default style is AuthHeaderStyleBasic.
func RemoveCookie ¶
func RemoveCookie(w http.ResponseWriter, cookie *Cookie)
func SetBearerAuth ¶
SetBearerAuth sets the Authorization header to use Bearer token.
Types ¶
type Code ¶
type Code struct {
// BaseURL is the base URL to use for the redirect.
// Default is the request Host with checking the X-Forwarded-Host header.
BaseURL string `cfg:"base_url"`
// Schema is the default schema to use for the redirect if no schema is provided.
// Default is the https schema.
Schema string `cfg:"schema"`
// Path is the path to use for the redirect.
Path string `cfg:"path"`
InsecureSkipVerify bool `cfg:"insecure_skip_verify"`
// contains filtered or unexported fields
}
func (*Code) AuthCodeRedirectURL ¶
func (*Code) AuthCodeURL ¶
func (*Code) RevokeToken ¶
type Cookie ¶
type Cookie struct {
// CookieName is the name of the cookie.
CookieName string `cfg:"cookie_name"`
// MaxAge the number of seconds until the cookie expires.
MaxAge int `cfg:"max_age"`
// Path that must exist in the requested URL for the browser to send the Cookie header.
Path string `cfg:"path"`
// Domain for defines the host to which the cookie will be sent.
Domain string `cfg:"domain"`
// Secure to cookie only sent over HTTPS.
Secure bool `cfg:"secure"`
// SameSite for Lax 2, Strict 3, None 4.
SameSite http.SameSite `cfg:"same_site"`
// HttpOnly for true for not accessible by JavaScript.
HttpOnly bool `cfg:"http_only"`
}
Click to show internal directories.
Click to hide internal directories.