Commit 203c1afe authored by Leonardo Menezes's avatar Leonardo Menezes
Browse files

use user domain to complete username

closes #101
parent 0f17656a
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -21,7 +21,11 @@ class LDAPAuthService @Inject()(globalConfig: Configuration) extends AuthService
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory")
    env.put(Context.PROVIDER_URL, s"${config.url}/${config.baseDN}")
    env.put(Context.SECURITY_AUTHENTICATION, config.method)
    if (username.endsWith(s"@${config.domain}")) {
      env.put(Context.SECURITY_PRINCIPAL, username)
    } else {
      env.put(Context.SECURITY_PRINCIPAL, s"$username@${config.domain}")
    }
    env.put(Context.SECURITY_CREDENTIALS, password)

    try {