mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 13:35:50 +01:00
bindDN and bindPassword became optional for OpenLDAP.
This commit is contained in:
@@ -27,8 +27,8 @@ trait SystemSettingsControllerBase extends ControllerBase with FlashMapSupport {
|
||||
"ldap" -> optionalIfNotChecked("ldapAuthentication", mapping(
|
||||
"host" -> trim(label("LDAP host", text(required))),
|
||||
"port" -> trim(label("LDAP port", optional(number()))),
|
||||
"bindDN" -> trim(label("Bind DN", text(required))),
|
||||
"bindPassword" -> trim(label("Bind Password", text(required))),
|
||||
"bindDN" -> trim(label("Bind DN", optional(text()))),
|
||||
"bindPassword" -> trim(label("Bind Password", optional(text()))),
|
||||
"baseDN" -> trim(label("Base DN", text(required))),
|
||||
"userNameAttribute" -> trim(label("User name attribute", text(required))),
|
||||
"mailAttribute" -> trim(label("Mail address attribute", text(required)))
|
||||
|
||||
@@ -24,8 +24,8 @@ trait SystemSettingsService {
|
||||
settings.ldap.map { ldap =>
|
||||
props.setProperty(LdapHost, ldap.host)
|
||||
ldap.port.foreach(x => props.setProperty(LdapPort, x.toString))
|
||||
props.setProperty(LdapBindDN, ldap.bindDN)
|
||||
props.setProperty(LdapBindPassword, ldap.bindPassword)
|
||||
ldap.bindDN.foreach(x => props.setProperty(LdapBindDN, x))
|
||||
ldap.bindPassword.foreach(x => props.setProperty(LdapBindPassword, x))
|
||||
props.setProperty(LdapBaseDN, ldap.baseDN)
|
||||
props.setProperty(LdapUserNameAttribute, ldap.userNameAttribute)
|
||||
props.setProperty(LdapMailAddressAttribute, ldap.mailAttribute)
|
||||
@@ -59,8 +59,8 @@ trait SystemSettingsService {
|
||||
Some(Ldap(
|
||||
getValue(props, LdapHost, ""),
|
||||
getOptionValue(props, LdapPort, Some(DefaultLdapPort)),
|
||||
getValue(props, LdapBindDN, ""),
|
||||
getValue(props, LdapBindPassword, ""),
|
||||
getOptionValue(props, LdapBindDN, None),
|
||||
getOptionValue(props, LdapBindPassword, None),
|
||||
getValue(props, LdapBaseDN, ""),
|
||||
getValue(props, LdapUserNameAttribute, ""),
|
||||
getValue(props, LdapMailAddressAttribute, "")))
|
||||
@@ -86,8 +86,8 @@ object SystemSettingsService {
|
||||
case class Ldap(
|
||||
host: String,
|
||||
port: Option[Int],
|
||||
bindDN: String,
|
||||
bindPassword: String,
|
||||
bindDN: Option[String],
|
||||
bindPassword: Option[String],
|
||||
baseDN: String,
|
||||
userNameAttribute: String,
|
||||
mailAttribute: String)
|
||||
|
||||
@@ -22,8 +22,8 @@ object LDAPUtil {
|
||||
bind(
|
||||
ldapSettings.host,
|
||||
ldapSettings.port.getOrElse(SystemSettingsService.DefaultLdapPort),
|
||||
ldapSettings.bindDN,
|
||||
ldapSettings.bindPassword
|
||||
ldapSettings.bindDN.getOrElse(""),
|
||||
ldapSettings.bindPassword.getOrElse("")
|
||||
) match {
|
||||
case Some(conn) => {
|
||||
withConnection(conn) { conn =>
|
||||
|
||||
Reference in New Issue
Block a user