schema

package
v0.0.0-...-c932893 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DNCacheContextKey = "dn"
View Source
const TIMESTAMP_FORMAT string = "20060102150405Z"
View Source
const TIMESTAMP_NANO_FORMAT string = "20060102150405.000000Z"

Variables

View Source
var BASE_SCHEMA_OPENLDAP24 string = `` /* 165673-byte string literal not displayed */

ldapsearch -o ldif-wrap=no -H ldap://... -x -D "cn=..." -b "cn=Subschema" -v -s base attributeTypes comparators ditContentRules ditStructureRules ldapSyntaxes matchingRules matchingRuleUse nameForms normalizers objectClasses syntaxCheckers

View Source
var LASTBIND_OPERATION_SCHEMA_OPENLDAP24 = `` /* 284-byte string literal not displayed */

https://github.com/winlibs/openldap/blob/2615a35b32b3596a1e8f872f0c244bc4a41a047e/contrib/slapd-modules/lastbind/lastbind.c#L57-L63

View Source
var PPOLICY_OPERATION_SCHEMA_OPENLDAP24 = `` /* 573-byte string literal not displayed */

https://github.com/openldap/openldap/blob/98a0029daeb8aaa7bc58428ad3f94eface7f997b/doc/man/man5/slapo-ppolicy.5

View Source
var SPACE_PATTERN = regexp.MustCompile(`\s+`)

Functions

This section is empty.

Types

type AttributeType

type AttributeType struct {
	Name               string
	AName              []string
	Oid                string
	Equality           string
	Ordering           string
	Substr             string
	Syntax             string
	Sup                string
	Usage              string
	IndexType          string
	ColumnName         string
	SingleValue        bool
	NoUserModification bool
	// contains filtered or unexported fields
}

func (*AttributeType) IsAssociationAttribute

func (s *AttributeType) IsAssociationAttribute() bool

func (*AttributeType) IsCaseIgnore

func (s *AttributeType) IsCaseIgnore() bool

func (*AttributeType) IsCaseIgnoreSubstr

func (s *AttributeType) IsCaseIgnoreSubstr() bool

func (*AttributeType) IsNanoFormat

func (s *AttributeType) IsNanoFormat() bool

func (*AttributeType) IsNumberOrdering

func (s *AttributeType) IsNumberOrdering() bool

func (*AttributeType) IsObjectClass

func (s *AttributeType) IsObjectClass() bool

func (*AttributeType) IsOperationalAttribute

func (s *AttributeType) IsOperationalAttribute() bool

func (*AttributeType) IsReverseAssociationAttribute

func (s *AttributeType) IsReverseAssociationAttribute() bool

func (*AttributeType) NewSchemaValueMap

func (s *AttributeType) NewSchemaValueMap(size int) SchemaValueMap

func (*AttributeType) Schema

func (a *AttributeType) Schema() *SchemaRegistry

type AttributeTypeAndValue

type AttributeTypeAndValue struct {
	// TypeOrig is the original attribute type
	TypeOrig string
	// TypeNorm is the normalized attribute type
	TypeNorm string
	// Value is the original attribute value
	ValueOrig string
	// Value is the encoded original attribute value
	ValueOrigEncoded string
	// Value is the normalized attribute value
	ValueNorm string
}

type DN

type DN struct {
	RDNs     []*RelativeDN
	RDNIndex map[string]NormString
}

func NormalizeDN

func NormalizeDN(sr *SchemaRegistry, dn string) (*DN, error)

func ParseDN

func ParseDN(sr *SchemaRegistry, str string) (*DN, error)

ParseDN returns a distinguishedName or an error. The function respects https://tools.ietf.org/html/rfc4514 This function based on go-ldap/ldap/v3.

func (*DN) DNNormStr

func (d *DN) DNNormStr() string

func (*DN) DNNormStrWithoutSuffix

func (d *DN) DNNormStrWithoutSuffix(suffix *DN) string

