handlers

package
v0.0.0-...-d4b8dfd Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeHomepageHandler

func MakeHomepageHandler(config *Config) func(http.ResponseWriter, *http.Request)

MakeHomepageHandler shows the homepage

func MakeLoginHandler

func MakeLoginHandler(config *Config) func(http.ResponseWriter, *http.Request)

MakeLoginHandler creates a handler for logging in

func MakeOAuth2Handler

func MakeOAuth2Handler(config *Config) func(http.ResponseWriter, *http.Request)

MakeOAuth2Handler makes a handler for OAuth 2.0 redirects

func MakeQueryHandler

func MakeQueryHandler(config *Config, protected []string) func(http.ResponseWriter, *http.Request)

MakeQueryHandler returns whether a client can access a resource

Types

type Config

type Config struct {
	OAuthProvider          string
	OAuthProviderBaseURL   string
	ClientID               string
	ClientSecret           string
	OAuthClientSecretPath  string // OAuthClientSecretPath when given overrides the ClientSecret env-var
	ExternalRedirectDomain string
	Scope                  string
	CookieRootDomain       string
	CookieExpiresIn        time.Duration
	PublicKeyPath          string
	PrivateKeyPath         string
	Debug                  bool // Debug enables verbose logging of claims / cookies
}

type Customers

type Customers struct {
	Usernames *map[string]string
	Sync      *sync.Mutex
	Expires   time.Time
}

Customers checks whether users are customers of OpenFaaS Cloud

func NewCustomers

func NewCustomers() *Customers

NewCustomers creates a Customers instance

func (*Customers) Fetch

func (c *Customers) Fetch() error

Fetch refreshes cache of customers which is valid for `customerCacheExpiry` duration.

func (*Customers) Get

func (c *Customers) Get(login string) (bool, error)

Get returns whether a customer is found

type HomepageTokens

type HomepageTokens struct {
	AccessToken string
	Login       string
}

type OpenFaaSCloudClaims

type OpenFaaSCloudClaims struct {
	// Name is the full name of the user for OIDC
	Name string `json:"name"`

	// AccessToken for use with the GitHub Profile API
	AccessToken string `json:"access_token"`

	// String with all organizations separated with commas
	Organizations string `json:"organizations"`

	// Inherit from standard claims
	jwt.StandardClaims
}

OpenFaaSCloudClaims extends standard claims

type Organization

type Organization struct {
	Login string `json:"login"`
}

type ProviderAccessToken

type ProviderAccessToken struct {
	AccessToken string `json:"access_token"`
}

ProviderAccessToken as issued by GitHub or GitLab

Jump to

Keyboard shortcuts

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