Documentation
¶
Index ¶
- Constants
- Variables
- func FuncMap() template.FuncMap
- func JoinPaths(p1 string, ps ...string) string
- func TplHasIntersection(lists ...interface{}) bool
- func TplIntersection(lists ...interface{}) interface{}
- func WithTrailingSlash(p string) string
- func WithoutTrailingSlash(p string) string
- type Address
- type CertificateFromPath
- type PolicyContext
- type ProxyConfig
- type ProxyHTTPConfig
- type ProxyMLFlowConfig
- type ProxyMLFlowTenant
- type ProxyOIDCConfig
- type ProxyOptions
- type ProxyRobotConfig
- type ProxyState
- func (p *ProxyState) Authorize(req *http.Request, tenant *ProxyMLFlowTenant, token *jwt.Token) (string, error)
- func (p *ProxyState) EnforceUserTagsAndFields(w http.ResponseWriter, req *http.Request, path string, requestID string, ...) (rejectMsg string, err error)
- func (p *ProxyState) EnsureRequestID(w http.ResponseWriter, req *http.Request) string
- func (p *ProxyState) EnsureToken(w http.ResponseWriter, req *http.Request, requestID string) *jwt.Token
- func (p *ProxyState) GetSubject(token *jwt.Token) (string, error)
- func (p *ProxyState) Home(w http.ResponseWriter, req *http.Request, requestID string, token *jwt.Token)
- func (p *ProxyState) InternalError(w http.ResponseWriter, req *http.Request, requestID string, msg string, ...)
- func (p *ProxyState) ListenAndServe() error
- func (p *ProxyState) MergeURLs(dest, src *url.URL)
- func (p *ProxyState) MutateRequest(w http.ResponseWriter, req *http.Request, path string, requestID string, ...) (rejectMsg string, err error)
- func (p *ProxyState) Proxy(w http.ResponseWriter, r *http.Request, requestID string, token *jwt.Token)
- func (p *ProxyState) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (p *ProxyState) ValidateRequest(w http.ResponseWriter, req *http.Request, requestID string, token *jwt.Token) (tenant *ProxyTenantState, path string, err error)
- type ProxyTLSConfig
- type ProxyTenantState
- type Robot
- type SecretTokenFromPath
- type Template
- type TokenFromClaims
- type URL
Constants ¶
View Source
const ( // DefaultPolicy is the default value for the config oidc.policy field. // It assumes the user is using keycloak in a default configuration and checks if the requested tenant ID appears in the users realm roles DefaultPolicy = ` {{- if not (has .Tenant.ID .Token.Claims.realm_access.roles) }} Forbidden: You are not part of this tenant {{- end }} ` DefaultGetSubject = `{{ .Token.Claims.preferred_username }}` // DefaultAddress is the default value of the config http.address field. // It listens on localhost only on port 8088. DefaultAddress = "127.0.0.1:8088" // DefaultTenantsPath is the default value of the config http.tenantsPath field. // It assuems tenant servers have --static-prefix=tenants/${tenant_id} DefaultTenantsPath = "/tenants/" // DefaultAccessTokenHeader is the default value of the config oidc.tokenHeader. // It assumes the server is being proxied by the OAuth2Proxy (https://github.com/oauth2-proxy/oauth2-proxy/) with --pass-access-token DefaultTokenHeader = "X-Forwarded-Access-Token" // DefaulTokenMode is the default value of the config oidc.tokenMode. DefaultTokenMode = gotoken.TokenModeRaw // DefaultCerificate header is the default value of the config robots.certificateHeader DefaultCertificateHeader = "Ssl-Client-Cert" )
View Source
const ( MLFlowUserTag = "mlflow.user" MLFlowUserIDField = "user_id" MLFlowTagsField = "tags" MLFlowCreateExperimentPath = "2.0/mlflow/experiments/create" MLFlowCreateRunPath = "2.0/mlflow/runs/create" MLFlowCreateRegisteredModelPath = "2.0/mlflow/registered-models/create" MLFlowCreateModelVersionPath = "2.0/mlflow/model-versions/create" MLFlowSetTagExperimentPath = "2.0/mlflow/experiments/set-experiment-tag" MLFlowSetTagRunPath = "2.0/mlflow/runs/set-tag" MLFlowSetTagRegisteredModelPath = "2.0/mlflow/registered-models/set-tag" MLFlowSetTagModelVersionPath = "2.0/mlflow/model-versions/set-tag" MLFlowDeleteTagRunPath = "2.0/mlflow/runs/delete-tag" MLFlowDeleteTagRegisteredModelPath = "2.0/mlflow/registered-models/delete-tag" MLFlowDeleteTagModelVersionPath = "2.0/mlflow/model-versions/delete-tag" MLFlowAPIPrefix = "api/" MLFlowAJAXPrefix = "ajax-api/" )
Variables ¶
View Source
var ( ParsedDefaultPolicy Template ParsedDefaultGetSubject Template ParsedDefaultAddress Address )
View Source
var (
HomePage *template.Template
)
Functions ¶
func TplHasIntersection ¶
func TplHasIntersection(lists ...interface{}) bool
func TplIntersection ¶
func TplIntersection(lists ...interface{}) interface{}
func WithTrailingSlash ¶
func WithoutTrailingSlash ¶
Types ¶
type CertificateFromPath ¶
type CertificateFromPath struct {
Raw string
PEM string
Inner *x509.Certificate
}
func (*CertificateFromPath) UnmarshalJSON ¶
func (c *CertificateFromPath) UnmarshalJSON(bytes []byte) error
type PolicyContext ¶
type PolicyContext struct {
Tenant *ProxyMLFlowTenant
Token *jwt.Token
Request *http.Request
ExtraVariables interface{}
}
type ProxyConfig ¶
type ProxyConfig struct {
OIDC ProxyOIDCConfig `json:"oidc"`
MLFlow ProxyMLFlowConfig `json:"mlflow"`
HTTP ProxyHTTPConfig `json:"http"`
TLS ProxyTLSConfig `json:"tls"`
Robots ProxyRobotConfig `json:"robots"`
}
func (*ProxyConfig) ApplyDefaults ¶
func (p *ProxyConfig) ApplyDefaults() (err error)
func (*ProxyConfig) Init ¶
func (p *ProxyConfig) Init() *ProxyConfig
type ProxyHTTPConfig ¶
type ProxyMLFlowConfig ¶
type ProxyMLFlowConfig struct {
Tenants []ProxyMLFlowTenant `json:"tenants"`
}
type ProxyMLFlowTenant ¶
type ProxyOIDCConfig ¶
type ProxyOptions ¶
type ProxyRobotConfig ¶
type ProxyState ¶
type ProxyState struct {
Config *ProxyConfig
Tenants map[string]*ProxyTenantState
BaseURL *url.URL
*http.ServeMux
Log *log.Logger
GetToken gotoken.TokenGetter
HomeURL string
BasePath string
TenantsPath string
LongHealthPath string
}
func NewProxy ¶
func NewProxy(config ProxyConfig, opts ProxyOptions) (*ProxyState, error)
func (*ProxyState) Authorize ¶
func (p *ProxyState) Authorize(req *http.Request, tenant *ProxyMLFlowTenant, token *jwt.Token) (string, error)
func (*ProxyState) EnforceUserTagsAndFields ¶
func (*ProxyState) EnsureRequestID ¶
func (p *ProxyState) EnsureRequestID(w http.ResponseWriter, req *http.Request) string
func (*ProxyState) EnsureToken ¶
func (p *ProxyState) EnsureToken(w http.ResponseWriter, req *http.Request, requestID string) *jwt.Token
func (*ProxyState) GetSubject ¶
func (p *ProxyState) GetSubject(token *jwt.Token) (string, error)
func (*ProxyState) Home ¶
func (p *ProxyState) Home(w http.ResponseWriter, req *http.Request, requestID string, token *jwt.Token)
func (*ProxyState) InternalError ¶
func (p *ProxyState) InternalError(w http.ResponseWriter, req *http.Request, requestID string, msg string, err error)
func (*ProxyState) ListenAndServe ¶
func (p *ProxyState) ListenAndServe() error
func (*ProxyState) MergeURLs ¶
func (p *ProxyState) MergeURLs(dest, src *url.URL)
func (*ProxyState) MutateRequest ¶
func (*ProxyState) Proxy ¶
func (p *ProxyState) Proxy(w http.ResponseWriter, r *http.Request, requestID string, token *jwt.Token)
func (*ProxyState) ServeHTTP ¶
func (p *ProxyState) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*ProxyState) ValidateRequest ¶
func (p *ProxyState) ValidateRequest(w http.ResponseWriter, req *http.Request, requestID string, token *jwt.Token) (tenant *ProxyTenantState, path string, err error)
type ProxyTLSConfig ¶
type ProxyTenantState ¶
type ProxyTenantState struct {
*ProxyMLFlowTenant
Proxy *ProxyState
httputil.ReverseProxy
}
type Robot ¶
type Robot struct {
Name string `json:"name"`
Cert CertificateFromPath `json:"certPath"`
SecretToken SecretTokenFromPath `json:"secretTokenPath"`
Token TokenFromClaims `json:"token"`
}
type SecretTokenFromPath ¶ added in v0.2.0
type SecretTokenFromPath struct {
Token string
}
func (*SecretTokenFromPath) UnmarshalJSON ¶ added in v0.2.0
func (c *SecretTokenFromPath) UnmarshalJSON(bytes []byte) error
type Template ¶
func (*Template) UnmarshalJSON ¶
type TokenFromClaims ¶
func (*TokenFromClaims) UnmarshalJSON ¶
func (t *TokenFromClaims) UnmarshalJSON(bytes []byte) error
Click to show internal directories.
Click to hide internal directories.