{"id":34976662,"url":"https://github.com/cityssm/node-activedirectory-authenticate","last_synced_at":"2025-12-27T00:16:40.525Z","repository":{"id":303665175,"uuid":"1015601265","full_name":"cityssm/node-activedirectory-authenticate","owner":"cityssm","description":"Just Active Directory authentication and nothing more!","archived":false,"fork":false,"pushed_at":"2025-10-20T05:39:18.000Z","size":1016,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-21T08:47:41.066Z","etag":null,"topics":["active-directory","activedirectory","authentication","ldap","ldap-authentication","ldap-client"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@cityssm/activedirectory-authenticate","language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cityssm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-07T18:46:58.000Z","updated_at":"2025-07-22T18:37:03.000Z","dependencies_parsed_at":"2025-07-16T03:53:21.099Z","dependency_job_id":null,"html_url":"https://github.com/cityssm/node-activedirectory-authenticate","commit_stats":null,"previous_names":["cityssm/node-activedirectory-authenticate"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/cityssm/node-activedirectory-authenticate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cityssm%2Fnode-activedirectory-authenticate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cityssm%2Fnode-activedirectory-authenticate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cityssm%2Fnode-activedirectory-authenticate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cityssm%2Fnode-activedirectory-authenticate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cityssm","download_url":"https://codeload.github.com/cityssm/node-activedirectory-authenticate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cityssm%2Fnode-activedirectory-authenticate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28065959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-26T02:00:06.189Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["active-directory","activedirectory","authentication","ldap","ldap-authentication","ldap-client"],"created_at":"2025-12-27T00:16:39.838Z","updated_at":"2025-12-27T00:16:40.519Z","avatar_url":"https://github.com/cityssm.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Active Directory Authenticate for Node\n\n**Just Active Directory authentication and nothing more!**\n\n[![npm (scoped)](https://img.shields.io/npm/v/@cityssm/activedirectory-authenticate)](https://www.npmjs.com/package/@cityssm/activedirectory-authenticate)\n[![DeepSource](https://app.deepsource.com/gh/cityssm/node-activedirectory-authenticate.svg/?label=active+issues\u0026show_trend=true\u0026token=EnG9kg7Sta5TI_shO2yCySdX)](https://app.deepsource.com/gh/cityssm/node-activedirectory-authenticate/)\n[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=cityssm_node-activedirectory-authenticate\u0026metric=code_smells)](https://sonarcloud.io/summary/new_code?id=cityssm_node-activedirectory-authenticate)\n\nBased on the work in the deprecated packages\n[activedirectory2](https://www.npmjs.com/package/activedirectory2) and\n[ldapjs](https://www.npmjs.com/package/ldapjs).\n\n## Installation\n\n```sh\nnpm install @cityssm/activedirectory-authenticate\n```\n\n## Usage\n\n```javascript\nimport ActiveDirectoryAuthenticate from '@cityssm/activedirectory-authenticate'\n\nconst authenticator = new ActiveDirectoryAuthenticate(\n  {\n    url: 'ldap://example.com'\n  },\n  {\n    // The base distinguished name (DN) for the LDAP search.\n    baseDN: 'DC=example,DC=com',\n\n    // The DN of the user to bind to for searching the directory.\n    bindUserDN: 'CN=administrator,DC=example,DC=com',\n    bindUserPassword: 'p@ssword',\n\n    // Temporarily cache user bind DNs to reduce LDAP lookups on immediate retries,\n    // like typoed passwords.\n    cacheUserBindDNs: true\n  }\n)\n\nconst loginResult = await authenticator.authenticate(\n  'example\\\\userName',\n  'pass123'\n)\n\nif (loginResult.success) {\n  // Credentials validated, log the user in!\n} else {\n  console.log(loginResult.errorType)\n  // =\u003e \"ACCOUNT_NOT_FOUND\"\n}\n```\n\n## Options\n\n```javascript\nimport ActiveDirectoryAuthenticate from '@cityssm/activedirectory-authenticate'\n\nconst authenticator = new ActiveDirectoryAuthenticate(\n  ldapClientUrlOrOptions,\n  activeDirectoryAuthenticateOptions\n)\n```\n\n### `ldapClientUrlOrOptions`\n\nIn most situations, passing an LDAP URL should be sufficient.\n\nIf additional configuration is required, like timeout adjustments and TLS settings,\nsee the available [ldapts](https://www.npmjs.com/package/ldapts) initialization options.\n\n### `activeDirectoryAuthenticateOptions`\n\n| Option             | Description                                                          | Required         |\n| ------------------ | -------------------------------------------------------------------- | ---------------- |\n| `baseDN`           | The base distinguished name (DN) for the LDAP search.                | ⭐               |\n| `bindUserDN`       | The DN for the user to bind to for searching the directory.          | ⭐               |\n| `bindUserPassword` | The password for the `bindUserDN`.                                   | ⭐               |\n| `cacheUserBindDNs` | Whether or not to temporarily cache user bind DNs, reducing lookups. | Default: `false` |\n\n## Error Types\n\nActive Directory Authenticate provides descriptive error types,\nand translates the codes for common Active Directory errors.\nSee the `errorType` value in the result object.\n\n| Error Type              | Description                                   | Active Directory Code |\n| ----------------------- | --------------------------------------------- | --------------------- |\n| `CONFIGURATION_ERROR`   | Configuration error.                          |                       |\n| `EMPTY_USER_NAME`       | User name empty.                              |                       |\n| `EMPTY_PASSWORD`        | Password empty.                               |                       |\n| `ACCOUNT_NOT_FOUND`     | Unable to find the user via LDAP search.      |                       |\n| `LDAP_SEARCH_FAILED`    | Unknown error searching LDAP for the user.    |                       |\n| `AUTHENTICATION_FAILED` | Unknown authentication error.                 |                       |\n| `NO_SUCH_USER`          | User not found.                               | `525`                 |\n| `LOGON_FAILURE`         | Invalid credentials.                          | `52e`                 |\n| `INVALID_LOGIN_HOURS`   | User not permitted to logon at current time.  | `530`                 |\n| `INVALID_WORKSTATION`   | User not permitted to logon from workstation. | `531`                 |\n| `PASSWORD_EXPIRED`      | Password expired.                             | `532`                 |\n| `ACCOUNT_DISABLED`      | Account disabled.                             | `533`                 |\n| `INVALID_LOGIN_TYPE`    | User not granted the requested logon type.    | `534`                 |\n| `ACCOUNT_EXPIRED`       | Account expired.                              | `701`                 |\n| `PASSWORD_MUST_CHANGE`  | User must reset password.                     | `773`                 |\n| `ACCOUNT_LOCKED_OUT`    | User account locked.                          | `775`                 |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcityssm%2Fnode-activedirectory-authenticate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcityssm%2Fnode-activedirectory-authenticate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcityssm%2Fnode-activedirectory-authenticate/lists"}