-
Notifications
You must be signed in to change notification settings - Fork 15
/
auth_scheme.go
32 lines (29 loc) · 1.35 KB
/
auth_scheme.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package authschemes
import (
"github.com/go-chi/chi/v5"
)
// AuthScheme provides a small interface into interacting with the AShirt backend authentication.
// The interface consists of two methods:
//
// Name() string: This method shall return a string that identifies the authentication scheme
// being used. It shall be distinct from any other authentication system being used within
// this project.
//
// FriendlyName() string: This method shall return a friendly version of the authentication that
// endusers will understand. It should, but is not strictly required, that the value be different
// from any other scheme. Likewise, it should be a "friendlier" version of Name(), though it need
// not be.
//
// BindRoutes(router, authBridge): BindRoutes exposes a _namespaced_ router that the authentication
// system can use to register custom endpoints. Each router is prefixed with /auth/{name} (as
// determined by the Name() method)
type AuthScheme interface {
BindRoutes(chi.Router, AShirtAuthBridge)
Name() string
FriendlyName() string
Flags() []string
// Type provides a way to identify how a scheme works apart from its name. Currently this has two
// "categories". First is "oidc", which is used for any generic OIDC provider. Second is the name
// of the method (e.g. "local"), which is used when there's no real alternative to speak of.
Type() string
}