Documentation ¶
Overview ¶
package chrome provides a simple interface for enforcing chromeentication in HTTP handlers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterChrome ¶
func RegisterChrome(ctx context.Context, scheme string, init_func ChromeInitializationFunc) error
RegisterChrome registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `Chrome` instances by the `NewChrome` method.
Types ¶
type Chrome ¶
type Chrome interface { // WrapHandler wraps a `http.Handler` with any implementation-specific middleware. WrapHandler(http.Handler, string) http.Handler AppendStaticAssetHandlers(*http.ServeMux) error AppendStaticAssetHandlersWithPrefix(*http.ServeMux, string) error }
type Chrome is a simple interface for enforcing chromeentication in HTTP handlers.
func NewChrome ¶
NewChrome returns a new `Chrome` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `ChromeInitializationFunc` function used to instantiate the new `Chrome`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterChrome` method.
type ChromeInitializationFunc ¶
ChromeInitializationFunc is a function defined by individual chrome package and used to create an instance of that chrome
type NoneChrome ¶
type NoneChrome struct {
Chrome
}
type NoneChrome implements the Chrome interface that always returns a "not authorized" error.
func (*NoneChrome) AppendStaticAssetHandlers ¶
func (c *NoneChrome) AppendStaticAssetHandlers(*http.ServeMux) error
func (*NoneChrome) AppendStaticAssetHandlersWithPrefix ¶
func (c *NoneChrome) AppendStaticAssetHandlersWithPrefix(mux *http.ServeMux, prefix string) error
func (*NoneChrome) WrapHandler ¶
WrapHandler returns 'h' unchanged.