proxyauth

package module
v0.0.0-...-5a74b7e Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2017 License: MIT Imports: 3 Imported by: 0

README

Proxy Auth Middleware for Go-Json-Rest

Middleware to proxy an authentication request to an external auth service / api.

License

The MIT License (MIT). See LICENSE for more information.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Middleware

type Middleware struct {
	// Target url to get user data using Authorization header
	Target string

	// Callback function that should perform the authorization of the authenticated user.
	// Called only when authentication was successful. Must return true on success,
	// false on failure. Optional, default to success.
	Authorizator func(data []byte, request *rest.Request) bool
}

Middleware provides a jwt proxied authentication. On failure, a 401 HTTP response is returned. On success, the wrapped middleware is called, and the raw user data is made available as request.Env["USER_DATA"].(interface)

func (*Middleware) MiddlewareFunc

func (mw *Middleware) MiddlewareFunc(handler rest.HandlerFunc) rest.HandlerFunc

MiddlewareFunc makes Middleware implement the Middleware interface.

Jump to

Keyboard shortcuts

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