authn

package
v0.0.0-...-be4c1b8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2020 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const AuthCookieName = "authn_cookie"
View Source
const Oauth2redirectPath = "/oauth2/redirect"

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthCookie

type AuthCookie struct {
	Username  string
	ExpiresAt time.Time
}

type Authenticator

type Authenticator struct {
	// contains filtered or unexported fields
}

func NewAuthenticator

func NewAuthenticator(config OpenIDConfig, appName string, netClient *http.Client,
	sharedSecrets []string, logger *log.Logger,
	setHeadersFunc SetHeadersFunc) *Authenticator

func (*Authenticator) GenUserCookieValue

func (a *Authenticator) GenUserCookieValue(username string, expires time.Time) (string, error)

This function is only for testing purposes, should not be used in prod

func (*Authenticator) GetRemoteUserName

func (a *Authenticator) GetRemoteUserName(w http.ResponseWriter, r *http.Request) (string, error)

func (*Authenticator) JWTClaims

func (s *Authenticator) JWTClaims(t *jwt.JSONWebToken, dest ...interface{}) (err error)

Next are the functions for checking the callback

func (*Authenticator) Oauth2RedirectPathHandler

func (a *Authenticator) Oauth2RedirectPathHandler(w http.ResponseWriter, r *http.Request)

type OpenIDConfig

type OpenIDConfig struct {
	ClientID     string `yaml:"client_id"`
	ClientSecret string `yaml:"client_secret"`
	ProviderURL  string `yaml:"provider_url"`
	AuthURL      string `yaml:"auth_url"`
	TokenURL     string `yaml:"token_url"`
	UserinfoURL  string `yaml:"userinfo_url"`
	Scopes       string `yaml:"scopes"`
}

type SetHeadersFunc

type SetHeadersFunc func(w http.ResponseWriter) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL