Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DEBUG = log.New(io.Discard, "DEBUG [subsonic-basicauth]: ", 0)
Functions ¶
Types ¶
type Config ¶
type Config struct { // # Authentication mode // // * "backend": The subsonic backend is performing the BasicAuth // authentication. // // In this mode, the SubsonicAuth parameters are removed, and the response // is not rewritten: as the backend is a subsonic server, it is expected // to sent proper subsonic responses in all situations. // // * "proxy": The proxy is handling the authentication, e.g. using // ForwardAuth. // // In this mode, the SubsonicAuth parameters are removed, and the response // is rewritten in case of authentication error: the proxy and the backend // authentication service are not expected to know how to properly answer // with a subsonic error, so the plugin has to intervene. // // SECURITY NOTES: // - If used with a ForwardAuth middleware, make sure to remove the // BasicAuth header after the authentication and before forwarding the // request to the backend. Traefik's architecture makes it impossible to // handle this directly in this plugin. // - Make sure to check your subsonic server's documentation and disable // authentication mechanisms not supported by this plugin, or prevent // them from being used by clients (e.g. by stripping the corresponding // credentials from requests). If not done correctly, THIS COULD LEAVE // YOUR SYSTEM VULNERABLE TO HPP ATTACKS, where different credentials // are retrieved in different ways by different components of your // system. Credential sources not supported by this plugin could include // non-standard headers (see the `ClientHeaders` option), cookies, or // non-standard query parameters. Auth string `json:"auth"` // Enable debug logs. Does not contain sensitive data related to the // subsonic authentication. Debug bool `json:"debug"` // Name of the header used to propagate the BasicAuth token. // // The default value is "Authorization". // // The sanitization-only mode is enabled by setting an empty value: The // authentication parameters get validated and stripped from the query, but // without adding a BasicAuth header to the forwarded request nor rewriting // responses. Header string `json:"header"` // Name of headers that clients can use to send BasicAuth credentials. // Multiple headers can be specified separated by a comma. // // The default value is "Authorization". // // This list should contain at least all the headers supported by your // subsonic server, unless you remove them from client requests using // another middleware. ClientHeaders string `json:"client-headers"` }
func CreateConfig ¶
func CreateConfig() *Config
type JsonWrapper ¶
type JsonWrapper struct {
Subsonic Subsonic `json:"subsonic-response"`
}
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
func (*Middleware) ServeHTTP ¶
func (mw *Middleware) ServeHTTP(res http.ResponseWriter, req *http.Request)
type Subsonic ¶
type Subsonic struct { XMLName xml.Name `xml:"http://subsonic.org/restapi subsonic-response" json:"-"` Status string `xml:"status,attr" json:"status"` Version string `xml:"version,attr" json:"version"` Type string `xml:"type,attr" json:"type"` ServerVersion string `xml:"serverVersion,attr" json:"serverVersion"` OpenSubsonic bool `xml:"openSubsonic,attr,omitempty" json:"openSubsonic,omitempty"` Error *Error `xml:"error,omitempty" json:"error,omitempty"` }
Click to show internal directories.
Click to hide internal directories.