{"action":"created","comment":{"url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/pulls/comments/56181514","id":56181514,"diff_hunk":"@@ -0,0 +1,71 @@\n+/*\n+ * Copyright 2016 HM Revenue & Customs\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package controllers\n+\n+import connectors.AuthConnector\n+import model.Forms._\n+import model.{GatekeeperSessionKeys, LoginDetails}\n+import play.api.Logger\n+import play.api.i18n.Messages\n+import play.api.mvc._\n+import uk.gov.hmrc.play.frontend.controller.FrontendController\n+import uk.gov.hmrc.play.http.SessionKeys\n+import utils.{GatekeeperAuthProvider, GatekeeperAuthWrapper}\n+import views.html.login._\n+\n+import scala.concurrent.Future\n+\n+object AccountController extends AccountController {\n+  val authConnector = AuthConnector\n+\n+  override def authProvider = GatekeeperAuthProvider\n+}\n+\n+trait AccountController extends FrontendController with GatekeeperAuthWrapper {\n+\n+  val authConnector: AuthConnector\n+\n+  val welcomePage = routes.DashboardController.dashboardPage\n+\n+  val loginPage: Action[AnyContent] = redirectIfLoggedIn(welcomePage) {\n+    implicit request => implicit hc => Future.successful(Ok(login(loginForm)))\n+  }\n+\n+  val authenticateAction = Action.async { implicit request =>\n+    loginForm.bindFromRequest().fold(\n+      errors => Future.successful(BadRequest(login(loginForm))),\n+      loginDetails => processLogin(loginDetails)\n+    )\n+  }\n+\n+  def logoutAction = Action(implicit request => Redirect(routes.AccountController.loginPage()).removingFromSession(SessionKeys.authToken))","path":"app/controllers/AccountController.scala","position":55,"original_position":55,"commit_id":"d4204a9165dd04e704656d62b203ef6f23c300e4","original_commit_id":"d4204a9165dd04e704656d62b203ef6f23c300e4","user":{"login":"hughfdjackson","id":545689,"avatar_url":"https://avatars.githubusercontent.com/u/545689?v=3","gravatar_id":"","url":"https://api.github.com/users/hughfdjackson","html_url":"https://github.com/hughfdjackson","followers_url":"https://api.github.com/users/hughfdjackson/followers","following_url":"https://api.github.com/users/hughfdjackson/following{/other_user}","gists_url":"https://api.github.com/users/hughfdjackson/gists{/gist_id}","starred_url":"https://api.github.com/users/hughfdjackson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hughfdjackson/subscriptions","organizations_url":"https://api.github.com/users/hughfdjackson/orgs","repos_url":"https://api.github.com/users/hughfdjackson/repos","events_url":"https://api.github.com/users/hughfdjackson/events{/privacy}","received_events_url":"https://api.github.com/users/hughfdjackson/received_events","type":"User","site_admin":false},"body":"The nittiest of picks - and feel free to ignore it if you like.  I would prefer this to be spread across three lines. \r\n\r\nThis reads more easily to me: \r\n```scala\r\n  def logoutAction = Action { implicit request =>\r\n     Redirect(routes.AccountController.loginPage()).removingFromSession(SessionKeys.authToken)\r\n  }\r\n```","created_at":"2016-03-15T15:22:03Z","updated_at":"2016-03-15T15:22:03Z","html_url":"https://github.com/hmrc/api-gatekeeper-frontend/pull/1#discussion_r56181514","pull_request_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/pulls/comments/56181514"},"html":{"href":"https://github.com/hmrc/api-gatekeeper-frontend/pull/1#discussion_r56181514"},"pull_request":{"href":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/pulls/1","id":62919789,"html_url":"https://github.com/hmrc/api-gatekeeper-frontend/pull/1","diff_url":"https://github.com/hmrc/api-gatekeeper-frontend/pull/1.diff","patch_url":"https://github.com/hmrc/api-gatekeeper-frontend/pull/1.patch","issue_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/issues/1","number":1,"state":"open","locked":false,"title":"- add authentication for internal users calling auth service","user":{"login":"tamaslang","id":9531143,"avatar_url":"https://avatars.githubusercontent.com/u/9531143?v=3","gravatar_id":"","url":"https://api.github.com/users/tamaslang","html_url":"https://github.com/tamaslang","followers_url":"https://api.github.com/users/tamaslang/followers","following_url":"https://api.github.com/users/tamaslang/following{/other_user}","gists_url":"https://api.github.com/users/tamaslang/gists{/gist_id}","starred_url":"https://api.github.com/users/tamaslang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tamaslang/subscriptions","organizations_url":"https://api.github.com/users/tamaslang/orgs","repos_url":"https://api.github.com/users/tamaslang/repos","events_url":"https://api.github.com/users/tamaslang/events{/privacy}","received_events_url":"https://api.github.com/users/tamaslang/received_events","type":"User","site_admin":false},"body":"- add authorisation with api:gatekeeper role calling authorise service\r\n- modify layout, simplify template hierarchy\r\n- add json encryption\r\n- add navigation links to the header","created_at":"2016-03-15T15:01:52Z","updated_at":"2016-03-15T15:22:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2ad32c712a4e9521eac7004700ad26c727c2cccc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/pulls/1/commits","review_comments_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/pulls/1/comments","review_comment_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/issues/1/comments","statuses_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/statuses/d4204a9165dd04e704656d62b203ef6f23c300e4","head":{"label":"hmrc:API-1140_login_and_authorisation_for_gatekeeper","ref":"API-1140_login_and_authorisation_for_gatekeeper","sha":"d4204a9165dd04e704656d62b203ef6f23c300e4","user":{"login":"hmrc","id":5755339,"avatar_url":"https://avatars.githubusercontent.com/u/5755339?v=3","gravatar_id":"","url":"https://api.github.com/users/hmrc","html_url":"https://github.com/hmrc","followers_url":"https://api.github.com/users/hmrc/followers","following_url":"https://api.github.com/users/hmrc/following{/other_user}","gists_url":"https://api.github.com/users/hmrc/gists{/gist_id}","starred_url":"https://api.github.com/users/hmrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmrc/subscriptions","organizations_url":"https://api.github.com/users/hmrc/orgs","repos_url":"https://api.github.com/users/hmrc/repos","events_url":"https://api.github.com/users/hmrc/events{/privacy}","received_events_url":"https://api.github.com/users/hmrc/received_events","type":"Organization","site_admin":false},"repo":{"id":53493910,"name":"api-gatekeeper-frontend","full_name":"hmrc/api-gatekeeper-frontend","owner":{"login":"hmrc","id":5755339,"avatar_url":"https://avatars.githubusercontent.com/u/5755339?v=3","gravatar_id":"","url":"https://api.github.com/users/hmrc","html_url":"https://github.com/hmrc","followers_url":"https://api.github.com/users/hmrc/followers","following_url":"https://api.github.com/users/hmrc/following{/other_user}","gists_url":"https://api.github.com/users/hmrc/gists{/gist_id}","starred_url":"https://api.github.com/users/hmrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmrc/subscriptions","organizations_url":"https://api.github.com/users/hmrc/orgs","repos_url":"https://api.github.com/users/hmrc/repos","events_url":"https://api.github.com/users/hmrc/events{/privacy}","received_events_url":"https://api.github.com/users/hmrc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hmrc/api-gatekeeper-frontend","description":"","fork":false,"url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend","forks_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/forks","keys_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/teams","hooks_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/hooks","issue_events_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/events","assignees_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/tags","blobs_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/languages","stargazers_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/stargazers","contributors_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/contributors","subscribers_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/subscribers","subscription_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/subscription","commits_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/merges","archive_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/downloads","issues_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/labels{/name}","releases_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/deployments","created_at":"2016-03-09T11:54:21Z","updated_at":"2016-03-09T15:30:34Z","pushed_at":"2016-03-15T15:04:19Z","git_url":"git://github.com/hmrc/api-gatekeeper-frontend.git","ssh_url":"git@github.com:hmrc/api-gatekeeper-frontend.git","clone_url":"https://github.com/hmrc/api-gatekeeper-frontend.git","svn_url":"https://github.com/hmrc/api-gatekeeper-frontend","homepage":"","size":37,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"hmrc:master","ref":"master","sha":"4831897d805e81da519989a42960d3c455201e8d","user":{"login":"hmrc","id":5755339,"avatar_url":"https://avatars.githubusercontent.com/u/5755339?v=3","gravatar_id":"","url":"https://api.github.com/users/hmrc","html_url":"https://github.com/hmrc","followers_url":"https://api.github.com/users/hmrc/followers","following_url":"https://api.github.com/users/hmrc/following{/other_user}","gists_url":"https://api.github.com/users/hmrc/gists{/gist_id}","starred_url":"https://api.github.com/users/hmrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmrc/subscriptions","organizations_url":"https://api.github.com/users/hmrc/orgs","repos_url":"https://api.github.com/users/hmrc/repos","events_url":"https://api.github.com/users/hmrc/events{/privacy}","received_events_url":"https://api.github.com/users/hmrc/received_events","type":"Organization","site_admin":false},"repo":{"id":53493910,"name":"api-gatekeeper-frontend","full_name":"hmrc/api-gatekeeper-frontend","owner":{"login":"hmrc","id":5755339,"avatar_url":"https://avatars.githubusercontent.com/u/5755339?v=3","gravatar_id":"","url":"https://api.github.com/users/hmrc","html_url":"https://github.com/hmrc","followers_url":"https://api.github.com/users/hmrc/followers","following_url":"https://api.github.com/users/hmrc/following{/other_user}","gists_url":"https://api.github.com/users/hmrc/gists{/gist_id}","starred_url":"https://api.github.com/users/hmrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmrc/subscriptions","organizations_url":"https://api.github.com/users/hmrc/orgs","repos_url":"https://api.github.com/users/hmrc/repos","events_url":"https://api.github.com/users/hmrc/events{/privacy}","received_events_url":"https://api.github.com/users/hmrc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hmrc/api-gatekeeper-frontend","description":"","fork":false,"url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend","forks_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/forks","keys_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/teams","hooks_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/hooks","issue_events_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/events","assignees_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/tags","blobs_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/languages","stargazers_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/stargazers","contributors_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/contributors","subscribers_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/subscribers","subscription_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/subscription","commits_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/merges","archive_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/downloads","issues_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/labels{/name}","releases_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/deployments","created_at":"2016-03-09T11:54:21Z","updated_at":"2016-03-09T15:30:34Z","pushed_at":"2016-03-15T15:04:19Z","git_url":"git://github.com/hmrc/api-gatekeeper-frontend.git","ssh_url":"git@github.com:hmrc/api-gatekeeper-frontend.git","clone_url":"https://github.com/hmrc/api-gatekeeper-frontend.git","svn_url":"https://github.com/hmrc/api-gatekeeper-frontend","homepage":"","size":37,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/pulls/1"},"html":{"href":"https://github.com/hmrc/api-gatekeeper-frontend/pull/1"},"issue":{"href":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/issues/1"},"comments":{"href":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/hmrc/api-gatekeeper-frontend/statuses/d4204a9165dd04e704656d62b203ef6f23c300e4"}}}}