mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2025-02-12 18:01:16 +00:00
Compare commits
No commits in common. "8d2adad509662ce8d8681a06214b1ac0c9015fa5" and "849196b4cb1b7cea9347bc62bd9ea8baa2217b56" have entirely different histories.
8d2adad509
...
849196b4cb
@ -3,12 +3,10 @@ package ldap
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-ldap/ldap/v3"
|
"github.com/go-ldap/ldap/v3"
|
||||||
"log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Options holds package configuration
|
// Options holds package configuration
|
||||||
type Options struct {
|
type Options struct {
|
||||||
Aliases map[string]string
|
|
||||||
URI string
|
URI string
|
||||||
UserDn string
|
UserDn string
|
||||||
}
|
}
|
||||||
@ -22,12 +20,6 @@ type LDAP struct {
|
|||||||
// Login tries to bind to LDAP
|
// Login tries to bind to LDAP
|
||||||
// Returns (true, nil) if success
|
// Returns (true, nil) if success
|
||||||
func (a LDAP) Login(username string, password string) (bool, error) {
|
func (a LDAP) Login(username string, password string) (bool, error) {
|
||||||
// Resolve stream alias if necessary
|
|
||||||
for aliasFor, ok := a.Cfg.Aliases[username]; ok; aliasFor, ok = a.Cfg.Aliases[username] {
|
|
||||||
log.Printf("[LDAP] Use stream alias %s for username %s", username, aliasFor)
|
|
||||||
username = aliasFor
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to bind as user
|
// Try to bind as user
|
||||||
bindDn := "cn=" + username + "," + a.Cfg.UserDn
|
bindDn := "cn=" + username + "," + a.Cfg.UserDn
|
||||||
err := a.Conn.Bind(bindDn, password)
|
err := a.Conn.Bind(bindDn, password)
|
||||||
|
@ -34,11 +34,6 @@ auth:
|
|||||||
#ldap:
|
#ldap:
|
||||||
# uri: ldap://127.0.0.1:389
|
# uri: ldap://127.0.0.1:389
|
||||||
# userdn: cn=users,dc=example,dc=com
|
# userdn: cn=users,dc=example,dc=com
|
||||||
#
|
|
||||||
# # You can define aliases, to stream on stream.example.com/example with the credentials of the demo account.
|
|
||||||
# aliases:
|
|
||||||
# example: demo
|
|
||||||
#
|
|
||||||
|
|
||||||
## Stream forwarding ##
|
## Stream forwarding ##
|
||||||
# Forward an incoming stream to other servers
|
# Forward an incoming stream to other servers
|
||||||
|
@ -42,7 +42,6 @@ func New() *Config {
|
|||||||
Credentials: make(map[string]string),
|
Credentials: make(map[string]string),
|
||||||
},
|
},
|
||||||
LDAP: ldap.Options{
|
LDAP: ldap.Options{
|
||||||
Aliases: make(map[string]string),
|
|
||||||
URI: "ldap://127.0.0.1:389",
|
URI: "ldap://127.0.0.1:389",
|
||||||
UserDn: "cn=users,dc=example,dc=com",
|
UserDn: "cn=users,dc=example,dc=com",
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user