{"action":"created","comment":{"url":"https://api.github.com/repos/Mashape/kong/pulls/comments/77183183","id":77183183,"diff_hunk":"@@ -0,0 +1,41 @@\n+local BasePlugin = require \"kong.plugins.base_plugin\"\n+local BindConsumer = require \"kong.plugins.ldap-acl.bind_consumer\"\n+local cache = require \"kong.tools.database_cache\"\n+local responses = require \"kong.tools.responses\"\n+local singletons = require \"kong.singletons\"\n+\n+local LdapAclHandler = BasePlugin:extend()\n+\n+function LdapAclHandler:new()\n+  LdapAclHandler.super.new(self, \"ldap-acl\")\n+end\n+\n+function LdapAclHandler:access(conf)\n+  LdapAclHandler.super.access(self)\n+\n+  local ldap_authorization = ngx.ctx.authenticated_credential\n+\n+  if not ldap_authorization then\n+    return responses.send_HTTP_UNAUTHORIZED()\n+  end\n+\n+  if not ldap_authorization.username then\n+    return responses.send_HTTP_UNAUTHORIZED(\"Unkown username\")\n+  end\n+\n+  local bind_consumer = BindConsumer:new { dao = singletons.dao.consumers, cache = cache }\n+\n+  ngx.log(ngx.DEBUG, \"[ldap-acl] bind username between ldap and consumer:\" .. ldap_authorization.username)","path":"kong/plugins/ldap-acl/handler.lua","position":28,"original_position":28,"commit_id":"42d67a05521221109ffc315435ab42aea1b266c4","original_commit_id":"ac3802c289f3e51f3e7a539c6933bb8fee977b45","user":{"login":"Tieske","id":1077043,"avatar_url":"https://avatars.githubusercontent.com/u/1077043?v=3","gravatar_id":"","url":"https://api.github.com/users/Tieske","html_url":"https://github.com/Tieske","followers_url":"https://api.github.com/users/Tieske/followers","following_url":"https://api.github.com/users/Tieske/following{/other_user}","gists_url":"https://api.github.com/users/Tieske/gists{/gist_id}","starred_url":"https://api.github.com/users/Tieske/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tieske/subscriptions","organizations_url":"https://api.github.com/users/Tieske/orgs","repos_url":"https://api.github.com/users/Tieske/repos","events_url":"https://api.github.com/users/Tieske/events{/privacy}","received_events_url":"https://api.github.com/users/Tieske/received_events","type":"User","site_admin":false},"body":"do not use the `..` operator, just use comma's. `ngx.log`  will concatenate anyway. (arguments are evaluated before the function is called, so even if nothing is logged due to the level, the concatenation is still executed. If you pass the arguments, the log function will only concatenate when it actually logs). Check code for more of those","created_at":"2016-09-01T14:22:44Z","updated_at":"2016-09-01T14:22:44Z","html_url":"https://github.com/Mashape/kong/pull/1578#discussion_r77183183","pull_request_url":"https://api.github.com/repos/Mashape/kong/pulls/1578","_links":{"self":{"href":"https://api.github.com/repos/Mashape/kong/pulls/comments/77183183"},"html":{"href":"https://github.com/Mashape/kong/pull/1578#discussion_r77183183"},"pull_request":{"href":"https://api.github.com/repos/Mashape/kong/pulls/1578"}}},"pull_request":{"url":"https://api.github.com/repos/Mashape/kong/pulls/1578","id":83639511,"html_url":"https://github.com/Mashape/kong/pull/1578","diff_url":"https://github.com/Mashape/kong/pull/1578.diff","patch_url":"https://github.com/Mashape/kong/pull/1578.patch","issue_url":"https://api.github.com/repos/Mashape/kong/issues/1578","number":1578,"state":"open","locked":false,"title":"add ldap-acl plugin to integrate acl and ldap-auth","user":{"login":"tonicospinelli","id":966337,"avatar_url":"https://avatars.githubusercontent.com/u/966337?v=3","gravatar_id":"","url":"https://api.github.com/users/tonicospinelli","html_url":"https://github.com/tonicospinelli","followers_url":"https://api.github.com/users/tonicospinelli/followers","following_url":"https://api.github.com/users/tonicospinelli/following{/other_user}","gists_url":"https://api.github.com/users/tonicospinelli/gists{/gist_id}","starred_url":"https://api.github.com/users/tonicospinelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonicospinelli/subscriptions","organizations_url":"https://api.github.com/users/tonicospinelli/orgs","repos_url":"https://api.github.com/users/tonicospinelli/repos","events_url":"https://api.github.com/users/tonicospinelli/events{/privacy}","received_events_url":"https://api.github.com/users/tonicospinelli/received_events","type":"User","site_admin":false},"body":"### Summary\r\n\r\nThis `ldap-acl` plugin is a glue between `ldap-auth` and `acl` plugins.\r\nIt will find `consumer_id` by ldap username and append it on `ngx.ctx.authenticated_credential`, because `ldap-auth` plugin doesn't have a link with kong consumers.\r\n\r\n#### Requirements\r\n* sync all ldap users into kong consumers\r\n* enable and configure `ldap-auth` and `acl` plugins\r\n\r\n### Full changelog\r\n\r\n* add `ldap-acl` makes `ldap-auth` and `acl` working togheter\r\n\r\n### Issues resolved\r\n\r\nFix #1439 ","created_at":"2016-09-01T14:09:14Z","updated_at":"2016-09-01T14:22:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bf13a96534b88795b79766fcb21e28159df31061","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Mashape/kong/pulls/1578/commits","review_comments_url":"https://api.github.com/repos/Mashape/kong/pulls/1578/comments","review_comment_url":"https://api.github.com/repos/Mashape/kong/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Mashape/kong/issues/1578/comments","statuses_url":"https://api.github.com/repos/Mashape/kong/statuses/42d67a05521221109ffc315435ab42aea1b266c4","head":{"label":"GFG:ldap-acl","ref":"ldap-acl","sha":"42d67a05521221109ffc315435ab42aea1b266c4","user":{"login":"GFG","id":16322644,"avatar_url":"https://avatars.githubusercontent.com/u/16322644?v=3","gravatar_id":"","url":"https://api.github.com/users/GFG","html_url":"https://github.com/GFG","followers_url":"https://api.github.com/users/GFG/followers","following_url":"https://api.github.com/users/GFG/following{/other_user}","gists_url":"https://api.github.com/users/GFG/gists{/gist_id}","starred_url":"https://api.github.com/users/GFG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GFG/subscriptions","organizations_url":"https://api.github.com/users/GFG/orgs","repos_url":"https://api.github.com/users/GFG/repos","events_url":"https://api.github.com/users/GFG/events{/privacy}","received_events_url":"https://api.github.com/users/GFG/received_events","type":"Organization","site_admin":false},"repo":{"id":67039300,"name":"kong","full_name":"GFG/kong","owner":{"login":"GFG","id":16322644,"avatar_url":"https://avatars.githubusercontent.com/u/16322644?v=3","gravatar_id":"","url":"https://api.github.com/users/GFG","html_url":"https://github.com/GFG","followers_url":"https://api.github.com/users/GFG/followers","following_url":"https://api.github.com/users/GFG/following{/other_user}","gists_url":"https://api.github.com/users/GFG/gists{/gist_id}","starred_url":"https://api.github.com/users/GFG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GFG/subscriptions","organizations_url":"https://api.github.com/users/GFG/orgs","repos_url":"https://api.github.com/users/GFG/repos","events_url":"https://api.github.com/users/GFG/events{/privacy}","received_events_url":"https://api.github.com/users/GFG/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GFG/kong","description":":monkey: The Open-Source API Gateway and Microservice Management Layer, built on NGINX","fork":true,"url":"https://api.github.com/repos/GFG/kong","forks_url":"https://api.github.com/repos/GFG/kong/forks","keys_url":"https://api.github.com/repos/GFG/kong/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GFG/kong/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GFG/kong/teams","hooks_url":"https://api.github.com/repos/GFG/kong/hooks","issue_events_url":"https://api.github.com/repos/GFG/kong/issues/events{/number}","events_url":"https://api.github.com/repos/GFG/kong/events","assignees_url":"https://api.github.com/repos/GFG/kong/assignees{/user}","branches_url":"https://api.github.com/repos/GFG/kong/branches{/branch}","tags_url":"https://api.github.com/repos/GFG/kong/tags","blobs_url":"https://api.github.com/repos/GFG/kong/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GFG/kong/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GFG/kong/git/refs{/sha}","trees_url":"https://api.github.com/repos/GFG/kong/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GFG/kong/statuses/{sha}","languages_url":"https://api.github.com/repos/GFG/kong/languages","stargazers_url":"https://api.github.com/repos/GFG/kong/stargazers","contributors_url":"https://api.github.com/repos/GFG/kong/contributors","subscribers_url":"https://api.github.com/repos/GFG/kong/subscribers","subscription_url":"https://api.github.com/repos/GFG/kong/subscription","commits_url":"https://api.github.com/repos/GFG/kong/commits{/sha}","git_commits_url":"https://api.github.com/repos/GFG/kong/git/commits{/sha}","comments_url":"https://api.github.com/repos/GFG/kong/comments{/number}","issue_comment_url":"https://api.github.com/repos/GFG/kong/issues/comments{/number}","contents_url":"https://api.github.com/repos/GFG/kong/contents/{+path}","compare_url":"https://api.github.com/repos/GFG/kong/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GFG/kong/merges","archive_url":"https://api.github.com/repos/GFG/kong/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GFG/kong/downloads","issues_url":"https://api.github.com/repos/GFG/kong/issues{/number}","pulls_url":"https://api.github.com/repos/GFG/kong/pulls{/number}","milestones_url":"https://api.github.com/repos/GFG/kong/milestones{/number}","notifications_url":"https://api.github.com/repos/GFG/kong/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GFG/kong/labels{/name}","releases_url":"https://api.github.com/repos/GFG/kong/releases{/id}","deployments_url":"https://api.github.com/repos/GFG/kong/deployments","created_at":"2016-08-31T13:21:06Z","updated_at":"2016-08-31T13:21:08Z","pushed_at":"2016-09-01T14:17:24Z","git_url":"git://github.com/GFG/kong.git","ssh_url":"git@github.com:GFG/kong.git","clone_url":"https://github.com/GFG/kong.git","svn_url":"https://github.com/GFG/kong","homepage":"https://getkong.org/","size":4551,"stargazers_count":0,"watchers_count":0,"language":"Lua","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Mashape:next","ref":"next","sha":"7e46563e6a29dc9891973563f3a844b5a9937c16","user":{"login":"Mashape","id":962416,"avatar_url":"https://avatars.githubusercontent.com/u/962416?v=3","gravatar_id":"","url":"https://api.github.com/users/Mashape","html_url":"https://github.com/Mashape","followers_url":"https://api.github.com/users/Mashape/followers","following_url":"https://api.github.com/users/Mashape/following{/other_user}","gists_url":"https://api.github.com/users/Mashape/gists{/gist_id}","starred_url":"https://api.github.com/users/Mashape/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mashape/subscriptions","organizations_url":"https://api.github.com/users/Mashape/orgs","repos_url":"https://api.github.com/users/Mashape/repos","events_url":"https://api.github.com/users/Mashape/events{/privacy}","received_events_url":"https://api.github.com/users/Mashape/received_events","type":"Organization","site_admin":false},"repo":{"id":26783295,"name":"kong","full_name":"Mashape/kong","owner":{"login":"Mashape","id":962416,"avatar_url":"https://avatars.githubusercontent.com/u/962416?v=3","gravatar_id":"","url":"https://api.github.com/users/Mashape","html_url":"https://github.com/Mashape","followers_url":"https://api.github.com/users/Mashape/followers","following_url":"https://api.github.com/users/Mashape/following{/other_user}","gists_url":"https://api.github.com/users/Mashape/gists{/gist_id}","starred_url":"https://api.github.com/users/Mashape/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mashape/subscriptions","organizations_url":"https://api.github.com/users/Mashape/orgs","repos_url":"https://api.github.com/users/Mashape/repos","events_url":"https://api.github.com/users/Mashape/events{/privacy}","received_events_url":"https://api.github.com/users/Mashape/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Mashape/kong","description":":monkey: The Open-Source API Gateway and Microservice Management Layer, built on NGINX","fork":false,"url":"https://api.github.com/repos/Mashape/kong","forks_url":"https://api.github.com/repos/Mashape/kong/forks","keys_url":"https://api.github.com/repos/Mashape/kong/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Mashape/kong/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Mashape/kong/teams","hooks_url":"https://api.github.com/repos/Mashape/kong/hooks","issue_events_url":"https://api.github.com/repos/Mashape/kong/issues/events{/number}","events_url":"https://api.github.com/repos/Mashape/kong/events","assignees_url":"https://api.github.com/repos/Mashape/kong/assignees{/user}","branches_url":"https://api.github.com/repos/Mashape/kong/branches{/branch}","tags_url":"https://api.github.com/repos/Mashape/kong/tags","blobs_url":"https://api.github.com/repos/Mashape/kong/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Mashape/kong/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Mashape/kong/git/refs{/sha}","trees_url":"https://api.github.com/repos/Mashape/kong/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Mashape/kong/statuses/{sha}","languages_url":"https://api.github.com/repos/Mashape/kong/languages","stargazers_url":"https://api.github.com/repos/Mashape/kong/stargazers","contributors_url":"https://api.github.com/repos/Mashape/kong/contributors","subscribers_url":"https://api.github.com/repos/Mashape/kong/subscribers","subscription_url":"https://api.github.com/repos/Mashape/kong/subscription","commits_url":"https://api.github.com/repos/Mashape/kong/commits{/sha}","git_commits_url":"https://api.github.com/repos/Mashape/kong/git/commits{/sha}","comments_url":"https://api.github.com/repos/Mashape/kong/comments{/number}","issue_comment_url":"https://api.github.com/repos/Mashape/kong/issues/comments{/number}","contents_url":"https://api.github.com/repos/Mashape/kong/contents/{+path}","compare_url":"https://api.github.com/repos/Mashape/kong/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Mashape/kong/merges","archive_url":"https://api.github.com/repos/Mashape/kong/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Mashape/kong/downloads","issues_url":"https://api.github.com/repos/Mashape/kong/issues{/number}","pulls_url":"https://api.github.com/repos/Mashape/kong/pulls{/number}","milestones_url":"https://api.github.com/repos/Mashape/kong/milestones{/number}","notifications_url":"https://api.github.com/repos/Mashape/kong/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Mashape/kong/labels{/name}","releases_url":"https://api.github.com/repos/Mashape/kong/releases{/id}","deployments_url":"https://api.github.com/repos/Mashape/kong/deployments","created_at":"2014-11-17T23:56:08Z","updated_at":"2016-09-01T10:39:04Z","pushed_at":"2016-09-01T14:16:52Z","git_url":"git://github.com/Mashape/kong.git","ssh_url":"git@github.com:Mashape/kong.git","clone_url":"https://github.com/Mashape/kong.git","svn_url":"https://github.com/Mashape/kong","homepage":"https://getkong.org/","size":109963,"stargazers_count":6595,"watchers_count":6595,"language":"Lua","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":605,"mirror_url":null,"open_issues_count":261,"forks":605,"open_issues":261,"watchers":6595,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Mashape/kong/pulls/1578"},"html":{"href":"https://github.com/Mashape/kong/pull/1578"},"issue":{"href":"https://api.github.com/repos/Mashape/kong/issues/1578"},"comments":{"href":"https://api.github.com/repos/Mashape/kong/issues/1578/comments"},"review_comments":{"href":"https://api.github.com/repos/Mashape/kong/pulls/1578/comments"},"review_comment":{"href":"https://api.github.com/repos/Mashape/kong/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Mashape/kong/pulls/1578/commits"},"statuses":{"href":"https://api.github.com/repos/Mashape/kong/statuses/42d67a05521221109ffc315435ab42aea1b266c4"}}}}
{"actor":{"display_login":"Tieske"}}