Documentation
¶
Index ¶
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func GetenvOrDie(k string) string
- func MapUserNames(in []User, f mapf) []string
- func MustAsset(name string) []byte
- func NewHttpListeners(config *Configuration)
- func RenderTemplate(tpl string, data interface{}) (b []byte, err error)
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- type Auth0AuthContext
- func (c *Auth0AuthContext) GetCookieName() string
- func (c *Auth0AuthContext) GetHTTPEndpointPrefix() string
- func (c *Auth0AuthContext) GetLoginPage() ([]byte, error)
- func (c *Auth0AuthContext) GetUserName(accessToken string) string
- func (c *Auth0AuthContext) IsAccessTokenValidAndUserAuthorized(accessToken string) bool
- func (c *Auth0AuthContext) RenderHTMLFile() error
- func (c *Auth0AuthContext) ServeHTTP(w http.ResponseWriter, req *http.Request)
- type AuthenticationContext
- type Configuration
- type ConfigurationReader
- type GithubAuthContext
- func (c *GithubAuthContext) GetCookieName() string
- func (c *GithubAuthContext) GetHTTPEndpointPrefix() string
- func (c *GithubAuthContext) GetLoginPage() ([]byte, error)
- func (c *GithubAuthContext) GetUserDetailsFromGithub(accessToken string) ([]byte, error)
- func (c *GithubAuthContext) GetUserName(accessToken string) string
- func (c *GithubAuthContext) IsAccessTokenValidAndUserAuthorized(accessToken string) bool
- func (c *GithubAuthContext) ParseUserResponse(response []byte) (*GithubUser, error)
- func (c *GithubAuthContext) RenderHTMLFile() error
- func (c *GithubAuthContext) ServeHTTP(w http.ResponseWriter, req *http.Request)
- type GithubAuthRequest
- type GithubAuthResponse
- type GithubUser
- type Listener
- type Upstream
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/
foo.txt
img/
a.png
b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func GetenvOrDie ¶
GetenvOrDie is a safety wrapper around os.Getenv. This fatals if the key is unset or empty.
func MapUserNames ¶
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func NewHttpListeners ¶
func NewHttpListeners(config *Configuration)
func RenderTemplate ¶
RenderTemplate is a generic text/template render wrapper.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
Types ¶
type Auth0AuthContext ¶
type Auth0AuthContext struct {
Config *Configuration
AuthDomain string
ClientID string
ClientSecret string
CallbackURL string
ValidAccessTokens map[string]string
HTMLFile []byte
}
func NewAuth0AuthContext ¶
func NewAuth0AuthContext(config *Configuration) *Auth0AuthContext
func (*Auth0AuthContext) GetCookieName ¶
func (c *Auth0AuthContext) GetCookieName() string
func (*Auth0AuthContext) GetHTTPEndpointPrefix ¶
func (c *Auth0AuthContext) GetHTTPEndpointPrefix() string
func (*Auth0AuthContext) GetLoginPage ¶
func (c *Auth0AuthContext) GetLoginPage() ([]byte, error)
func (*Auth0AuthContext) GetUserName ¶
func (c *Auth0AuthContext) GetUserName(accessToken string) string
func (*Auth0AuthContext) IsAccessTokenValidAndUserAuthorized ¶
func (c *Auth0AuthContext) IsAccessTokenValidAndUserAuthorized(accessToken string) bool
func (*Auth0AuthContext) RenderHTMLFile ¶
func (c *Auth0AuthContext) RenderHTMLFile() error
func (*Auth0AuthContext) ServeHTTP ¶
func (c *Auth0AuthContext) ServeHTTP(w http.ResponseWriter, req *http.Request)
type AuthenticationContext ¶
type AuthenticationContext interface {
IsAccessTokenValidAndUserAuthorized(accessToken string) bool
GetUserName(accessToken string) string
GetHTTPEndpointPrefix() string
GetCookieName() string
GetLoginPage() ([]byte, error)
ServeHTTP(w http.ResponseWriter, req *http.Request)
RenderHTMLFile() error
}
type Configuration ¶
type Configuration struct {
AuthenticationContextName string `json:"authContext"`
Upstreams []Upstream `json:"upstreams"`
Users []User `json:"users"`
}
func NewConfiguration ¶
func NewConfiguration(data []byte) (*Configuration, error)
func (*Configuration) GetAuthenticationContext ¶
func (c *Configuration) GetAuthenticationContext() (cx AuthenticationContext, err error)
func (*Configuration) GetRestrictionsForUsername ¶
func (c *Configuration) GetRestrictionsForUsername(username string) string
func (*Configuration) ShouldRestrictUser ¶
func (c *Configuration) ShouldRestrictUser(username string, method string) bool
type ConfigurationReader ¶
type ConfigurationReader struct {
FileLocation string
}
func NewConfigurationReader ¶
func NewConfigurationReader(location string) *ConfigurationReader
func (*ConfigurationReader) ReadConfigurationFile ¶
func (r *ConfigurationReader) ReadConfigurationFile() ([]byte, error)
type GithubAuthContext ¶
type GithubAuthContext struct {
ClientID string
ClientSecret string
Config *Configuration
CookirName string
ValidAccessTokens map[string]string
HTMLFile []byte
}
func NewGithubAuthContext ¶
func NewGithubAuthContext(config *Configuration) *GithubAuthContext
func (*GithubAuthContext) GetCookieName ¶
func (c *GithubAuthContext) GetCookieName() string
func (*GithubAuthContext) GetHTTPEndpointPrefix ¶
func (c *GithubAuthContext) GetHTTPEndpointPrefix() string
func (*GithubAuthContext) GetLoginPage ¶
func (c *GithubAuthContext) GetLoginPage() ([]byte, error)
func (*GithubAuthContext) GetUserDetailsFromGithub ¶
func (c *GithubAuthContext) GetUserDetailsFromGithub(accessToken string) ([]byte, error)
func (*GithubAuthContext) GetUserName ¶
func (c *GithubAuthContext) GetUserName(accessToken string) string
func (*GithubAuthContext) IsAccessTokenValidAndUserAuthorized ¶
func (c *GithubAuthContext) IsAccessTokenValidAndUserAuthorized(accessToken string) bool
func (*GithubAuthContext) ParseUserResponse ¶
func (c *GithubAuthContext) ParseUserResponse(response []byte) (*GithubUser, error)
func (*GithubAuthContext) RenderHTMLFile ¶
func (c *GithubAuthContext) RenderHTMLFile() error
func (*GithubAuthContext) ServeHTTP ¶
func (c *GithubAuthContext) ServeHTTP(w http.ResponseWriter, req *http.Request)
type GithubAuthRequest ¶
type GithubAuthResponse ¶
type GithubUser ¶
type Listener ¶
type Listener struct {
Prefix string
Location string
Proxy *httputil.ReverseProxy
Hostname string
AuthContext AuthenticationContext
Config *Configuration
}
