Documentation ¶
Index ¶
- Constants
- Variables
- func Authenticator(db *gorm.DB, provider *TokenProvider, clientId string) func(http.Handler) http.Handler
- func NewClient(insecure bool) *http.Client
- func NewContext(ctx context.Context, user *apis.User) context.Context
- func TokenFromCookie(r *http.Request) string
- func TokenFromHeader(r *http.Request) string
- func TokenFromQuery(r *http.Request) string
- func UserFromContext(ctx context.Context) (*apis.User, error)
- type CompletedConfig
- type Config
- type Options
- type Params
- type TokenGetter
- type TokenProvider
Constants ¶
View Source
const (
S256 = "S256"
)
Variables ¶
View Source
var ( UserCtxKey = &contextKey{"token"} ErrorCtxKey = &contextKey{"error"} TokenGetters = []TokenGetter{TokenFromHeader, TokenFromCookie, TokenFromQuery} )
Functions ¶
func Authenticator ¶
func TokenFromCookie ¶
func TokenFromHeader ¶
func TokenFromQuery ¶
Types ¶
type CompletedConfig ¶
type CompletedConfig struct {
// contains filtered or unexported fields
}
type Options ¶
type Options struct { ClientId string `mapstructure:"client-id"` TokenFile string `mapstructure:"token-file"` LocalAddr string `mapstructure:"local-addr"` AuthorizationServerURL string `mapstructure:"server-url"` InsecureClient bool `mapstructure:"insecure-client"` RedirectURL string }
func NewOptions ¶
func NewOptions() *Options
type TokenGetter ¶
type TokenProvider ¶
type TokenProvider struct { CompletedConfig Server *http.Server ClientContext context.Context Provider *oidc.Provider Verifier *oidc.IDTokenVerifier OAuth2Config *oauth2.Config CachedToken *tokenWrapper }
TokenProvider holds the data necessary to complete an OAuth2 auth code flow
func NewTokenProvider ¶
func NewTokenProvider(c CompletedConfig) (*TokenProvider, error)
NewTokenProvider creates a new OIDCFlow that can be used to
func (*TokenProvider) GetIdToken ¶
func (l *TokenProvider) GetIdToken() (string, error)
Click to show internal directories.
Click to hide internal directories.