{"action":"created","comment":{"url":"https://api.github.com/repos/yegor256/takes/pulls/comments/34007192","id":34007192,"diff_hunk":"@@ -0,0 +1,90 @@\n+/**\n+ * The MIT License (MIT)\n+ *\n+ * Copyright (c) 2015 Yegor Bugayenko\n+ *\n+ * Permission is hereby granted, free of charge, to any person obtaining a copy\n+ * of this software and associated documentation files (the \"Software\"), to deal\n+ * in the Software without restriction, including without limitation the rights\n+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+ * copies of the Software, and to permit persons to whom the Software is\n+ * furnished to do so, subject to the following conditions:\n+ *\n+ * The above copyright notice and this permission notice shall be included\n+ * in all copies or substantial portions of the Software.\n+ *\n+ * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE\n+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n+ * SOFTWARE.\n+ */\n+package org.takes.facets.auth;\n+\n+import java.io.IOException;\n+import java.util.List;\n+import org.takes.Request;\n+import org.takes.Response;\n+import org.takes.misc.Opt;\n+\n+/**\n+ * Success if all Pass is successfull.\n+ * @author Lautaro Cozzani (lautarobock@gmail.com)\n+ * @version $Id$\n+ * @since 0.22\n+ */\n+public class PsAll implements Pass {\n+\n+    /**\n+     * All Pass.\n+     */\n+    private final transient List<Pass> all;\n+\n+    /**\n+     * Idx of identity to return.\n+     */\n+    private final transient int index;\n+\n+    /**\n+     * Ctor.\n+     * @param pass All pass to be checked.\n+     * @param identity Identity idx to return.\n+     */\n+    public PsAll(final List<Pass> pass, final int identity) {\n+        this.all = pass;\n+        this.index = identity;\n+    }\n+\n+    @Override\n+    public final Opt<Identity> enter(final Request request) throws IOException {\n+        boolean success = true;\n+        for (final Pass pass : this.all) {\n+            final Opt<Identity> enter = pass.enter(request);\n+            if (!enter.has()) {\n+                success = false;\n+            }\n+        }\n+        final Opt<Identity> result;\n+        if (success && this.index < this.all.size()) {\n+            result = this.all.get(this.index).enter(request);\n+        } else {\n+            result = new Opt.Empty<Identity>();\n+        }\n+        return result;\n+    }\n+\n+    @Override\n+    public final Response exit(final Response response, final Identity identity)\n+        throws IOException {\n+        if (this.index < this.all.size()) {\n+            return this.all.get(this.index).exit(response, identity);\n+        } else {\n+            throw new IOException(","path":"src/main/java/org/takes/facets/auth/PsAll.java","position":84,"original_position":84,"commit_id":"f84c3560cb6f90b6d221f1eca010b60de2266f22","original_commit_id":"f84c3560cb6f90b6d221f1eca010b60de2266f22","user":{"login":"yegor256","id":526301,"avatar_url":"https://avatars.githubusercontent.com/u/526301?v=3","gravatar_id":"","url":"https://api.github.com/users/yegor256","html_url":"https://github.com/yegor256","followers_url":"https://api.github.com/users/yegor256/followers","following_url":"https://api.github.com/users/yegor256/following{/other_user}","gists_url":"https://api.github.com/users/yegor256/gists{/gist_id}","starred_url":"https://api.github.com/users/yegor256/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yegor256/subscriptions","organizations_url":"https://api.github.com/users/yegor256/orgs","repos_url":"https://api.github.com/users/yegor256/repos","events_url":"https://api.github.com/users/yegor256/events{/privacy}","received_events_url":"https://api.github.com/users/yegor256/received_events","type":"User","site_admin":false},"body":"@lautarobock see http://www.yegor256.com/2015/01/21/if-then-throw-else.html","created_at":"2015-07-07T04:34:35Z","updated_at":"2015-07-07T04:34:35Z","html_url":"https://github.com/yegor256/takes/pull/356#discussion_r34007192","pull_request_url":"https://api.github.com/repos/yegor256/takes/pulls/356","_links":{"self":{"href":"https://api.github.com/repos/yegor256/takes/pulls/comments/34007192"},"html":{"href":"https://github.com/yegor256/takes/pull/356#discussion_r34007192"},"pull_request":{"href":"https://api.github.com/repos/yegor256/takes/pulls/356"}}},"pull_request":{"url":"https://api.github.com/repos/yegor256/takes/pulls/356","id":38896998,"html_url":"https://github.com/yegor256/takes/pull/356","diff_url":"https://github.com/yegor256/takes/pull/356.diff","patch_url":"https://github.com/yegor256/takes/pull/356.patch","issue_url":"https://api.github.com/repos/yegor256/takes/issues/356","number":356,"state":"open","locked":false,"title":"#350: Add PsAll, iterate over Pass collection","user":{"login":"lautarobock","id":3920831,"avatar_url":"https://avatars.githubusercontent.com/u/3920831?v=3","gravatar_id":"","url":"https://api.github.com/users/lautarobock","html_url":"https://github.com/lautarobock","followers_url":"https://api.github.com/users/lautarobock/followers","following_url":"https://api.github.com/users/lautarobock/following{/other_user}","gists_url":"https://api.github.com/users/lautarobock/gists{/gist_id}","starred_url":"https://api.github.com/users/lautarobock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lautarobock/subscriptions","organizations_url":"https://api.github.com/users/lautarobock/orgs","repos_url":"https://api.github.com/users/lautarobock/repos","events_url":"https://api.github.com/users/lautarobock/events{/privacy}","received_events_url":"https://api.github.com/users/lautarobock/received_events","type":"User","site_admin":false},"body":"#350: Add PsAll.\r\n\r\nPass implementation that itereates over Iterable<Pass> and success only if all success and returns one indentity by IDX\r\n\r\n**Notes**\r\n* If iterable is empty -> fail\r\n* If  IDX > iterable.size() -> fail\r\n","created_at":"2015-06-30T16:24:18Z","updated_at":"2015-07-07T04:34:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0ec53499d71fb40a0a15e972cd36843bbc979309","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/yegor256/takes/pulls/356/commits","review_comments_url":"https://api.github.com/repos/yegor256/takes/pulls/356/comments","review_comment_url":"https://api.github.com/repos/yegor256/takes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yegor256/takes/issues/356/comments","statuses_url":"https://api.github.com/repos/yegor256/takes/statuses/f84c3560cb6f90b6d221f1eca010b60de2266f22","head":{"label":"lautarobock:350","ref":"350","sha":"f84c3560cb6f90b6d221f1eca010b60de2266f22","user":{"login":"lautarobock","id":3920831,"avatar_url":"https://avatars.githubusercontent.com/u/3920831?v=3","gravatar_id":"","url":"https://api.github.com/users/lautarobock","html_url":"https://github.com/lautarobock","followers_url":"https://api.github.com/users/lautarobock/followers","following_url":"https://api.github.com/users/lautarobock/following{/other_user}","gists_url":"https://api.github.com/users/lautarobock/gists{/gist_id}","starred_url":"https://api.github.com/users/lautarobock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lautarobock/subscriptions","organizations_url":"https://api.github.com/users/lautarobock/orgs","repos_url":"https://api.github.com/users/lautarobock/repos","events_url":"https://api.github.com/users/lautarobock/events{/privacy}","received_events_url":"https://api.github.com/users/lautarobock/received_events","type":"User","site_admin":false},"repo":{"id":35815737,"name":"takes","full_name":"lautarobock/takes","owner":{"login":"lautarobock","id":3920831,"avatar_url":"https://avatars.githubusercontent.com/u/3920831?v=3","gravatar_id":"","url":"https://api.github.com/users/lautarobock","html_url":"https://github.com/lautarobock","followers_url":"https://api.github.com/users/lautarobock/followers","following_url":"https://api.github.com/users/lautarobock/following{/other_user}","gists_url":"https://api.github.com/users/lautarobock/gists{/gist_id}","starred_url":"https://api.github.com/users/lautarobock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lautarobock/subscriptions","organizations_url":"https://api.github.com/users/lautarobock/orgs","repos_url":"https://api.github.com/users/lautarobock/repos","events_url":"https://api.github.com/users/lautarobock/events{/privacy}","received_events_url":"https://api.github.com/users/lautarobock/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lautarobock/takes","description":"True Object-Oriented and Immutable Java Web Framework","fork":true,"url":"https://api.github.com/repos/lautarobock/takes","forks_url":"https://api.github.com/repos/lautarobock/takes/forks","keys_url":"https://api.github.com/repos/lautarobock/takes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lautarobock/takes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lautarobock/takes/teams","hooks_url":"https://api.github.com/repos/lautarobock/takes/hooks","issue_events_url":"https://api.github.com/repos/lautarobock/takes/issues/events{/number}","events_url":"https://api.github.com/repos/lautarobock/takes/events","assignees_url":"https://api.github.com/repos/lautarobock/takes/assignees{/user}","branches_url":"https://api.github.com/repos/lautarobock/takes/branches{/branch}","tags_url":"https://api.github.com/repos/lautarobock/takes/tags","blobs_url":"https://api.github.com/repos/lautarobock/takes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lautarobock/takes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lautarobock/takes/git/refs{/sha}","trees_url":"https://api.github.com/repos/lautarobock/takes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lautarobock/takes/statuses/{sha}","languages_url":"https://api.github.com/repos/lautarobock/takes/languages","stargazers_url":"https://api.github.com/repos/lautarobock/takes/stargazers","contributors_url":"https://api.github.com/repos/lautarobock/takes/contributors","subscribers_url":"https://api.github.com/repos/lautarobock/takes/subscribers","subscription_url":"https://api.github.com/repos/lautarobock/takes/subscription","commits_url":"https://api.github.com/repos/lautarobock/takes/commits{/sha}","git_commits_url":"https://api.github.com/repos/lautarobock/takes/git/commits{/sha}","comments_url":"https://api.github.com/repos/lautarobock/takes/comments{/number}","issue_comment_url":"https://api.github.com/repos/lautarobock/takes/issues/comments{/number}","contents_url":"https://api.github.com/repos/lautarobock/takes/contents/{+path}","compare_url":"https://api.github.com/repos/lautarobock/takes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lautarobock/takes/merges","archive_url":"https://api.github.com/repos/lautarobock/takes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lautarobock/takes/downloads","issues_url":"https://api.github.com/repos/lautarobock/takes/issues{/number}","pulls_url":"https://api.github.com/repos/lautarobock/takes/pulls{/number}","milestones_url":"https://api.github.com/repos/lautarobock/takes/milestones{/number}","notifications_url":"https://api.github.com/repos/lautarobock/takes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lautarobock/takes/labels{/name}","releases_url":"https://api.github.com/repos/lautarobock/takes/releases{/id}","created_at":"2015-05-18T12:07:45Z","updated_at":"2015-05-18T12:07:46Z","pushed_at":"2015-07-03T23:29:35Z","git_url":"git://github.com/lautarobock/takes.git","ssh_url":"git@github.com:lautarobock/takes.git","clone_url":"https://github.com/lautarobock/takes.git","svn_url":"https://github.com/lautarobock/takes","homepage":"http://www.takes.org","size":27834,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"yegor256:master","ref":"master","sha":"31f3bd18ab45096693db12b9ed29b3613602297e","user":{"login":"yegor256","id":526301,"avatar_url":"https://avatars.githubusercontent.com/u/526301?v=3","gravatar_id":"","url":"https://api.github.com/users/yegor256","html_url":"https://github.com/yegor256","followers_url":"https://api.github.com/users/yegor256/followers","following_url":"https://api.github.com/users/yegor256/following{/other_user}","gists_url":"https://api.github.com/users/yegor256/gists{/gist_id}","starred_url":"https://api.github.com/users/yegor256/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yegor256/subscriptions","organizations_url":"https://api.github.com/users/yegor256/orgs","repos_url":"https://api.github.com/users/yegor256/repos","events_url":"https://api.github.com/users/yegor256/events{/privacy}","received_events_url":"https://api.github.com/users/yegor256/received_events","type":"User","site_admin":false},"repo":{"id":28924109,"name":"takes","full_name":"yegor256/takes","owner":{"login":"yegor256","id":526301,"avatar_url":"https://avatars.githubusercontent.com/u/526301?v=3","gravatar_id":"","url":"https://api.github.com/users/yegor256","html_url":"https://github.com/yegor256","followers_url":"https://api.github.com/users/yegor256/followers","following_url":"https://api.github.com/users/yegor256/following{/other_user}","gists_url":"https://api.github.com/users/yegor256/gists{/gist_id}","starred_url":"https://api.github.com/users/yegor256/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yegor256/subscriptions","organizations_url":"https://api.github.com/users/yegor256/orgs","repos_url":"https://api.github.com/users/yegor256/repos","events_url":"https://api.github.com/users/yegor256/events{/privacy}","received_events_url":"https://api.github.com/users/yegor256/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yegor256/takes","description":"True Object-Oriented and Immutable Java Web Framework","fork":false,"url":"https://api.github.com/repos/yegor256/takes","forks_url":"https://api.github.com/repos/yegor256/takes/forks","keys_url":"https://api.github.com/repos/yegor256/takes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yegor256/takes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yegor256/takes/teams","hooks_url":"https://api.github.com/repos/yegor256/takes/hooks","issue_events_url":"https://api.github.com/repos/yegor256/takes/issues/events{/number}","events_url":"https://api.github.com/repos/yegor256/takes/events","assignees_url":"https://api.github.com/repos/yegor256/takes/assignees{/user}","branches_url":"https://api.github.com/repos/yegor256/takes/branches{/branch}","tags_url":"https://api.github.com/repos/yegor256/takes/tags","blobs_url":"https://api.github.com/repos/yegor256/takes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yegor256/takes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yegor256/takes/git/refs{/sha}","trees_url":"https://api.github.com/repos/yegor256/takes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yegor256/takes/statuses/{sha}","languages_url":"https://api.github.com/repos/yegor256/takes/languages","stargazers_url":"https://api.github.com/repos/yegor256/takes/stargazers","contributors_url":"https://api.github.com/repos/yegor256/takes/contributors","subscribers_url":"https://api.github.com/repos/yegor256/takes/subscribers","subscription_url":"https://api.github.com/repos/yegor256/takes/subscription","commits_url":"https://api.github.com/repos/yegor256/takes/commits{/sha}","git_commits_url":"https://api.github.com/repos/yegor256/takes/git/commits{/sha}","comments_url":"https://api.github.com/repos/yegor256/takes/comments{/number}","issue_comment_url":"https://api.github.com/repos/yegor256/takes/issues/comments{/number}","contents_url":"https://api.github.com/repos/yegor256/takes/contents/{+path}","compare_url":"https://api.github.com/repos/yegor256/takes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yegor256/takes/merges","archive_url":"https://api.github.com/repos/yegor256/takes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yegor256/takes/downloads","issues_url":"https://api.github.com/repos/yegor256/takes/issues{/number}","pulls_url":"https://api.github.com/repos/yegor256/takes/pulls{/number}","milestones_url":"https://api.github.com/repos/yegor256/takes/milestones{/number}","notifications_url":"https://api.github.com/repos/yegor256/takes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yegor256/takes/labels{/name}","releases_url":"https://api.github.com/repos/yegor256/takes/releases{/id}","created_at":"2015-01-07T16:57:47Z","updated_at":"2015-07-06T18:35:50Z","pushed_at":"2015-07-03T23:29:36Z","git_url":"git://github.com/yegor256/takes.git","ssh_url":"git@github.com:yegor256/takes.git","clone_url":"https://github.com/yegor256/takes.git","svn_url":"https://github.com/yegor256/takes","homepage":"http://www.takes.org","size":32190,"stargazers_count":80,"watchers_count":80,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":41,"mirror_url":null,"open_issues_count":36,"forks":41,"open_issues":36,"watchers":80,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yegor256/takes/pulls/356"},"html":{"href":"https://github.com/yegor256/takes/pull/356"},"issue":{"href":"https://api.github.com/repos/yegor256/takes/issues/356"},"comments":{"href":"https://api.github.com/repos/yegor256/takes/issues/356/comments"},"review_comments":{"href":"https://api.github.com/repos/yegor256/takes/pulls/356/comments"},"review_comment":{"href":"https://api.github.com/repos/yegor256/takes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yegor256/takes/pulls/356/commits"},"statuses":{"href":"https://api.github.com/repos/yegor256/takes/statuses/f84c3560cb6f90b6d221f1eca010b60de2266f22"}}}}