func (*DN) DNOrigEncodedStrWithoutSuffix

func (d *DN) DNOrigEncodedStrWithoutSuffix(suffix *DN) string

func (*DN) DNOrigStr

func (d *DN) DNOrigStr() string

func (*DN) Equal

func (d *DN) Equal(o *DN) bool

func (*DN) IsAnonymous

func (d *DN) IsAnonymous() bool

func (*DN) IsDC

func (d *DN) IsDC() bool

func (*DN) IsRoot

func (d *DN) IsRoot() bool

func (*DN) IsSubOf

func (d *DN) IsSubOf(o *DN) bool

IsSubOf checks whether the arg DN is subset of self. Example:

self DN: ou=people,dc=exaple,dc=com
arg DN: dc=example,dc=com

=> true

func (*DN) IsSuffix

func (d *DN) IsSuffix(suffix *DN) bool

func (*DN) Level

func (d *DN) Level() int

func (*DN) LevelWithoutSuffix

func (d *DN) LevelWithoutSuffix(suffix *DN) int

func (*DN) ModifyRDN

func (d *DN) ModifyRDN(sr *SchemaRegistry, newRDN string, deleteOld bool) (*DN, *RelativeDN, bool, error)

func (*DN) Move

func (d *DN) Move(newParentDN *DN) (*DN, error)

func (*DN) ParentDN

func (d *DN) ParentDN() *DN

func (*DN) RDN

func (d *DN) RDN() map[string]NormString

func (*DN) RDNNormStr

func (d *DN) RDNNormStr() string

func (*DN) RDNOrigEncodedStr

func (d *DN) RDNOrigEncodedStr() string

type DNCache

type DNCache struct {
	Itoa  map[int64]*DN
	Itoao map[int64]string // id => dnOrig
	Atoi  map[string]int64
}

func NewDnCache

func NewDnCache() *DNCache

type NormString

type NormString struct {
	Orig string
	Norm string
}

type ObjectClass

type ObjectClass struct {
	Name       string
	Oid        string
	Sup        string
	Structural bool
	Abstruct   bool
	Auxiliary  bool
	// contains filtered or unexported fields
}

func (*ObjectClass) Contains

func (o *ObjectClass) Contains(a string) bool

func (*ObjectClass) May

func (o *ObjectClass) May() []string

func (*ObjectClass) Must

func (o *ObjectClass) Must() []string

type PPolicy

type PPolicy struct {
	PwdAttribute       []string `json:"pwdAttribute"`
	PwdLockout         []string `json:"pwdLockout"`
	PwdLockoutDuration []string `json:"pwdLockoutDuration"`
	PwdMaxFailure      []string `json:"pwdMaxFailure"`
}

func NewDefaultPPolicy

func NewDefaultPPolicy() *PPolicy

func (*PPolicy) IsLockoutEnabled

func (p *PPolicy) IsLockoutEnabled() bool

func (*PPolicy) LockoutDuration

func (p *PPolicy) LockoutDuration() int64

func (*PPolicy) MaxFailure

func (p *PPolicy) MaxFailure() int

func (*PPolicy) ShouldLockout

func (p *PPolicy) ShouldLockout(current int) bool

type RelativeDN

type RelativeDN struct {
	Attributes []*AttributeTypeAndValue
}

func (*RelativeDN) NormStr

func (r *RelativeDN) NormStr() string

func (*RelativeDN) OrigEncodedStr

func (r *RelativeDN) OrigEncodedStr() string

type SchemaConfig

type SchemaConfig struct {
	Suffix           string
	RootDN           string
	DefaultPPolicyDN string
	CustomSchema     []string
	MigrationEnabled bool
}

type SchemaRegistry

type SchemaRegistry struct {
	Config           *SchemaConfig
	ObjectClasses    map[string]*ObjectClass
	AttributeTypes   map[string]*AttributeType
	SuffixDN         *DN
	RootDN           *DN
	DefaultPPolicyDN *DN
}

