Documentation
¶
Overview ¶
Package schema has the LDAP manager's types: objects, with their LDIF, distinguished names, and the directory's object classes and attribute types, with the requests which list them, and its defaults
Index ¶
- Constants
- Variables
- type AttributeType
- type AttributeTypeListRequest
- type AttributeTypeListResponse
- type AttributeUsage
- type Attrs
- type DN
- type Group
- type GroupListRequest
- type ListRequest
- type Object
- type ObjectClass
- type ObjectClassFor
- type ObjectClassKind
- type ObjectClassListRequest
- type ObjectClassListResponse
- type ObjectList
- type ObjectListRequest
- type ObjectPasswordRequest
- type ObjectPutRequest
- type OffsetLimit
- type PasswordResponse
- type Status
- type UserListRequest
Constants ¶
const ( SchemaName = "ldap" MethodPlain = "ldap" MethodSecure = "ldaps" PortPlain = 389 PortSecure = 636 // Time to wait for the directory to connect, or answer a request RequestTimeout = time.Second * 30 // Time between connection retries MinRetryInterval = time.Second * 5 MaxRetries = 10 // Maximum number of entries to return in a single request MaxListPaging = 500 // Maximum list entries to return MaxListEntries = 1000 // Attributes AttrObjectClasses = "objectClasses" AttrAttributeTypes = "attributeTypes" AttrSubSchemaDN = "subschemaSubentry" // Scopes of the HTTP handlers: reading the directory, and changing it, // which includes binding as an entry, and changing its password ScopeLDAPRead = "ldap:read" ScopeLDAPWrite = "ldap:write" // Tables of the changes the manager publishes, with SchemaName as their // schema TableObject = "object" TableUser = "user" TableGroup = "group" TableConnection = "connection" // Initial GID/UID allocated when the lastgid/lastuid device entry is first created InitialGID = 1000 InitialUID = 1000 )
Variables ¶
var DefaultGroupObjectClasses = []string{"groupOfNames"}
DefaultGroupObjectClasses is used when no group object classes are configured.
var DefaultUserObjectClasses = []string{"inetOrgPerson"}
DefaultUserObjectClasses is used when no user object classes are configured.
var WellKnownGroupClasses = []string{"group", "posixGroup", "groupOfNames", "groupOfUniqueNames", "groupOfMembers"}
WellKnownGroupClasses is the list of object classes checked during auto-discovery.
var WellKnownUserAuxiliaryClasses = []string{"posixAccount"}
WellKnownUserAuxiliaryClasses is the list of auxiliary user classes checked during auto-discovery.
var WellKnownUserClasses = []string{"user", "inetOrgPerson", "organizationalPerson", "person", "account"}
WellKnownUserClasses is the list of structural object classes checked during auto-discovery.
Functions ¶
This section is empty.
Types ¶
type AttributeType ¶
type AttributeType struct {
*schemadef.AttributeTypeSchema
}
func ParseAttributeType ¶
func ParseAttributeType(v string) (*AttributeType, error)
func (*AttributeType) Clone ¶ added in v0.0.15
func (o *AttributeType) Clone() *AttributeType
Clone returns a copy of the attribute type, which shares nothing with it
func (*AttributeType) Identifier ¶
func (o *AttributeType) Identifier() string
func (*AttributeType) Matches ¶
func (o *AttributeType) Matches(req AttributeTypeListRequest) bool
func (AttributeType) String ¶
func (o AttributeType) String() string
type AttributeTypeListRequest ¶
type AttributeTypeListRequest struct {
OffsetLimit
Filter *string `json:"filter,omitempty" help:"Exact attribute name or OID match (case-insensitive for names)" arg:"" optional:""`
Usage *AttributeUsage `json:"usage,omitempty" help:"Attribute usage" enum:"userApplications,directoryOperation,distributedOperation,dSAOperation"`
Superior *string `json:"superior,omitempty" help:"Exact superior attribute type match"`
Obsolete *bool `json:"obsolete,omitempty" help:"Filter obsolete attribute types"`
SingleValue *bool `json:"singleValue,omitempty" help:"Filter single-value attribute types" name:"single-value"`
Collective *bool `json:"collective,omitempty" help:"Filter collective attribute types"`
NoUserModification *bool `json:"noUserModification,omitempty" help:"Filter non-user-modifiable attribute types" name:"no-user-modification"`
}
func (AttributeTypeListRequest) Query ¶
func (req AttributeTypeListRequest) Query() url.Values
func (AttributeTypeListRequest) String ¶
func (o AttributeTypeListRequest) String() string
type AttributeTypeListResponse ¶
type AttributeTypeListResponse struct {
Count uint64 `json:"count" help:"Total number of matching attribute types before pagination"`
Body []*AttributeType `json:"body,omitempty" help:"Attribute types returned for the current page"`
}
func (AttributeTypeListResponse) String ¶
func (o AttributeTypeListResponse) String() string
type AttributeUsage ¶
type AttributeUsage string
const ( AttributeUsageUserApplications AttributeUsage = AttributeUsage(schemadef.AttributeUsageUserApplications) AttributeUsageDirectoryOperation AttributeUsage = AttributeUsage(schemadef.AttributeUsageDirectoryOperation) AttributeUsageDistributedOperation AttributeUsage = AttributeUsage(schemadef.AttributeUsageDistributedOperation) AttributeUsageDSAOperation AttributeUsage = AttributeUsage(schemadef.AttributeUsageDSAOperation) )
func (AttributeUsage) String ¶
func (o AttributeUsage) String() string
type Attrs ¶ added in v0.0.15
Attrs are the attributes of an object, and their values. In JSON, a value is a string, or, when it isn't UTF-8, such as a certificate, an object with its bytes in base64: {"base64": "..."}
func (Attrs) JSONSchema ¶ added in v0.0.15
func (Attrs) JSONSchema() *jsonschema.Schema
JSONSchema returns the schema of the attributes' JSON, whose values are strings, or {"base64": "..."}, as MarshalJSON writes them, rather than strings, as the type says
func (Attrs) MarshalJSON ¶ added in v0.0.15
func (*Attrs) UnmarshalJSON ¶ added in v0.0.15
type DN ¶
func (*DN) AncestorOf ¶
type GroupListRequest ¶ added in v0.0.15
type GroupListRequest struct {
ListRequest
User *string `json:"user,omitempty" help:"The name of a user whose groups are listed"`
UserDN *string `json:"user_dn,omitempty" help:"The DN of a user whose groups are listed, rather than its name"`
}
GroupListRequest is a list request, which has only the groups of the user, when it's set
func (GroupListRequest) Query ¶ added in v0.0.15
func (req GroupListRequest) Query() url.Values
Query returns the request as query parameters
func (GroupListRequest) String ¶ added in v0.0.15
func (req GroupListRequest) String() string
type ListRequest ¶ added in v0.0.15
type ListRequest struct {
OffsetLimit
Filter *string `json:"filter,omitempty" help:"Filter"`
Attr []string `json:"attr,omitempty" help:"Attributes to return"`
}
ListRequest is the paging, filter and attributes of a list of entries
func (ListRequest) Query ¶ added in v0.0.15
func (req ListRequest) Query() url.Values
Query returns the request as query parameters
func (ListRequest) String ¶ added in v0.0.15
func (o ListRequest) String() string
type Object ¶
func NewObjectFromEntry ¶
func (*Object) WithPassword ¶
func (o *Object) WithPassword(password *string) *PasswordResponse
WithPassword embeds a generated password into the response object using the PasswordResponse wrapper. An empty password leaves the password field unset.
type ObjectClass ¶
type ObjectClass struct {
*schemadef.ObjectClassSchema
}
func ParseObjectClass ¶
func ParseObjectClass(v string) (*ObjectClass, error)
func (*ObjectClass) Clone ¶ added in v0.0.15
func (o *ObjectClass) Clone() *ObjectClass
Clone returns a copy of the object class, which shares nothing with it
func (*ObjectClass) Identifier ¶
func (o *ObjectClass) Identifier() string
func (*ObjectClass) Matches ¶
func (o *ObjectClass) Matches(req ObjectClassListRequest) bool
func (ObjectClass) String ¶
func (o ObjectClass) String() string
type ObjectClassFor ¶ added in v0.0.15
type ObjectClassFor string
ObjectClassFor is what's created with the classes: users or groups
const ( ObjectClassForUser ObjectClassFor = "user" ObjectClassForGroup ObjectClassFor = "group" )
type ObjectClassKind ¶
type ObjectClassKind string
const ( ObjectClassKindAbstract ObjectClassKind = ObjectClassKind(schemadef.ObjectClassKindAbstract) ObjectClassKindStructural ObjectClassKind = ObjectClassKind(schemadef.ObjectClassKindStructural) ObjectClassKindAuxiliary ObjectClassKind = ObjectClassKind(schemadef.ObjectClassKindAuxiliary) )
func (ObjectClassKind) String ¶
func (o ObjectClassKind) String() string
type ObjectClassListRequest ¶
type ObjectClassListRequest struct {
OffsetLimit
Filter *string `json:"filter,omitempty" help:"Exact class name or OID match (case-insensitive for names)" arg:"" optional:""`
Kind *ObjectClassKind `json:"kind,omitempty" help:"Class kind" enum:"ABSTRACT,STRUCTURAL,AUXILIARY"`
Superior []string `json:"superior,omitempty" help:"Required superior classes"`
Must []string `json:"must,omitempty" help:"Required MUST attributes"`
May []string `json:"may,omitempty" help:"Required MAY attributes"`
Obsolete *bool `json:"obsolete,omitempty" help:"Filter obsolete classes"`
For *ObjectClassFor `json:"for,omitempty" help:"Only the classes users, or groups, are created with, and their superiors" enum:"user,group"`
}
func (ObjectClassListRequest) Query ¶
func (req ObjectClassListRequest) Query() url.Values
func (ObjectClassListRequest) String ¶
func (o ObjectClassListRequest) String() string
type ObjectClassListResponse ¶
type ObjectClassListResponse struct {
Count uint64 `json:"count" help:"Total number of matching object classes before pagination"`
Body []*ObjectClass `json:"body,omitempty" help:"Object classes returned for the current page"`
}
func (ObjectClassListResponse) String ¶
func (o ObjectClassListResponse) String() string
type ObjectList ¶
func (ObjectList) LDIF ¶
func (o ObjectList) LDIF() string
func (ObjectList) String ¶
func (o ObjectList) String() string
type ObjectListRequest ¶
type ObjectListRequest struct {
ListRequest
Prefix *string `json:"prefix,omitempty" help:"DN of the subtree, relative to the base DN"`
Children bool `json:"children,omitempty" help:"Only the children of the prefix, or of the base DN, rather than the subtree"`
}
ObjectListRequest is a list request, of the entries under the base DN, or, with a prefix, the subtree of the DN under it
func (ObjectListRequest) Query ¶
func (req ObjectListRequest) Query() url.Values
Query returns the request as query parameters
func (ObjectListRequest) String ¶
func (o ObjectListRequest) String() string
type ObjectPasswordRequest ¶
type ObjectPasswordRequest struct {
Old string `json:"old,omitempty"`
New *string `json:"new,omitempty"`
}
func (ObjectPasswordRequest) String ¶
func (o ObjectPasswordRequest) String() string
type ObjectPutRequest ¶
type ObjectPutRequest struct {
Attrs Attrs `json:"attrs,omitempty"`
}
func (ObjectPutRequest) String ¶
func (o ObjectPutRequest) String() string
func (ObjectPutRequest) ValidateCreate ¶
func (req ObjectPutRequest) ValidateCreate() (url.Values, error)
func (ObjectPutRequest) ValidateUpdate ¶
func (req ObjectPutRequest) ValidateUpdate() (url.Values, error)
type OffsetLimit ¶ added in v0.0.15
type OffsetLimit struct {
Offset uint64 `json:"offset,omitempty" help:"Offset within the result set" jsonschema:"Offset for pagination" example:"0"`
Limit *uint64 `json:"limit,omitempty" help:"Number of items to return" jsonschema:"Limit for pagination" example:"100"`
}
OffsetLimit pages a list
type PasswordResponse ¶
type PasswordResponse struct {
Object
GeneratedPassword string `json:"generated-password,omitempty"`
}
func (PasswordResponse) LDIF ¶
func (o PasswordResponse) LDIF() string
func (PasswordResponse) String ¶
func (o PasswordResponse) String() string
type Status ¶ added in v0.0.15
type Status struct {
Host string `json:"host" help:"Host of the directory"`
Port uint `json:"port" help:"Port of the directory"`
User string `json:"user" help:"DN the manager binds as"`
Connected bool `json:"connected" help:"Whether the manager is connected to the directory"`
BaseDN string `json:"base_dn" help:"Base DN, which every DN is under"`
UserDN string `json:"user_dn,omitempty" help:"DN of the users, when the manager has users"`
GroupDN string `json:"group_dn,omitempty" help:"DN of the groups, when the manager has groups"`
}
Status is the LDAP manager's directory, and whether it's connected, which a server's configuration has, for its frontend
type UserListRequest ¶ added in v0.0.15
type UserListRequest struct {
ListRequest
Group *string `json:"group,omitempty" help:"The name of a group whose members are listed"`
}
UserListRequest is a list request, which has only the members of the group, when it's set
func (UserListRequest) Query ¶ added in v0.0.15
func (req UserListRequest) Query() url.Values
Query returns the request as query parameters
func (UserListRequest) String ¶ added in v0.0.15
func (req UserListRequest) String() string