sources

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authentik

type Authentik struct {
	V3 *api.APIClient
	// contains filtered or unexported fields
}

Authentik source

func NewAuthentikClient

func NewAuthentikClient(config SourceConfig) (Authentik, error)

NewAuthentikClient init Authentik source

func (Authentik) GetGroupByName

func (c Authentik) GetGroupByName(grounName string) (*models.Group, error)

GetGroupByName Get Authentik group by name

func (Authentik) GetGroupMembers

func (c Authentik) GetGroupMembers(groupId string, stripEmailDomain bool) ([]models.User, error)

GetGroupMembers Get Authentik group members

func (Authentik) GetUserInfo

func (c Authentik) GetUserInfo(userId string, stripEmailDomain bool) (models.User, error)

GetUserInfo get Authentik user info For Authentik is not used because Authentik returns group members while getting group info

type Jumpcloud

type Jumpcloud struct {
	V1          *jcapiv1.APIClient
	V1Auth      context.Context
	V2          *jcapiv2.APIClient
	V2Auth      context.Context
	ContentType string
}

Jumpcloud source

func NewJCClient

func NewJCClient(config SourceConfig) (Jumpcloud, error)

NewJCClient init Jumpcloud source

func (Jumpcloud) GetGroupByName

func (c Jumpcloud) GetGroupByName(grounName string) (*models.Group, error)

GetGroupByName Get Jumpcloud group by name

func (Jumpcloud) GetGroupMembers

func (c Jumpcloud) GetGroupMembers(groupID string, stripEmailDomain bool) ([]models.User, error)

GetGroupMembers gets ALL JumpCloud group members (handles pagination)

func (Jumpcloud) GetUserInfo

func (c Jumpcloud) GetUserInfo(userId string, stripEmailDomain bool) (models.User, error)

GetUserInfo get Jumpcloud user info

type LDAP added in v1.1.0

type LDAP struct {
	Addr     string // "host:389" or "host:636"
	UseTLS   bool   // true for LDAPS on 636 (preferred). If false, StartTLS is attempted.
	BindDN   string
	BindPass string
	BaseDN   string

	// Attribute preferences (override if your directory differs)
	GroupNameAttr      string   // usually "cn"
	UserEmailAttr      string   // AD: "mail" (or "userPrincipalName"); OpenLDAP/JumpCloud: "mail"
	UserLoginAttrs     []string // tried in order to produce username: e.g. ["sAMAccountName","uid","cn"]
	GroupMemberAttrs   []string // for DN members: ["member","uniqueMember"]
	PosixMemberUidAttr string   // for posixGroup usernames: "memberUid"
	UserObjectClasses  []string // e.g. ["person","organizationalPerson","user","inetOrgPerson"]
	GroupObjectClasses []string // e.g. ["groupOfNames","group","posixGroup"]

	// When true, if a member is a group DN, expand one level (NOT recursive).
	ExpandOneLevelNested bool

	// Domain used to synthesize an email when none is present (username@DefaultEmailDomain).
	DefaultEmailDomain string
}

LDAP implements Source for LDAP directories (AD / OpenLDAP / JumpCloud LDAPaaS). It supports:

  • groupOfNames / group via "member" / "uniqueMember" (DN-valued)
  • posixGroup via "memberUid" (login name / uid-valued)

func NewLDAPClient added in v1.1.0

func NewLDAPClient(config SourceConfig) (*LDAP, error)

NewLDAPClient constructs an LDAP client with sensible defaults.

func (*LDAP) GetGroupByName added in v1.1.0

func (c *LDAP) GetGroupByName(groupName string) (*models.Group, error)

GetGroupByName finds the first group whose GroupNameAttr (default "cn") exactly matches the provided groupName. It returns the group's DN as ID.

func (*LDAP) GetGroupMembers added in v1.1.0

func (c *LDAP) GetGroupMembers(groupID string, stripEmailDomain bool) ([]models.User, error)

GetGroupMembers returns users in the group identified by groupID (expected to be a DN). For posixGroup, it resolves memberUid logins to user entries. For groupOfNames/group, it resolves each member DN to a user entry. If ExpandOneLevelNested is true, a member that is itself a group will be expanded one level.

func (*LDAP) GetUserInfo added in v1.1.0

func (c *LDAP) GetUserInfo(userID string, stripEmailDomain bool) (models.User, error)

GetUserInfo resolves a user by ID. If userID looks like a DN, it loads that DN. Otherwise it treats userID as a login (sAMAccountName/uid/cn—config-driven) and searches.

type Source

type Source interface {
	GetGroupByName(grounName string) (*models.Group, error)
	GetGroupMembers(groupId string, stripEmailDomain bool) ([]models.User, error)
	GetUserInfo(userId string, stripEmailDomain bool) (models.User, error)
}

Source interface

func NewSource

func NewSource(config SourceConfig) (Source, error)

NewSource init source

type SourceConfig

type SourceConfig struct {
	Name                   string // Name source name
	Endpoint               string // Endpoint source endpoint
	Token                  string // Token source auth token
	LDAPBindPassword       string // LDAP bind password
	LDAPBindDN             string // LDAP BindDN
	LDAPBaseDN             string // LDAP BaseDN
	LDAPDefaultEmailDomain string // Default email domain what used for synthesize an email when none is present (username@DefaultEmailDomain).
}

SourceConfig config source

Jump to

Keyboard shortcuts

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