Versions in this module Expand all Collapse all v0 v0.0.1 Feb 13, 2022 Changes in this version + var DefaultPolicy string + var Model string + var PermissionValues = []Permission + func Derive(root string, service Service, user *User) (username, password []byte, err error) + func EnsurePolicy(enforcer *casbin.Enforcer, policy string) error + func Middleware(handler http.Handler, api *API, authKind string) http.Handler + type API struct + func NewAPI(db *badger.DB, enforcer *casbin.Enforcer, root string) *API + func (api *API) CreateService(w http.ResponseWriter, r *http.Request) + func (api *API) DeleteGrant(w http.ResponseWriter, r *http.Request) + func (api *API) DeleteService(w http.ResponseWriter, r *http.Request) + func (api *API) GetCurrentUser(w http.ResponseWriter, r *http.Request) + func (api *API) GetService(w http.ResponseWriter, r *http.Request) + func (api *API) GetServiceCredentials(w http.ResponseWriter, r *http.Request) + func (api *API) ListCredentials(w http.ResponseWriter, r *http.Request) + func (api *API) ListGrants(w http.ResponseWriter, r *http.Request) + func (api *API) ListServices(w http.ResponseWriter, r *http.Request) + func (api *API) ListUsers(w http.ResponseWriter, r *http.Request) + func (api *API) PutGrant(w http.ResponseWriter, r *http.Request) + func (api *API) UpdateCurrentUser(w http.ResponseWriter, r *http.Request) + func (api *API) UpdateService(w http.ResponseWriter, r *http.Request) + type Adapter struct + func NewCasbinAdapter(db *badger.DB) *Adapter + func (a *Adapter) AddPolicies(sec string, ptype string, rules [][]string) error + func (a *Adapter) AddPolicy(sec string, ptype string, rule []string) error + func (a *Adapter) LoadPolicy(m model.Model) error + func (a *Adapter) RemoveFilteredPolicy(sec string, ptype string, fieldOffset int, fieldValues ...string) error + func (a *Adapter) RemovePolicies(sec string, ptype string, rules [][]string) error + func (a *Adapter) RemovePolicy(sec string, ptype string, rule []string) error + func (a *Adapter) SavePolicy(model model.Model) error + type CreateServiceRequest struct + Address string + Kind string + Name string + type Credentials struct + Password string + Username string + type ListGrantsResponse struct + Grants []UserGrant + Roles []string + type Permission string + const AdminPermission + const DeletePermission + const ReadPermission + const SystemPermission + const UpdatePermission + const WritePermission + func (p Permission) String() string + type Service struct + Address string + Key []byte + Kind string + Name string + Templates ServiceTemplates + func (s Service) K() string + type ServiceCredentials struct + Address string + Credentials Credentials + type ServiceTemplates struct + PasswordTemplate pass.TemplateClass + UserTemplate pass.TemplateClass + type Store struct + func (store *Store) Delete(ctx context.Context, kind, name string) (err error) + func (store *Store) Get(ctx context.Context, kind, name string, v interface{}) (err error) + func (store *Store) List(ctx context.Context, base interface{}) (results []interface{}, err error) + func (store *Store) Put(ctx context.Context, kind, name string, v interface{}) (err error) + type Templates struct + PasswordTemplate string + UserTemplate string + type Txn struct + func (txn *Txn) CommitOrDiscard(err *error) + type UpdateServiceRequest struct + Address string + RotateKey bool + type UpdateUserRequest struct + RotateService Service + type User struct + ID string + Kind string + Name string + SiteCounters map[string]uint32 + func (u User) K() string + type UserCredential struct + Credentials Credentials + Permission []Permission + type UserGrant struct + Roles []string + User User