kamax-matrix / mxisd

Federated Matrix Identity Server
GNU Affero General Public License v3.0
223 stars 115 forks source link

missing bindDn or bindPassword in config should bind anonymously #27

Closed airblag closed 7 years ago

airblag commented 7 years ago

My infrastructure LDAP is allowing limited anonymous queries, so I just commented out the bindDn and bindPassword fields from the mxisd.yaml config file :

ldap:
  enabled: true
  tls: false
  host: '10.1.2.3'
  port: 389
  # bindDn: 'cn=user,dc=domain,dc=com'
  # bindPassword: 'notthatone'

mxisd starts correctly, but the first request to validate anything returns an exception (to the client):

{"timestamp":1504707331374,"status":500,"error":"Internal Server Error","exception":"groovy.lang.GroovyRuntimeException","message":"Ambiguous method overloading for method org.apache.directory.ldap.client.api.LdapNetworkConnection#bind.\nCannot resolve which method to invoke for [null, null] due to overlapping prototypes between:\n\t[class java.lang.String, class java.lang.String]\n\t[class org.apache.directory.api.ldap.model.name.Dn, class java.lang.String]","path":"/_matrix/identity/api/v1/lookup"}

Setting the fields to the empty string '' binds anonymously.

It would be good to set them to '' if they are null to avoid this.

maxidorius commented 7 years ago

@airblag Done in 4eb8c95