{"id":13897531,"url":"https://github.com/github/github-ldap","last_synced_at":"2025-04-04T20:15:11.099Z","repository":{"id":9381411,"uuid":"11240782","full_name":"github/github-ldap","owner":"github","description":"LDAP client for humans. Part of GitHub Enterprise.","archived":false,"fork":false,"pushed_at":"2022-08-15T20:49:46.000Z","size":442,"stargazers_count":155,"open_issues_count":6,"forks_count":27,"subscribers_count":312,"default_branch":"master","last_synced_at":"2025-03-28T19:11:26.873Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"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/github.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-07T21:50:26.000Z","updated_at":"2025-01-02T05:02:29.000Z","dependencies_parsed_at":"2022-08-29T21:50:42.425Z","dependency_job_id":null,"html_url":"https://github.com/github/github-ldap","commit_stats":null,"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fgithub-ldap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fgithub-ldap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fgithub-ldap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fgithub-ldap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/github","download_url":"https://codeload.github.com/github/github-ldap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247242681,"owners_count":20907134,"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","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":[],"created_at":"2024-08-06T18:03:40.091Z","updated_at":"2025-04-04T20:15:11.075Z","avatar_url":"https://github.com/github.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"\u003ca href=\"https://travis-ci.org/github/github-ldap\"\u003e![Build Status](https://travis-ci.org/github/github-ldap.png?branch=master)\u003c/a\u003e\n\n# Github::Ldap\n\nGitHub-Ldap is a wrapper on top of Net::LDAP to make it human friendly.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'github-ldap'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install github-ldap\n\n## Usage\n\n### Initialization\n\nGitHub-Ldap let you use an external ldap server to authenticate your users with.\n\nThere are a few configuration options required to use this adapter:\n\n* host: is the host address where the ldap server lives.\n* port: is the port where the ldap server lives.\n* hosts: (optional) an enumerable of pairs of hosts and corresponding ports with which to attempt opening connections (default [[host, port]]). Overrides host and port if set.\n* encryption: is the encryption protocol, disabled by default. The valid options are `ssl` and `tls`.\n* uid: is the field name in the ldap server used to authenticate your users, in ActiveDirectory this is `sAMAccountName`.\n\nUsing administrator credentials is optional but recommended. You can pass those credentials with these two options:\n\n* admin_user: is the the ldap administrator user dn.\n* admin_password: is the password for the administrator user.\n\nInitialize a new adapter using those required options:\n\n```ruby\n  ldap = GitHub::Ldap.new options\n```\n\nSee GitHub::Ldap#initialize for additional options.\n\n### Querying\n\nSearches are performed against an individual domain base, so the first step is to get a new `GitHub::Ldap::Domain` object for the connection:\n\n```ruby\n  ldap = GitHub::Ldap.new options\n  domain = ldap.domain(\"dc=github,dc=com\")\n```\n\nWhen we have the domain, we can check if a user can log in with a given password:\n\n```ruby\n  domain.valid_login? 'calavera', 'secret'\n```\n\nOr whether a user is member of the given groups:\n\n```ruby\n  entry = ldap.domain('uid=calavera,dc=github,dc=com').bind\n  domain.is_member? entry, %w(Enterprise)\n```\n\n### Virtual Attributes\n\nSome LDAP servers have support for virtual attributes, or overlays. These allow to perform queries more efficiently on the server.\n\nTo enable virtual attributes you can set the option `virtual_attributes` initializing the ldap connection.\nWe use our default set of virtual names if this option is just set to `true`.\n\n```ruby\n  ldap = GitHub::Ldap.new {virtual_attributes: true}\n```\n\nYou can also override our defaults by providing your server mappings into a Hash.\nThe only mapping supported for now is to check virtual membership of individuals in groups.\n\n```ruby\n  ldap = GitHub::Ldap.new {virtual_attributes: {virtual_membership: 'memberOf'}}\n```\n\n### Testing support\n\nGitHub-Ldap uses [ladle](https://github.com/NUBIC/ladle) for testing. Ladle is not required by default, so you'll need to add it to your gemfile separatedly and require it.\n\nOnce you have it installed you can start the testing ldap server in the setup phase for your tests:\n\n```ruby\nrequire 'github/ldap/server'\n\ndef setup\n  GitHub::Ldap.start_server\nend\n\ndef teardown\n  GitHub::Ldap.stop_server\nend\n```\n\nGitHub-Ldap includes a set of configured users for testing, but you can provide your own users into a ldif file:\n\n```ruby\ndef setup\n  GitHub::Ldap.start_server \\\n    user_fixtures: ldif_path\nend\n```\n\nIf you provide your own user fixtures, you'll probably need to change the default user domain, the administrator name and her password:\n\n```ruby\ndef setup\n  GitHub::Ldap.start_server \\\n    user_fixtures:  ldif_path,\n    user_domain:    'dc=evilcorp,dc=com'\n    admin_user:     'uid=eviladmin,dc=evilcorp,dc=com',\n    admin_password: 'correct horse battery staple'\nend\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n## Releasing\n\nThis section is for gem maintainers to cut a new version of the gem. See\n[jch/release-scripts](https://github.com/jch/release-scripts) for original\nsource of release scripts.\n\n* Create a new branch from `master` named `release-x.y.z`, where `x.y.z` is the version to be released\n* Update `github-ldap.gemspec` to x.y.z following [semver](http://semver.org)\n* Run `script/changelog` and paste the draft into `CHANGELOG.md`. Edit as needed\n* Create pull request to solict feedback\n* After merging the pull request, on the master branch, run `script/release`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fgithub-ldap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithub%2Fgithub-ldap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fgithub-ldap/lists"}