func NewSchema

func NewSchema(config *SchemaConfig) *SchemaRegistry

func NewSchemaRegistry

func NewSchemaRegistry(config *SchemaConfig) *SchemaRegistry

func (*SchemaRegistry) AttributeType

func (s *SchemaRegistry) AttributeType(k string) (*AttributeType, bool)

func (*SchemaRegistry) Dump

func (s *SchemaRegistry) Dump() string

func (*SchemaRegistry) NormalizeDN

func (s *SchemaRegistry) NormalizeDN(dn string) (*DN, error)

func (*SchemaRegistry) ObjectClass

func (s *SchemaRegistry) ObjectClass(k string) (*ObjectClass, bool)

func (*SchemaRegistry) PutAttributeType

func (s *SchemaRegistry) PutAttributeType(k string, attributeType *AttributeType)

func (*SchemaRegistry) PutObjectClass

func (s *SchemaRegistry) PutObjectClass(k string, objectClass *ObjectClass)

func (*SchemaRegistry) ValidateObjectClass

func (s *SchemaRegistry) ValidateObjectClass(ocs []string, attrs map[string]*SchemaValue) *util.LDAPError

type SchemaValue

type SchemaValue struct {
	// contains filtered or unexported fields
}

func NewSchemaValue

func NewSchemaValue(sr *SchemaRegistry, attrName string, attrValue []string) (*SchemaValue, error)

func (*SchemaValue) Add

func (s *SchemaValue) Add(value *SchemaValue) error

func (*SchemaValue) Clear

func (s *SchemaValue) Clear()

func (*SchemaValue) Clone

func (s *SchemaValue) Clone() *SchemaValue

func (*SchemaValue) Contains

func (s *SchemaValue) Contains(valueNorm string) bool

func (*SchemaValue) Delete

func (s *SchemaValue) Delete(value *SchemaValue) error

func (*SchemaValue) Diff

func (s *SchemaValue) Diff(base *SchemaValue) ([]string, []string, []string)

func (*SchemaValue) Equal

func (s *SchemaValue) Equal(value *SchemaValue) bool

func (*SchemaValue) HasDuplicate

func (s *SchemaValue) HasDuplicate(value *SchemaValue) (bool, int)

func (*SchemaValue) IsAssociationAttribute

func (s *SchemaValue) IsAssociationAttribute() bool

func (*SchemaValue) IsEmpty

func (s *SchemaValue) IsEmpty() bool

func (*SchemaValue) IsNoUserModification

func (s *SchemaValue) IsNoUserModification() bool

func (*SchemaValue) IsNoUserModificationWithMigrationDisabled

func (s *SchemaValue) IsNoUserModificationWithMigrationDisabled() bool

func (*SchemaValue) IsReverseAssociationAttribute

func (s *SchemaValue) IsReverseAssociationAttribute() bool

func (*SchemaValue) IsSingle

func (s *SchemaValue) IsSingle() bool

func (*SchemaValue) Name

func (s *SchemaValue) Name() string

func (*SchemaValue) Norm

func (s *SchemaValue) Norm() []interface{}

func (*SchemaValue) NormStr

func (s *SchemaValue) NormStr() []string

func (*SchemaValue) Normalize

func (s *SchemaValue) Normalize() error

normalize the value using schema definition. The value is expected as a valid value. It means you need to validte the value in advance.

func (*SchemaValue) Orig

func (s *SchemaValue) Orig() []string

func (*SchemaValue) Schema

func (s *SchemaValue) Schema() *AttributeType

type SchemaValueMap

type SchemaValueMap struct {
	// contains filtered or unexported fields
}

func (SchemaValueMap) Has

func (m SchemaValueMap) Has(val string) bool

func (SchemaValueMap) Put

func (m SchemaValueMap) Put(val string)

Jump to

Keyboard shortcuts

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