Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/liut/staffio-backend
Backend data storage of staffio
https://github.com/liut/staffio-backend
golang ldap staffio
Last synced: 9 days ago
JSON representation
Backend data storage of staffio
- Host: GitHub
- URL: https://github.com/liut/staffio-backend
- Owner: liut
- License: mit
- Created: 2019-10-25T16:47:34.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-12-12T08:44:28.000Z (about 2 months ago)
- Last Synced: 2024-12-12T09:34:19.397Z (about 2 months ago)
- Topics: golang, ldap, staffio
- Language: Go
- Size: 75.2 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# staffio-backend
Data storage of staffio with LDAP
[![Build Status](https://travis-ci.org/liut/staffio-backend.svg?branch=master)](https://travis-ci.org/liut/staffio-backend)
[![codecov](https://codecov.io/gh/liut/staffio-backend/branch/master/graph/badge.svg)](https://codecov.io/gh/liut/staffio-backend)## Features
### People interface
* Save and update a People
* Modify by self or admin
* Change password by self or admin
* Delete a People
* Authenticate with UID and password
* Browse with paged### Group interface
* Create a group
* Delete by admin
* Browse all group## Objects
### People
```go
type People struct {
UID string
CommonName string
GivenName string
Surname string
Nickname string
Birthday string
Gender string
Email string
Mobile string
Tel string
EmployeeNumber string
EmployeeType string
AvatarPath string
JpegPhoto []byte
Description string
JoinDate string
IDCN stringOrganization string
OrgDepartment string
}
```### Group
```go
type Group struct {
Name string `json:"name"`
Description string `json:"description"`
Members []string `json:"members"`
}
```## Variables in environment
| Name | Default value | Note |
| ------------ | ------------------ | ---- |
| `LDAP_HOSTS` | localhost | LDAP server addresses starting with `ldap://` or `ldaps://`, separated by commas if there are multiple. |
| `LDAP_BASE` | dc=mydomain,dc=net | `AD`/`LDAP` base, required |
| `LDAP_DOMAIN` | mydomain.net | Suffix of `UPN`, recommend set it |
| `LDAP_BIND_DN` | | `DN` of LDAP Admin or other writable user |
| `LDAP_PASSWD` | | Password of LDAP Admin or other writable user |## Usage example
```go
import "github.com/liut/staffio-backend/ldap"
main () {
cfg := ldap.NewConfig()store, err := ldap.NewStore(cfg)
if err != nil {
log.Fatalf("new ldap store ERR %s", err)
}err = store.Ready()
if err != nil {
log.Fatalf("the store ready failed, ERR %s", err)
}uid := "eagle"
passwrod := "mypassword"people, err := store.Authenticate(uid, password)
if err != nil {
log.Fatalf("login failed, ERR %s", err)
}log.Printf("welcome %s", people.Name())
}