{"action":"created","comment":{"url":"https://api.github.com/repos/pac4j/pac4j/pulls/comments/59708468","id":59708468,"diff_hunk":"@@ -79,23 +79,36 @@ protected UsernamePasswordCredentials retrieveCredentials(final WebContext conte\n             credentials = getCredentialsExtractor().extract(context);\n             logger.debug(\"usernamePasswordCredentials: {}\", credentials);\n             if (credentials == null) {\n-                String redirectionUrl = CommonHelper.addParameter(this.loginUrl, this.usernameParameter, username);\n-                redirectionUrl = CommonHelper.addParameter(redirectionUrl, ERROR_PARAMETER, MISSING_FIELD_ERROR);\n-                logger.debug(\"redirectionUrl: {}\", redirectionUrl);\n-                final String message = \"Username and password cannot be blank -> return to the form with error\";\n-                logger.debug(message);\n-                throw RequiresHttpAction.redirect(message, context, redirectionUrl);\n+\t\t\t\t// it's an AJAX request -> unauthorized (instead of a\n+\t\t\t\t// redirection)\n+\t\t\t\tif (getAjaxRequestResolver().isAjax(context)) {","path":"pac4j-http/src/main/java/org/pac4j/http/client/indirect/FormClient.java","position":12,"original_position":12,"commit_id":"a214353dce6b19b6ccdb5b207fb149977871daea","original_commit_id":"a214353dce6b19b6ccdb5b207fb149977871daea","user":{"login":"leleuj","id":1038508,"avatar_url":"https://avatars.githubusercontent.com/u/1038508?v=3","gravatar_id":"","url":"https://api.github.com/users/leleuj","html_url":"https://github.com/leleuj","followers_url":"https://api.github.com/users/leleuj/followers","following_url":"https://api.github.com/users/leleuj/following{/other_user}","gists_url":"https://api.github.com/users/leleuj/gists{/gist_id}","starred_url":"https://api.github.com/users/leleuj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leleuj/subscriptions","organizations_url":"https://api.github.com/users/leleuj/orgs","repos_url":"https://api.github.com/users/leleuj/repos","events_url":"https://api.github.com/users/leleuj/events{/privacy}","received_events_url":"https://api.github.com/users/leleuj/received_events","type":"User","site_admin":false},"body":"This is where I realized that both blocks (line 82 - 94 and line 99 - 111) of source code looks very close: can we extract that in a method? Thanks","created_at":"2016-04-14T12:33:22Z","updated_at":"2016-04-14T12:33:22Z","html_url":"https://github.com/pac4j/pac4j/pull/545#discussion_r59708468","pull_request_url":"https://api.github.com/repos/pac4j/pac4j/pulls/545","_links":{"self":{"href":"https://api.github.com/repos/pac4j/pac4j/pulls/comments/59708468"},"html":{"href":"https://github.com/pac4j/pac4j/pull/545#discussion_r59708468"},"pull_request":{"href":"https://api.github.com/repos/pac4j/pac4j/pulls/545"}}},"pull_request":{"url":"https://api.github.com/repos/pac4j/pac4j/pulls/545","id":66473157,"html_url":"https://github.com/pac4j/pac4j/pull/545","diff_url":"https://github.com/pac4j/pac4j/pull/545.diff","patch_url":"https://github.com/pac4j/pac4j/pull/545.patch","issue_url":"https://api.github.com/repos/pac4j/pac4j/issues/545","number":545,"state":"open","locked":false,"title":"Git issue #536","user":{"login":"garpinc","id":1929156,"avatar_url":"https://avatars.githubusercontent.com/u/1929156?v=3","gravatar_id":"","url":"https://api.github.com/users/garpinc","html_url":"https://github.com/garpinc","followers_url":"https://api.github.com/users/garpinc/followers","following_url":"https://api.github.com/users/garpinc/following{/other_user}","gists_url":"https://api.github.com/users/garpinc/gists{/gist_id}","starred_url":"https://api.github.com/users/garpinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garpinc/subscriptions","organizations_url":"https://api.github.com/users/garpinc/orgs","repos_url":"https://api.github.com/users/garpinc/repos","events_url":"https://api.github.com/users/garpinc/events{/privacy}","received_events_url":"https://api.github.com/users/garpinc/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-14T12:10:34Z","updated_at":"2016-04-14T12:33:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ca68babbf7b86891a0f92f737b1676bbb3dfdb09","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pac4j/pac4j/pulls/545/commits","review_comments_url":"https://api.github.com/repos/pac4j/pac4j/pulls/545/comments","review_comment_url":"https://api.github.com/repos/pac4j/pac4j/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pac4j/pac4j/issues/545/comments","statuses_url":"https://api.github.com/repos/pac4j/pac4j/statuses/a214353dce6b19b6ccdb5b207fb149977871daea","head":{"label":"garpinc:master","ref":"master","sha":"a214353dce6b19b6ccdb5b207fb149977871daea","user":{"login":"garpinc","id":1929156,"avatar_url":"https://avatars.githubusercontent.com/u/1929156?v=3","gravatar_id":"","url":"https://api.github.com/users/garpinc","html_url":"https://github.com/garpinc","followers_url":"https://api.github.com/users/garpinc/followers","following_url":"https://api.github.com/users/garpinc/following{/other_user}","gists_url":"https://api.github.com/users/garpinc/gists{/gist_id}","starred_url":"https://api.github.com/users/garpinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garpinc/subscriptions","organizations_url":"https://api.github.com/users/garpinc/orgs","repos_url":"https://api.github.com/users/garpinc/repos","events_url":"https://api.github.com/users/garpinc/events{/privacy}","received_events_url":"https://api.github.com/users/garpinc/received_events","type":"User","site_admin":false},"repo":{"id":46871258,"name":"pac4j","full_name":"garpinc/pac4j","owner":{"login":"garpinc","id":1929156,"avatar_url":"https://avatars.githubusercontent.com/u/1929156?v=3","gravatar_id":"","url":"https://api.github.com/users/garpinc","html_url":"https://github.com/garpinc","followers_url":"https://api.github.com/users/garpinc/followers","following_url":"https://api.github.com/users/garpinc/following{/other_user}","gists_url":"https://api.github.com/users/garpinc/gists{/gist_id}","starred_url":"https://api.github.com/users/garpinc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garpinc/subscriptions","organizations_url":"https://api.github.com/users/garpinc/orgs","repos_url":"https://api.github.com/users/garpinc/repos","events_url":"https://api.github.com/users/garpinc/events{/privacy}","received_events_url":"https://api.github.com/users/garpinc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/garpinc/pac4j","description":"Security engine for Java (authentication, authorization, multi frameworks)","fork":true,"url":"https://api.github.com/repos/garpinc/pac4j","forks_url":"https://api.github.com/repos/garpinc/pac4j/forks","keys_url":"https://api.github.com/repos/garpinc/pac4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/garpinc/pac4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/garpinc/pac4j/teams","hooks_url":"https://api.github.com/repos/garpinc/pac4j/hooks","issue_events_url":"https://api.github.com/repos/garpinc/pac4j/issues/events{/number}","events_url":"https://api.github.com/repos/garpinc/pac4j/events","assignees_url":"https://api.github.com/repos/garpinc/pac4j/assignees{/user}","branches_url":"https://api.github.com/repos/garpinc/pac4j/branches{/branch}","tags_url":"https://api.github.com/repos/garpinc/pac4j/tags","blobs_url":"https://api.github.com/repos/garpinc/pac4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/garpinc/pac4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/garpinc/pac4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/garpinc/pac4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/garpinc/pac4j/statuses/{sha}","languages_url":"https://api.github.com/repos/garpinc/pac4j/languages","stargazers_url":"https://api.github.com/repos/garpinc/pac4j/stargazers","contributors_url":"https://api.github.com/repos/garpinc/pac4j/contributors","subscribers_url":"https://api.github.com/repos/garpinc/pac4j/subscribers","subscription_url":"https://api.github.com/repos/garpinc/pac4j/subscription","commits_url":"https://api.github.com/repos/garpinc/pac4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/garpinc/pac4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/garpinc/pac4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/garpinc/pac4j/issues/comments{/number}","contents_url":"https://api.github.com/repos/garpinc/pac4j/contents/{+path}","compare_url":"https://api.github.com/repos/garpinc/pac4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/garpinc/pac4j/merges","archive_url":"https://api.github.com/repos/garpinc/pac4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/garpinc/pac4j/downloads","issues_url":"https://api.github.com/repos/garpinc/pac4j/issues{/number}","pulls_url":"https://api.github.com/repos/garpinc/pac4j/pulls{/number}","milestones_url":"https://api.github.com/repos/garpinc/pac4j/milestones{/number}","notifications_url":"https://api.github.com/repos/garpinc/pac4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/garpinc/pac4j/labels{/name}","releases_url":"https://api.github.com/repos/garpinc/pac4j/releases{/id}","deployments_url":"https://api.github.com/repos/garpinc/pac4j/deployments","created_at":"2015-11-25T15:50:37Z","updated_at":"2016-02-29T18:26:42Z","pushed_at":"2016-04-14T12:09:09Z","git_url":"git://github.com/garpinc/pac4j.git","ssh_url":"git@github.com:garpinc/pac4j.git","clone_url":"https://github.com/garpinc/pac4j.git","svn_url":"https://github.com/garpinc/pac4j","homepage":"http://www.pac4j.org","size":18507,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"pac4j:master","ref":"master","sha":"767644ce601e1c457b1b7c6e428d28792be3140c","user":{"login":"pac4j","id":7540865,"avatar_url":"https://avatars.githubusercontent.com/u/7540865?v=3","gravatar_id":"","url":"https://api.github.com/users/pac4j","html_url":"https://github.com/pac4j","followers_url":"https://api.github.com/users/pac4j/followers","following_url":"https://api.github.com/users/pac4j/following{/other_user}","gists_url":"https://api.github.com/users/pac4j/gists{/gist_id}","starred_url":"https://api.github.com/users/pac4j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pac4j/subscriptions","organizations_url":"https://api.github.com/users/pac4j/orgs","repos_url":"https://api.github.com/users/pac4j/repos","events_url":"https://api.github.com/users/pac4j/events{/privacy}","received_events_url":"https://api.github.com/users/pac4j/received_events","type":"Organization","site_admin":false},"repo":{"id":3291848,"name":"pac4j","full_name":"pac4j/pac4j","owner":{"login":"pac4j","id":7540865,"avatar_url":"https://avatars.githubusercontent.com/u/7540865?v=3","gravatar_id":"","url":"https://api.github.com/users/pac4j","html_url":"https://github.com/pac4j","followers_url":"https://api.github.com/users/pac4j/followers","following_url":"https://api.github.com/users/pac4j/following{/other_user}","gists_url":"https://api.github.com/users/pac4j/gists{/gist_id}","starred_url":"https://api.github.com/users/pac4j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pac4j/subscriptions","organizations_url":"https://api.github.com/users/pac4j/orgs","repos_url":"https://api.github.com/users/pac4j/repos","events_url":"https://api.github.com/users/pac4j/events{/privacy}","received_events_url":"https://api.github.com/users/pac4j/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pac4j/pac4j","description":"Security engine for Java (authentication, authorization, multi frameworks)","fork":false,"url":"https://api.github.com/repos/pac4j/pac4j","forks_url":"https://api.github.com/repos/pac4j/pac4j/forks","keys_url":"https://api.github.com/repos/pac4j/pac4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pac4j/pac4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pac4j/pac4j/teams","hooks_url":"https://api.github.com/repos/pac4j/pac4j/hooks","issue_events_url":"https://api.github.com/repos/pac4j/pac4j/issues/events{/number}","events_url":"https://api.github.com/repos/pac4j/pac4j/events","assignees_url":"https://api.github.com/repos/pac4j/pac4j/assignees{/user}","branches_url":"https://api.github.com/repos/pac4j/pac4j/branches{/branch}","tags_url":"https://api.github.com/repos/pac4j/pac4j/tags","blobs_url":"https://api.github.com/repos/pac4j/pac4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pac4j/pac4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pac4j/pac4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/pac4j/pac4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pac4j/pac4j/statuses/{sha}","languages_url":"https://api.github.com/repos/pac4j/pac4j/languages","stargazers_url":"https://api.github.com/repos/pac4j/pac4j/stargazers","contributors_url":"https://api.github.com/repos/pac4j/pac4j/contributors","subscribers_url":"https://api.github.com/repos/pac4j/pac4j/subscribers","subscription_url":"https://api.github.com/repos/pac4j/pac4j/subscription","commits_url":"https://api.github.com/repos/pac4j/pac4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/pac4j/pac4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/pac4j/pac4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/pac4j/pac4j/issues/comments{/number}","contents_url":"https://api.github.com/repos/pac4j/pac4j/contents/{+path}","compare_url":"https://api.github.com/repos/pac4j/pac4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pac4j/pac4j/merges","archive_url":"https://api.github.com/repos/pac4j/pac4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pac4j/pac4j/downloads","issues_url":"https://api.github.com/repos/pac4j/pac4j/issues{/number}","pulls_url":"https://api.github.com/repos/pac4j/pac4j/pulls{/number}","milestones_url":"https://api.github.com/repos/pac4j/pac4j/milestones{/number}","notifications_url":"https://api.github.com/repos/pac4j/pac4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pac4j/pac4j/labels{/name}","releases_url":"https://api.github.com/repos/pac4j/pac4j/releases{/id}","deployments_url":"https://api.github.com/repos/pac4j/pac4j/deployments","created_at":"2012-01-28T17:04:12Z","updated_at":"2016-04-14T01:06:35Z","pushed_at":"2016-04-14T12:10:34Z","git_url":"git://github.com/pac4j/pac4j.git","ssh_url":"git@github.com:pac4j/pac4j.git","clone_url":"https://github.com/pac4j/pac4j.git","svn_url":"https://github.com/pac4j/pac4j","homepage":"http://www.pac4j.org","size":25274,"stargazers_count":513,"watchers_count":513,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":195,"mirror_url":null,"open_issues_count":21,"forks":195,"open_issues":21,"watchers":513,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pac4j/pac4j/pulls/545"},"html":{"href":"https://github.com/pac4j/pac4j/pull/545"},"issue":{"href":"https://api.github.com/repos/pac4j/pac4j/issues/545"},"comments":{"href":"https://api.github.com/repos/pac4j/pac4j/issues/545/comments"},"review_comments":{"href":"https://api.github.com/repos/pac4j/pac4j/pulls/545/comments"},"review_comment":{"href":"https://api.github.com/repos/pac4j/pac4j/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pac4j/pac4j/pulls/545/commits"},"statuses":{"href":"https://api.github.com/repos/pac4j/pac4j/statuses/a214353dce6b19b6ccdb5b207fb149977871daea"}}}}