Versions in this module Expand all Collapse all v0 v0.12.4 Jan 2, 2022 v0.12.3 Dec 26, 2021 v0.12.2 Dec 26, 2021 Changes in this version + func ParseLanguageTag(name string) (string, string, error) type AttributeType + LanguageTag string type SchemaValue + func (s *SchemaValue) LanguageTag() string v0.12.1 Dec 14, 2021 Changes in this version + const TIMESTAMP_FORMAT + const TIMESTAMP_NANO_FORMAT + var BASE_SCHEMA_OPENLDAP24 string = ... + var ErrIncompatibleVersion = errors.New("incompatible version of argon2") + var ErrInvalidHash = errors.New("the encoded hash is not in the correct format") + var LASTBIND_OPERATION_SCHEMA_OPENLDAP24 = ... + var PPOLICY_OPERATION_SCHEMA_OPENLDAP24 = ... + var SCHEMA_OPENLDAP24 = BASE_SCHEMA_OPENLDAP24 + PPOLICY_OPERATION_SCHEMA_OPENLDAP24 + LASTBIND_OPERATION_SCHEMA_OPENLDAP24 + var SPACE_PATTERN = regexp.MustCompile(`\s+`) + func NewHandler(s *Server, handler func(s *Server, w ldap.ResponseWriter, r *ldap.Message)) func(w ldap.ResponseWriter, r *ldap.Message) + func NewInvalidDNError(dnNorm string) error + func NewRetryError(err error) error + func SetSessionContext(parents context.Context, m *ldap.Message) context.Context + type AddEntry struct + func NewAddEntry(schemaMap *SchemaMap, dn *DN) *AddEntry + func (j *AddEntry) Add(attrName string, attrValue []string) error + func (j *AddEntry) Attrs() (map[string][]interface{}, map[string][]string) + func (j *AddEntry) DN() *DN + func (j *AddEntry) HasAttr(attrName string) bool + func (j *AddEntry) IsDC() bool + func (j *AddEntry) IsRoot() bool + func (j *AddEntry) ParentDN() *DN + func (j *AddEntry) SetDN(dn *DN) + func (j *AddEntry) Validate() error + type ArrayFlags []string + var CustomSchema ArrayFlags + func (a *ArrayFlags) Set(s string) error + func (a *ArrayFlags) String() string + type AttributeType struct + AName []string + ColumnName string + Equality string + IndexType string + Name string + NoUserModification bool + Oid string + Ordering string + SingleValue bool + Substr string + Sup string + Syntax string + Usage string + func (s *AttributeType) IsAssociationAttribute() bool + func (s *AttributeType) IsCaseIgnore() bool + func (s *AttributeType) IsCaseIgnoreSubstr() bool + func (s *AttributeType) IsNumberOrdering() bool + func (s *AttributeType) IsOperationalAttribute() bool + func (s *AttributeType) IsReverseAssociationAttribute() bool + func (s *AttributeType) NewSchemaValueMap(size int) SchemaValueMap + type AttributeTypeAndValue struct + TypeNorm string + TypeOrig string + ValueNorm string + ValueOrig string + ValueOrigEncoded string + type AuthSession struct + DN *DN + Groups []*DN + IsRoot bool + func AuthSessionContext(ctx context.Context) (*AuthSession, error) + type DBRepository struct + type DN struct + RDNIndex map[string]NormString + RDNs []*RelativeDN + func NormalizeDN(schemaMap *SchemaMap, dn string) (*DN, error) + func ParseDN(schemaMap *SchemaMap, str string) (*DN, error) + func (d *DN) DNNormStr() string + func (d *DN) DNNormStrWithoutSuffix(suffix *DN) string + func (d *DN) DNOrigEncodedStrWithoutSuffix(suffix *DN) string + func (d *DN) DNOrigStr() string + func (d *DN) Equal(o *DN) bool + func (d *DN) IsAnonymous() bool + func (d *DN) IsDC() bool + func (d *DN) IsRoot() bool + func (d *DN) IsSubOf(o *DN) bool + func (d *DN) Level() int + func (d *DN) ModifyRDN(schemaMap *SchemaMap, newRDN string, deleteOld bool) (*DN, *RelativeDN, error) + func (d *DN) Move(newParentDN *DN) (*DN, error) + func (d *DN) ParentDN() *DN + func (d *DN) RDN() map[string]NormString + func (d *DN) RDNNormStr() string + func (d *DN) RDNOrigEncodedStr() string + type FetchedCredential struct + Credential []string + ID int64 + LastPwdFailureTime *time.Time + MemberOf []*DN + PPolicy *PPolicy + PwdAccountLockedTime *time.Time + PwdFailureCount int + type FetchedDNOrig struct + DNOrig string + ID int64 + type HybridDBEntry struct + AttrsNorm types.JSONText + AttrsOrig types.JSONText + ID int64 + ParentDN *DN + RDNNorm string + RDNOrig string + type HybridDBFilterTranslator struct + func (t *HybridDBFilterTranslator) AnyMatch(s *AttributeType, sb *strings.Builder, val string, i int) + func (t *HybridDBFilterTranslator) ApproxMatch(s *AttributeType, q *HybridDBFilterTranslatorResult, val string, isNot bool) + func (t *HybridDBFilterTranslator) EndsMatch(s *AttributeType, sb *strings.Builder, val string, i int) + func (t *HybridDBFilterTranslator) EqualityMatch(s *AttributeType, q *HybridDBFilterTranslatorResult, val string, isNot bool) + func (t *HybridDBFilterTranslator) GreaterOrEqualMatch(s *AttributeType, q *HybridDBFilterTranslatorResult, val string, isNot bool) + func (t *HybridDBFilterTranslator) LessOrEqualMatch(s *AttributeType, q *HybridDBFilterTranslatorResult, val string, isNot bool) + func (t *HybridDBFilterTranslator) PresentMatch(s *AttributeType, q *HybridDBFilterTranslatorResult, isNot bool) + func (t *HybridDBFilterTranslator) StartsWithMatch(s *AttributeType, sb *strings.Builder, val string, i int) + type HybridDBFilterTranslatorResult struct + type HybridFetchedDBEntry struct + Count int32 + DNOrig string + HasSubordinates *bool + ID int64 + ParentID int64 + RDNOrig string + RawAttrsOrig types.JSONText + RawMember types.JSONText + RawMemberOf types.JSONText + RawUniqueMember types.JSONText + func (e *HybridFetchedDBEntry) AttrsOrig() map[string][]string + func (e *HybridFetchedDBEntry) Clear() + type HybridRepository struct + func (r *HybridRepository) AddEntryToDBEntry(ctx context.Context, tx *sqlx.Tx, entry *AddEntry) (*HybridDBEntry, map[string][]int64, error) + func (r *HybridRepository) Bind(ctx context.Context, dn *DN, callback func(current *FetchedCredential) error) error + func (r *HybridRepository) FindPPolicyByDN(ctx context.Context, dn *DN) (*PPolicy, error) + func (r *HybridRepository) Init() error + func (r *HybridRepository) Insert(ctx context.Context, entry *AddEntry) (int64, error) + func (r *HybridRepository) Search(ctx context.Context, baseDN *DN, option *SearchOption, ...) (int32, int32, error) + func (r *HybridRepository) Update(ctx context.Context, dn *DN, callback func(current *ModifyEntry) error) error + func (r *HybridRepository) UpdateDN(ctx context.Context, oldDN, newDN *DN, oldRDN *RelativeDN) error + func (r HybridRepository) DeleteByDN(ctx context.Context, dn *DN) error + type InvalidCredentials struct + func (i InvalidCredentials) Error() string + type InvalidDNError struct + func (e *InvalidDNError) Error() string + type LDAPAction int + const AddOps + const DeleteOps + const ModRDNOps + const ModifyOps + const SearchOps + func (c LDAPAction) String() string + type LDAPError struct + Code int + MatchedDN string + Msg string + Subtype string + func NewAccountLocked() *LDAPError + func NewAccountLocking() *LDAPError + func NewAlreadyExists() *LDAPError + func NewInsufficientAccess() *LDAPError + func NewInvalidCredentials() *LDAPError + func NewInvalidDNSyntax() *LDAPError + func NewInvalidPerSyntax(attr string, valueidx int) *LDAPError + func NewMoreThanOnceError(attr string, valueidx int) *LDAPError + func NewMultipleValuesConstraintViolation(attr string) *LDAPError + func NewMultipleValuesProvidedError(attr string) *LDAPError + func NewNoGlobalSuperiorKnowledge() *LDAPError + func NewNoSuchAttribute(op, attr string) *LDAPError + func NewNoSuchObject() *LDAPError + func NewNoSuchObjectWithMatchedDN(dn string) *LDAPError + func NewNoUserModificationAllowedConstraintViolation(attr string) *LDAPError + func NewNotAllowedOnNonLeaf() *LDAPError + func NewObjectClassModsProhibited(from, to string) *LDAPError + func NewObjectClassViolation() *LDAPError + func NewObjectClassViolationInvalidStructualChain(oc1, oc2 string) *LDAPError + func NewObjectClassViolationNoStructural() *LDAPError + func NewObjectClassViolationNotAllowed(attrName string) *LDAPError + func NewObjectClassViolationRequiresAttribute(objectClass, attrName string) *LDAPError + func NewOperationsError() *LDAPError + func NewSuccess() *LDAPError + func NewTypeOrValueExists(op, attr string, valueidx int) *LDAPError + func NewUnavailable() *LDAPError + func NewUndefinedType(attr string) *LDAPError + func (e *LDAPError) Error() string + func (e *LDAPError) IsAccountLocked() bool + func (e *LDAPError) IsAccountLocking() bool + func (e *LDAPError) IsInvalidCredentials() bool + func (e *LDAPError) IsNoSuchObjectError() bool + func (e *LDAPError) Unwrap() error + type LDAPPassThroughClient struct + BindDN string + Filter string + Password string + Scope string + SearchBase string + Server string + Timeout int + func (c *LDAPPassThroughClient) Authenticate(domain, user, password string) (bool, error) + type Mapper struct + func NewMapper(server *Server) *Mapper + func (m *Mapper) LDAPMessageToAddEntry(dn *DN, ldapAttrs message.AttributeList) (*AddEntry, error) + type ModifyEntry struct + func NewModifyEntry(schemaMap *SchemaMap, dn *DN, attrsOrig map[string][]string) (*ModifyEntry, error) + func (e *ModifyEntry) Clone() *ModifyEntry + func (e *ModifyEntry) ModifyRDN(newDN *DN) *ModifyEntry + func (j *ModifyEntry) Add(attrName string, attrValue []string) error + func (j *ModifyEntry) ApplyCurrent(attrName string, attrValue []string) error + func (j *ModifyEntry) Attrs() (map[string][]interface{}, map[string][]string) + func (j *ModifyEntry) DN() *DN + func (j *ModifyEntry) Delete(attrName string, attrValue []string) error + func (j *ModifyEntry) GetDNNorm() string + func (j *ModifyEntry) GetDNOrig() string + func (j *ModifyEntry) HasAttr(attrName string) bool + func (j *ModifyEntry) HasKey(s *AttributeType) bool + func (j *ModifyEntry) ObjectClassesNorm() ([]string, bool) + func (j *ModifyEntry) ObjectClassesOrig() ([]string, bool) + func (j *ModifyEntry) Put(value *SchemaValue) error + func (j *ModifyEntry) Replace(attrName string, attrValue []string) error + func (j *ModifyEntry) SetDN(dn *DN) + func (j *ModifyEntry) Validate() error + type NormString struct + Norm string + Orig string + type ObjectClass struct + Abstruct bool + Auxiliary bool + Name string + Oid string + Structural bool + Sup string + func (o *ObjectClass) Contains(a string) bool + func (o *ObjectClass) May() []string + func (o *ObjectClass) Must() []string + type PPolicy struct + PwdAttribute []string + PwdLockout []string + PwdLockoutDuration []string + PwdMaxFailure []string + func (p *PPolicy) IsLockoutEnabled() bool + func (p *PPolicy) LockoutDuration() int64 + func (p *PPolicy) MaxFailure() int + func (p *PPolicy) ShouldLockout(current int) bool + type PassThroughClient interface + Authenticate func(domain, user, password string) (bool, error) + type PassThroughConfig map[string]PassThroughClient + func (p PassThroughConfig) Add(domain string, client PassThroughClient) + func (p PassThroughConfig) Get(domain string) (PassThroughClient, bool) + func (p PassThroughConfig) Has(domain string) bool + type RelativeDN struct + Attributes []*AttributeTypeAndValue + func (r *RelativeDN) NormStr() string + func (r *RelativeDN) OrigEncodedStr() string + type Repository interface + Bind func(ctx context.Context, dn *DN, callback func(current *FetchedCredential) error) error + DeleteByDN func(ctx context.Context, dn *DN) error + FindPPolicyByDN func(ctx context.Context, dn *DN) (*PPolicy, error) + Init func() error + Insert func(ctx context.Context, entry *AddEntry) (int64, error) + Search func(ctx context.Context, baseDN *DN, option *SearchOption, ...) (int32, int32, error) + Update func(ctx context.Context, dn *DN, callback func(current *ModifyEntry) error) error + UpdateDN func(ctx context.Context, oldDN, newDN *DN, oldRDN *RelativeDN) error + func NewRepository(server *Server) (Repository, error) + type RetryError struct + func (e *RetryError) Error() string + func (e *RetryError) Unwrap() error + type SchemaMap struct + AttributeTypes map[string]*AttributeType + ObjectClasses map[string]*ObjectClass + func InitSchemaMap(server *Server) *SchemaMap + func NewSchema(server *Server) *SchemaMap + func (s *SchemaMap) AttributeType(k string) (*AttributeType, bool) + func (s *SchemaMap) Dump() string + func (s *SchemaMap) ObjectClass(k string) (*ObjectClass, bool) + func (s *SchemaMap) PutAttributeType(k string, attributeType *AttributeType) + func (s *SchemaMap) PutObjectClass(k string, objectClass *ObjectClass) + func (s *SchemaMap) ValidateObjectClass(ocs []string, attrs map[string]*SchemaValue) *LDAPError + type SchemaValue struct + func NewSchemaValue(schemaMap *SchemaMap, attrName string, attrValue []string) (*SchemaValue, error) + func (s *SchemaValue) Add(value *SchemaValue) error + func (s *SchemaValue) Clone() *SchemaValue + func (s *SchemaValue) Delete(value *SchemaValue) error + func (s *SchemaValue) Equals(value *SchemaValue) bool + func (s *SchemaValue) HasDuplicate(value *SchemaValue) bool + func (s *SchemaValue) IsAssociationAttribute() bool + func (s *SchemaValue) IsEmpty() bool + func (s *SchemaValue) IsNoUserModification() bool + func (s *SchemaValue) IsNoUserModificationWithMigrationDisabled() bool + func (s *SchemaValue) IsSingle() bool + func (s *SchemaValue) Name() string + func (s *SchemaValue) Norm() []interface{} + func (s *SchemaValue) NormStr() []string + func (s *SchemaValue) Orig() []string + type SchemaValueMap struct + func (m SchemaValueMap) Has(val string) bool + func (m SchemaValueMap) Put(val string) + type SearchEntry struct + func NewSearchEntry(schemaMap *SchemaMap, dnOrig string, valuesOrig map[string][]string) *SearchEntry + func (j *SearchEntry) DNOrig() string + func (j *SearchEntry) GetAttrOrig(attrName string) (string, []string, bool) + func (j *SearchEntry) GetAttrsOrig() map[string][]string + func (j *SearchEntry) GetAttrsOrigWithoutOperationalAttrs() map[string][]string + func (j *SearchEntry) GetOperationalAttrsOrig() map[string][]string + type SearchOption struct + Filter message.Filter + IsHasSubordinatesRequested bool + IsMemberOfRequested bool + Offset int32 + PageSize int32 + RequestedAssocation []string + Scope int + type Server struct + Suffix *DN + func NewServer(c *ServerConfig) *Server + func (s *Server) DCRDN() string + func (s *Server) GetRootDN() *DN + func (s *Server) GetRootPW() string + func (s *Server) GetSuffix() string + func (s *Server) LoadSchema() + func (s *Server) NormalizeDN(dn string) (*DN, error) + func (s *Server) Repo() Repository + func (s *Server) RequiredAuthz(m *ldap.Message, ops LDAPAction, targetDN *DN) bool + func (s *Server) Start(bindAddress string) + func (s *Server) Stop() + func (s *Server) SuffixNorm() []string + func (s *Server) SuffixOrig() []string + func (s *Server) SuffixOrigStr() string + type ServerConfig struct + BindAddress string + DBHostName string + DBMaxIdleConns int + DBMaxOpenConns int + DBName string + DBPassword string + DBPort int + DBSchema string + DBUser string + DefaultPPolicyDN string + GoMaxProcs int + LogLevel string + MigrationEnabled bool + PProfServer string + PassThroughConfig *PassThroughConfig + QueryTranslator string + RootDN string + RootPW string + SimpleACL []string + Suffix string + type SimpleACL struct + func NewSimpleACL(server *Server) (*SimpleACL, error) + func (s *SimpleACL) CanRead(session *AuthSession) bool + func (s *SimpleACL) CanVisible(session *AuthSession, attrName string) bool + func (s *SimpleACL) CanWrite(session *AuthSession) bool + type SimpleACLDef struct + InvisibleAttributes StringSet + Scope SimpleACLScopeSet + type SimpleACLScope int + const ReadScope + const WriteScope + func (c SimpleACLScope) String() string + type SimpleACLScopeSet map[SimpleACLScope]struct + func (s SimpleACLScopeSet) Add(scope SimpleACLScope) + func (s SimpleACLScopeSet) Contains(scope SimpleACLScope) bool + type StmtCache struct + func (m *StmtCache) Get(key string) (*sqlx.NamedStmt, bool) + func (m *StmtCache) Put(key string, value *sqlx.NamedStmt) + type StringSet map[string]struct + func NewStringSet(str ...string) StringSet + func (s StringSet) Add(str string) + func (s StringSet) Contains(str string) bool + func (s StringSet) First() string + func (s StringSet) Size() int + func (s StringSet) Values() []string v0.12.0 Dec 14, 2021