silo

package
v0.0.0-...-3e6933e Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Copyright 2018 Keydap. All rights reserved. Licensed under the Apache License, Version 2.0, see LICENSE.

Index

Constants

This section is empty.

Variables

View Source
var (
	// a bucket that holds the names of the resource buckets e.g users, groups etc.
	BUC_RESOURCES = []byte("resources")

	// a bucket that holds the names of the resource buckets e.g users, groups etc.
	BUC_INDICES = []byte("indices")

	// a bucket that holds the unique ids of users that are registered for Webauthn.
	BUC_WEBAUTHN = []byte("webauthn")

	// the delimiter that separates resource and index name
	RES_INDEX_DELIM = ":"

	DUP_KEY_VAL = []byte{0}
)

Functions

This section is empty.

Types

type Index

type Index struct {
	Bname         string // name of the bucket
	Name          string
	BnameBytes    []byte
	AllowDupKey   bool
	ValType       string // save the attribute's type name as a string
	CaseSensitive bool
	// contains filtered or unexported fields
}

func (*Index) GetRid

func (idx *Index) GetRid(valKey []byte, tx *bolt.Tx) string

Get the resource ID associated with the given attribute value This method is only applicable for unique attributes

func (*Index) GetRids

func (idx *Index) GetRids(valKey []byte, tx *bolt.Tx) []string

Get the resource ID associated with the given attribute value This method is applicable for multivalued attributes only

func (*Index) HasKeyAndVal

func (idx *Index) HasKeyAndVal(key []byte, val string, tx *bolt.Tx) bool

Checks if the given key value pair exist in the index

func (*Index) HasVal

func (idx *Index) HasVal(val interface{}, tx *bolt.Tx) bool

type Silo

type Silo struct {
	Engine *rbac.RbacEngine
	// contains filtered or unexported fields
}

func Open

func Open(path string, serverId uint16, config *conf.DomainConfig, rtypes map[string]*schema.ResourceType, sm map[string]*schema.Schema) (*Silo, error)

func (*Silo) Authenticate

func (sl *Silo) Authenticate(principal string, password string) (lr base.LoginResult, err error)

func (*Silo) ChangePassword

func (sl *Silo) ChangePassword(cpContext *base.ChangePasswordContext) (err error)

func (*Silo) Close

func (sl *Silo) Close()

func (*Silo) Csn

func (sl *Silo) Csn() base.Csn

func (*Silo) Delete

func (sl *Silo) Delete(delCtx *base.DeleteContext) (err error)

func (*Silo) DeleteSecurityKey

func (sl *Silo) DeleteSecurityKey(userId string, credentialId string) (*base.Resource, error)

func (*Silo) DumpJSON

func (sl *Silo) DumpJSON(bkFilePath string, overwrite bool, rt *schema.ResourceType) error

Dumps all the resources of a given type in JSON format

func (*Silo) FindResources

func (sl *Silo) FindResources(filter *base.FilterNode, rt *schema.ResourceType) []*base.Resource

intended for internal use only, must NOT be used for filters that return large number of resources

func (*Silo) GenWebauthnIdFor

func (sl *Silo) GenWebauthnIdFor(userId string) (*base.Resource, error)

func (*Silo) Get

func (sl *Silo) Get(rid string, rt *schema.ResourceType) (resource *base.Resource, err error)

func (*Silo) GetMaxIndexedValOfAt

func (sl *Silo) GetMaxIndexedValOfAt(rt *schema.ResourceType, atName string) (int64, error)

func (*Silo) GetUser

func (sl *Silo) GetUser(rid string) (resource *base.Resource, err error)

func (*Silo) GetUserByName

func (sl *Silo) GetUserByName(username string) (user *base.Resource, err error)

func (*Silo) GetUserByWebauthnId

func (sl *Silo) GetUserByWebauthnId(webauthnId string) (user *base.Resource, err error)

func (*Silo) Insert

func (sl *Silo) Insert(crCtx *base.CreateContext) (err error)

func (*Silo) InsertInternal

func (sl *Silo) InsertInternal(crCtx *base.CreateContext) (err error)

func (*Silo) LoadGroups

func (sl *Silo) LoadGroups()

func (*Silo) ModifyGroupsOfUser

func (sl *Silo) ModifyGroupsOfUser(mgur base.ModifyGroupsOfUserRequest) (res *base.Resource, err error)

func (*Silo) Patch

func (sl *Silo) Patch(patchCtx *base.PatchContext) (err error)

func (*Silo) ReadAllOfType

func (sl *Silo) ReadAllOfType(rt *schema.ResourceType, outPipe chan *base.Resource) error

func (*Silo) Replace

func (sl *Silo) Replace(replaceCtx *base.ReplaceContext) (err error)

func (*Silo) Search

func (sl *Silo) Search(sc *base.SearchContext, outPipe chan *base.Resource) error

TODO add cancel channel to stop processing when the http client is closed

func (*Silo) StoreSecurityKey

func (sl *Silo) StoreSecurityKey(rid string, secKey *base.SecurityKey) (*base.Resource, error)

func (*Silo) StoreTotpSecret

func (sl *Silo) StoreTotpSecret(rid string, totpSecret string) error

func (*Silo) UpdateAuthData

func (sl *Silo) UpdateAuthData(rid string, version string, ad base.AuthData) error

func (*Silo) VerifyOtp

func (sl *Silo) VerifyOtp(rid string, totpCode string) (lr base.LoginResult, err error)

Jump to

Keyboard shortcuts

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