mirror of
https://github.com/versity/versitygw.git
synced 2026-07-30 12:02:59 +00:00
Merge pull request #273 from versity/ben/auth
fix: cleanup auth.New for service selection
This commit is contained in:
+9
-7
@@ -50,13 +50,15 @@ type Opts struct {
|
||||
}
|
||||
|
||||
func New(o *Opts) (IAMService, error) {
|
||||
if o.Dir == "" {
|
||||
if o.LDAPServerURL == "" {
|
||||
return IAMServiceSingle{}, nil
|
||||
} else {
|
||||
return NewLDAPService(o.LDAPServerURL, o.LDAPBindDN, o.LDAPPassword, o.LDAPQueryBase, o.LDAPAccessAtr, o.LDAPSecretAtr, o.LDAPRoleAtr, o.LDAPObjClasses)
|
||||
}
|
||||
} else {
|
||||
switch {
|
||||
case o.Dir != "":
|
||||
return NewInternal(o.Dir)
|
||||
case o.LDAPServerURL != "":
|
||||
return NewLDAPService(o.LDAPServerURL, o.LDAPBindDN, o.LDAPPassword,
|
||||
o.LDAPQueryBase, o.LDAPAccessAtr, o.LDAPSecretAtr, o.LDAPRoleAtr,
|
||||
o.LDAPObjClasses)
|
||||
default:
|
||||
// if no iam options selected, default to the single user mode
|
||||
return IAMServiceSingle{}, nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user