Documentation ¶
Overview ¶
Package authsvc provides an OAuth2 server wrapping LDAP backend
Index ¶
Constants ¶
View Source
const ( // HashKeySize is optimally 64 bytes HashKeySize = 64 // BlockKeySize is optimally 32 bytes BlockKeySize = 32 )
Variables ¶
View Source
var ( ErrInvalidRequest = errors.New("invalid_request") ErrInvalidToken = errors.New("invalid_token") ErrInsufficientScope = errors.New("insufficient_scope") ErrNoAuthToken = errors.New("no_auth") )
Exported Errors
Functions ¶
func Generate ¶ added in v0.0.2
Generate creates a random key of keysize length, and returns it in base64 encoded text.
func RegisterAPI ¶
RegisterAPI returns a router for the api.
func RegisterOAuth ¶ added in v0.0.2
RegisterOAuth returns a router that handles OAuth routes.
Types ¶
type AuthenticationMiddleware ¶ added in v0.0.2
type AuthenticationMiddleware struct {
// contains filtered or unexported fields
}
AuthenticationMiddleware enforces authentication on protected routes.
func NewAuthenticationMiddleware ¶ added in v0.0.2
func NewAuthenticationMiddleware(realm string, root string, seeder Seeder) (*AuthenticationMiddleware, error)
NewAuthenticationMiddleware returns a middlware suitable for authentication.
func (*AuthenticationMiddleware) LoginHandler ¶ added in v0.0.2
func (m *AuthenticationMiddleware) LoginHandler() http.Handler
LoginHandler returns a router that handles the login and logout routes.
func (*AuthenticationMiddleware) ServeHTTP ¶ added in v0.0.2
func (m *AuthenticationMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request, n http.HandlerFunc)
type DebugMiddleware ¶ added in v0.0.2
type DebugMiddleware struct {
// contains filtered or unexported fields
}
DebugMiddleware provides request/response logging.
func NewDebugMiddleware ¶ added in v0.0.2
func NewDebugMiddleware(w io.Writer, verbose bool) *DebugMiddleware
NewDebugMiddleware provides middleware suitable for exhaustive request/response logging.
func (*DebugMiddleware) ServeHTTP ¶ added in v0.0.2
func (l *DebugMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.