bindDN and bindPassword became optional for OpenLDAP.

This commit is contained in:
takezoe
2013-08-24 03:06:19 +09:00
parent f7de3bab74
commit cd298eb5c1
3 changed files with 10 additions and 10 deletions

View File

@@ -27,8 +27,8 @@ trait SystemSettingsControllerBase extends ControllerBase with FlashMapSupport {
"ldap" -> optionalIfNotChecked("ldapAuthentication", mapping( "ldap" -> optionalIfNotChecked("ldapAuthentication", mapping(
"host" -> trim(label("LDAP host", text(required))), "host" -> trim(label("LDAP host", text(required))),
"port" -> trim(label("LDAP port", optional(number()))), "port" -> trim(label("LDAP port", optional(number()))),
"bindDN" -> trim(label("Bind DN", text(required))), "bindDN" -> trim(label("Bind DN", optional(text()))),
"bindPassword" -> trim(label("Bind Password", text(required))), "bindPassword" -> trim(label("Bind Password", optional(text()))),
"baseDN" -> trim(label("Base DN", text(required))), "baseDN" -> trim(label("Base DN", text(required))),
"userNameAttribute" -> trim(label("User name attribute", text(required))), "userNameAttribute" -> trim(label("User name attribute", text(required))),
"mailAttribute" -> trim(label("Mail address attribute", text(required))) "mailAttribute" -> trim(label("Mail address attribute", text(required)))

View File

@@ -24,8 +24,8 @@ trait SystemSettingsService {
settings.ldap.map { ldap => settings.ldap.map { ldap =>
props.setProperty(LdapHost, ldap.host) props.setProperty(LdapHost, ldap.host)
ldap.port.foreach(x => props.setProperty(LdapPort, x.toString)) ldap.port.foreach(x => props.setProperty(LdapPort, x.toString))
props.setProperty(LdapBindDN, ldap.bindDN) ldap.bindDN.foreach(x => props.setProperty(LdapBindDN, x))
props.setProperty(LdapBindPassword, ldap.bindPassword) ldap.bindPassword.foreach(x => props.setProperty(LdapBindPassword, x))
props.setProperty(LdapBaseDN, ldap.baseDN) props.setProperty(LdapBaseDN, ldap.baseDN)
props.setProperty(LdapUserNameAttribute, ldap.userNameAttribute) props.setProperty(LdapUserNameAttribute, ldap.userNameAttribute)
props.setProperty(LdapMailAddressAttribute, ldap.mailAttribute) props.setProperty(LdapMailAddressAttribute, ldap.mailAttribute)
@@ -59,8 +59,8 @@ trait SystemSettingsService {
Some(Ldap( Some(Ldap(
getValue(props, LdapHost, ""), getValue(props, LdapHost, ""),
getOptionValue(props, LdapPort, Some(DefaultLdapPort)), getOptionValue(props, LdapPort, Some(DefaultLdapPort)),
getValue(props, LdapBindDN, ""), getOptionValue(props, LdapBindDN, None),
getValue(props, LdapBindPassword, ""), getOptionValue(props, LdapBindPassword, None),
getValue(props, LdapBaseDN, ""), getValue(props, LdapBaseDN, ""),
getValue(props, LdapUserNameAttribute, ""), getValue(props, LdapUserNameAttribute, ""),
getValue(props, LdapMailAddressAttribute, ""))) getValue(props, LdapMailAddressAttribute, "")))
@@ -86,8 +86,8 @@ object SystemSettingsService {
case class Ldap( case class Ldap(
host: String, host: String,
port: Option[Int], port: Option[Int],
bindDN: String, bindDN: Option[String],
bindPassword: String, bindPassword: Option[String],
baseDN: String, baseDN: String,
userNameAttribute: String, userNameAttribute: String,
mailAttribute: String) mailAttribute: String)

View File

@@ -22,8 +22,8 @@ object LDAPUtil {
bind( bind(
ldapSettings.host, ldapSettings.host,
ldapSettings.port.getOrElse(SystemSettingsService.DefaultLdapPort), ldapSettings.port.getOrElse(SystemSettingsService.DefaultLdapPort),
ldapSettings.bindDN, ldapSettings.bindDN.getOrElse(""),
ldapSettings.bindPassword ldapSettings.bindPassword.getOrElse("")
) match { ) match {
case Some(conn) => { case Some(conn) => {
withConnection(conn) { conn => withConnection(conn) { conn =>