{"action":"closed","issue":{"url":"https://api.github.com/repos/vesse/node-ldapauth-fork/issues/24","labels_url":"https://api.github.com/repos/vesse/node-ldapauth-fork/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/vesse/node-ldapauth-fork/issues/24/comments","events_url":"https://api.github.com/repos/vesse/node-ldapauth-fork/issues/24/events","html_url":"https://github.com/vesse/node-ldapauth-fork/issues/24","id":110184678,"number":24,"title":"Write After End Problem for TLS connection","user":{"login":"emrahayanoglu","id":126325,"avatar_url":"https://avatars.githubusercontent.com/u/126325?v=3","gravatar_id":"","url":"https://api.github.com/users/emrahayanoglu","html_url":"https://github.com/emrahayanoglu","followers_url":"https://api.github.com/users/emrahayanoglu/followers","following_url":"https://api.github.com/users/emrahayanoglu/following{/other_user}","gists_url":"https://api.github.com/users/emrahayanoglu/gists{/gist_id}","starred_url":"https://api.github.com/users/emrahayanoglu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emrahayanoglu/subscriptions","organizations_url":"https://api.github.com/users/emrahayanoglu/orgs","repos_url":"https://api.github.com/users/emrahayanoglu/repos","events_url":"https://api.github.com/users/emrahayanoglu/events{/privacy}","received_events_url":"https://api.github.com/users/emrahayanoglu/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-07T09:24:50Z","updated_at":"2015-10-08T10:53:46Z","closed_at":"2015-10-08T10:53:46Z","body":"Hi,\r\n\r\nI try to connect and login through LDAP using the following code:\r\n\r\n ```javascript\r\nldap_auth.authenticate(user.name, user.pass, function(err, ldap_user) {\r\n                logger.info(\"LDAP authentication will be checked for user: \" + user.name);\r\n                if (ldap_user) {\r\n                        logger.info(ldap_user);\r\n                        req.session.authentication = 1;\r\n                        return next();\r\n                } else {\r\n                        logger.warn(\"LDAP authentication is not valid: \" + user.name);\r\n                        logger.warn(err);\r\n                        req.session.authentication = 1;\r\n                        return next();\r\n                }\r\n        });\r\n```\r\n\r\nAnd my configuration settings is like that:\r\n```javascript\r\nldap_options = {\r\n                        url: ldap_url,\r\n                        searchBase: 'cn=admins,ou=Groups,dc=local',\r\n                        searchFilter: '(uid={{username}})',\r\n                        verbose:true,\r\n                        cache:true,\r\n                        tlsOptions: {\r\n                                  ca: [ca_file_content]\r\n                        }\r\n};\r\n\r\n```\r\n\r\nHowever, whenever I try to login, I've got following error:\r\n>warn:  Error: write after end\r\n>    at writeAfterEnd (_stream_writable.js:167:12)\r\n>    at TLSSocket.Writable.write (_stream_writable.js:214:5)\r\n>    at TLSSocket.Socket.write (net.js:634:40)\r\n    at Client._send (/var/ums/umsRemoteAccessProxy/node_modules/ldapauth-fork/node_modules/ldapjs/lib/client/client.js:914:17)\r\n    at Client.search (/var/ums/umsRemoteAccessProxy/node_modules/ldapauth-fork/node_modules/ldapjs/lib/client/client.js:678:15)\r\n    at /var/ums/umsRemoteAccessProxy/node_modules/ldapauth-fork/lib/ldapauth.js:196:23\r\n    at LdapAuth._adminBind (/var/ums/umsRemoteAccessProxy/node_modules/ldapauth-fork/lib/ldapauth.js:165:12)\r\n    at LdapAuth._search (/var/ums/umsRemoteAccessProxy/node_modules/ldapauth-fork/lib/ldapauth.js:192:8)\r\n    at LdapAuth._findUser (/var/ums/umsRemoteAccessProxy/node_modules/ldapauth-fork/lib/ldapauth.js:252:8)\r\n    at LdapAuth.authenticate (/var/ums/umsRemoteAccessProxy/node_modules/ldapauth-fork/lib/ldapauth.js:308:8)\r\n\r\nActually, I try to re-initialize the ldap client per each request; however, it gives another error: LDAP connection closed. I'm stuck currently. Do you have any idea about that? "}}