Version: v0.0.0-...-719b496 Latest Latest

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

Go to latest
Published: Jul 20, 2021 License: Apache-2.0 Imports: 14 Imported by: 0



Package userlist provide a static configuration based authentication system

Each user has a set of ACLs that are applied to the generated token, ACL strings have to comply with the signer you choose, refer to signer documentation for details.



This section is empty.


This section is empty.


This section is empty.


type Authenticator

type Authenticator struct {
	// contains filtered or unexported fields

Authenticator is a authenticator with a basic fixed list of users and bcrypt encrypted passwords

func New

func New(c *AuthenticatorConfig, log *logrus.Entry, site string) (a *Authenticator, err error)

New creates an instance of the authenticator

func (*Authenticator) Login

func (a *Authenticator) Login(req *models.LoginRequest) (resp *models.LoginResponse)

Login logs someone in using a configured user list

type AuthenticatorConfig

type AuthenticatorConfig struct {
	Users         []*User `json:"users"`
	UsersFile     string  `json:"users_file"`
	TokenValidity string  `json:"validity"`
	SigningKey    string  `json:"signing_key"`

AuthenticatorConfig configures the user/pass authenticator

type User

type User struct {
	// Username in plain text
	Username string `json:"username"`

	// Password is a bcrypted password
	Password string `json:"password"`

	// Organization is a org name the user belongs to
	Organization string `json:"organization"`

	// ACLs are for the action list authorizer
	ACLs []string `json:"acls"`

	// OPAPolicy is a string holding a Open Policy Agent rego policy
	OPAPolicy string `json:"opa_policy"`

	// OPAPolicyFile is the path to a rego file to embed as the policy for this user
	OPAPolicyFile string `json:"opa_policy_file"`

	// Properties are free form additional information to add about a user, this can be
	// referenced later in an authorizer like the Open Policy one
	Properties map[string]string `json:"properties"`


User is a choria user

func (*User) OpenPolicy

func (u *User) OpenPolicy() (policy string, err error)

OpenPolicy retrieves the OPA Policy either from `OPAPolicy` or by reading the file in `OPAPolicyFile`

Jump to

Keyboard shortcuts

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