authgroup

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package authgroup groups two or more authentication backends together, trying one, then falling through to the others.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(userStores ...authdb.UserStore) authdb.UserStore

New initializes a group of auth handlers. Each one is tried in turn, in the order passed to New.

Types

type AuthGroup

type AuthGroup []authdb.UserStore

AuthGroup is a group of auth handlers, to be tried in turn.

func (AuthGroup) UserCtx

func (g AuthGroup) UserCtx(ctx context.Context, username string) (*authdb.UserContext, error)

UserCtx loops through each of the auth handlers, in the order passed to New until the context is cancelled, in which case the context's error is returned. The first one to not return an error returns. If all of the handlers return a Not Found error, Not Found is returned. If any other errors are returned, the first is returned to the caller.

func (AuthGroup) Validate

func (g AuthGroup) Validate(ctx context.Context, username, password string) (*authdb.UserContext, error)

Validate loops through each of the auth handlers, in the order passed to New, until the context is cancelled, in which case the context's error is returned. The first validation success returns. Errors are discarded unless all auth handlers fail to validate the user, in which case only the first error received will be returned.

Jump to

Keyboard shortcuts

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