Documentation ¶
Index ¶
- Variables
- func EscapeDN(dn string) string
- func EscapeSearch(dn string) string
- func FieldsToJSON(fields []Field) map[string]interface{}
- func FieldsToLDAP(fields []Field) map[string][]string
- func UnescapeDN(dn string) string
- func ValidateDN(dn string) error
- type Config
- type Field
- type FilterField
- type Resource
- func (res *Resource) Create(id string) error
- func (res *Resource) Delete(id string, ctx api.Viewpoint) error
- func (res *Resource) Field(name string) Field
- func (res *Resource) FromBody(body map[string]interface{}, viewpoint api.Viewpoint) map[string]error
- func (res *Resource) ID() string
- func (res *Resource) Read(id string) error
- func (res *Resource) ToBody(viewpoint api.Viewpoint) (map[string]interface{}, error)
- func (res *Resource) Update(id string) error
- type ResourceType
- func (resType *ResourceType) Authenticate(username string, password string) (api.User, error)
- func (resType *ResourceType) FormatDN(id string) string
- func (resType *ResourceType) List(query api.Query) ([]string, error)
- func (resType *ResourceType) ListCheck(viewpoint api.Viewpoint) error
- func (resType *ResourceType) MatchDN(dn string) bool
- func (resType *ResourceType) New() api.Resource
- func (resType *ResourceType) Schema() []api.FieldSchema
- func (resType *ResourceType) SetPassword(username string, newPassword string) error
- func (resType *ResourceType) Setup() error
- func (resType *ResourceType) Signup(signup api.Signup, validateOnly bool) map[string]error
- func (resType *ResourceType) UnwrapDN(dn string) string
- type UpdatableField
Constants ¶
This section is empty.
Variables ¶
View Source
var Connection *ldap.Conn
Connection is used to access the LDAP directory tree for read & write access.
View Source
var SimpleConnection *ldap.Conn
SimpleConnection is used to authenticate users using a SimpleBind.
Functions ¶
func EscapeSearch ¶
func FieldsToJSON ¶
func FieldsToLDAP ¶
func UnescapeDN ¶
func ValidateDN ¶
Types ¶
type Config ¶
type Config struct { ConnectionURI string TrustInsecure bool BindUsername string BindPassword string }
func (Config) SetupPlugin ¶
type Field ¶
type Field interface { Setup() error New() Field // Create a new field from this type. Throws an error on configuration problems. Name() string // Get the user-specified unique name of this field, for the frontend API and errors/logging. Schema() api.FieldSchema // Get the frontend format instructions in JSON format - field.FromJSON(field.ToJSON().Value) should not change the value. GetViews() api.FieldViews FromLDAP(map[string][]string) error // Override the field's value from a source with LDAP format - when using field.FromLDAP(field.ToLDAP()), the result should be the same as before. Should throw an error only if the LDAP is in an invalid state. ToLDAP() map[string][]string // Get the LDAP fields representing this field's value - when using field.FromLDAP(field.ToLDAP()), the result should be the same as before. FromJSON(interface{}) error // Override the field's value from a JSON value - field.FromJSON(field.ToJSON().Value) should not change the value. Should throw an error if the value is invalid. ToJSON() interface{} // Get the frontend-formatted value }
Field represents an instance of a field, like "Max's main email address". It must be created by calling LDAPType.New().
type FilterField ¶
type Resource ¶
type Resource struct { Type *ResourceType // The class this object is an instance of. Fields []Field // The list of fields this object can have. }
Resource is an instance of ResourceType, e.g. "the user Max". It must be created by calling ResourceType.New().
func (*Resource) FromBody ¶
func (res *Resource) FromBody(body map[string]interface{}, viewpoint api.Viewpoint) map[string]error
Validate & apply the request body of a POST or PUT request & populate the ID
type ResourceType ¶
type ResourceType struct { SearchBase string SearchFilter string DNTemplate string // A text/template for the object DNs (with the LDAP object's representation as the root context). ObjectClasses []string // The LDAP object classes for objects of this type. Views api.ResourceViews NameField string EmailField string MemberOfField string IdentifierField string PasswordField string Fields []Field // The field types objects of this class can have. }
ResourceType represents a resource type containing LDAP objects (e.g. users).
func (*ResourceType) Authenticate ¶
func (*ResourceType) FormatDN ¶
func (resType *ResourceType) FormatDN(id string) string
func (*ResourceType) ListCheck ¶
func (resType *ResourceType) ListCheck(viewpoint api.Viewpoint) error
func (*ResourceType) MatchDN ¶
func (resType *ResourceType) MatchDN(dn string) bool
func (*ResourceType) New ¶
func (resType *ResourceType) New() api.Resource
New creates an instance of this class.
func (*ResourceType) Schema ¶
func (resType *ResourceType) Schema() []api.FieldSchema
func (*ResourceType) SetPassword ¶
func (resType *ResourceType) SetPassword(username string, newPassword string) error
func (*ResourceType) Setup ¶
func (resType *ResourceType) Setup() error
func (*ResourceType) UnwrapDN ¶
func (resType *ResourceType) UnwrapDN(dn string) string
type UpdatableField ¶
Click to show internal directories.
Click to hide internal directories.