waterlock / waterlock-ldap-auth

LDAP authentication method for Waterlock http://waterlock.ninja/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

thumbnailPhoto corrupted in Auth model

corycollier opened this issue · comments

I'm using this package to query Active Directory for user authentication. The queried user comes back successfully. All aspects of this module appear to work correctly.

My issue, is that the only type I can store the thumbnailPhoto attribute as, is a binary one. When I try to extract that image, it's corrupted. I'm not entirely sure of the reason why.

I've attached my waterlock.js configuration here:

authMethod: [
    {
      name : "waterlock-ldap-auth",
      connection : {
        url             : "ldap://that-active-directory-server.com:389",
        bindDn          : "machine-user@domain.com",
        bindCredentials : "super-secret,
        searchBase      : "ou=Groupies,dc=THAT-ACTIVE-DIRECTORY-SERVER,dc=COM",
        searchFilter    : "(&(&(objectCategory=Person)(sAMAccountName={{username}})))",
        cache           : false,
        verbose         : true
      },
      attributes: {
        title: {
          title: {
            type: 'string'
          }
        },
        mail: {
          mail: {
            type: 'string',
            defaultsTo: ''
          }
        },
        thumbnailPhoto: {
          thumbnail: {
            type: 'binary',
          }
        },
        givenName: {
          firstName: {
            type: 'string',
            defaultsTo: ''
          }
        },
        sn: {
          lastName: {
            type: 'string'
          }
        },
        telephoneNumber: {
          workNumber: {
            type: 'string'
          }
        },
        department: {
          department: {
            type: 'string'
          }
        }
      }
    }