{"action":"created","comment":{"url":"https://api.github.com/repos/Jasig/cas/pulls/comments/51866766","id":51866766,"diff_hunk":"@@ -39,19 +41,37 @@\n     private CentralAuthenticationService centralAuthenticationService;\n \n     @NotNull\n-    @Autowired(required=false)\n+    @Autowired\n     @Qualifier(\"defaultAuthenticationSystemSupport\")\n     private AuthenticationSystemSupport authenticationSystemSupport = new DefaultAuthenticationSystemSupport();\n \n+    @Autowired\n+    @Qualifier(\"defaultAuthenticationSupport\")\n+    private TicketRegistrySupport ticketRegistrySupport;\n+\n     @Override\n     protected Event doExecute(final RequestContext context) {\n         final Service service = WebUtils.getService(context);\n         final String ticketGrantingTicket = WebUtils.getTicketGrantingTicketId(context);\n \n         try {\n-            final Credential credential = WebUtils.getCredential(context);\n-            final AuthenticationResult authenticationResult =\n-                    this.authenticationSystemSupport.handleAndFinalizeSingleAuthenticationTransaction(service, credential);\n+            /**\n+             * In the initial primary authentication flow, credentials are cached and available.\n+             * Since they are authenticated as part of submission first, there is no need to doubly\n+             * authenticate and verify credentials.\n+             *\n+             * In subsequent authentication flows where a TGT is available and only an ST needs to be\n+             * created, there are no cached copies of the credential, since we do have a TGT available.\n+             * So we will simply grab the available authentication and produce the final result based on that.\n+             */\n+            final Authentication authentication = ticketRegistrySupport.getAuthenticationFrom(ticketGrantingTicket);\n+            if (authentication == null) {\n+                throw new InvalidTicketException(\n+                        new AuthenticationException(\"No authentication found for ticket \" + ticketGrantingTicket), ticketGrantingTicket);\n+            }\n+            final AuthenticationResultBuilder authenticationResultBuilder = authenticationSystemSupport","path":"cas-server-webapp-actions/src/main/java/org/jasig/cas/web/flow/GenerateServiceTicketAction.java","position":56,"original_position":56,"commit_id":"c88570a9c78c670d82b5c185795906c71c3f33e1","original_commit_id":"c88570a9c78c670d82b5c185795906c71c3f33e1","user":{"login":"mmoayyed","id":1205228,"avatar_url":"https://avatars.githubusercontent.com/u/1205228?v=3","gravatar_id":"","url":"https://api.github.com/users/mmoayyed","html_url":"https://github.com/mmoayyed","followers_url":"https://api.github.com/users/mmoayyed/followers","following_url":"https://api.github.com/users/mmoayyed/following{/other_user}","gists_url":"https://api.github.com/users/mmoayyed/gists{/gist_id}","starred_url":"https://api.github.com/users/mmoayyed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmoayyed/subscriptions","organizations_url":"https://api.github.com/users/mmoayyed/orgs","repos_url":"https://api.github.com/users/mmoayyed/repos","events_url":"https://api.github.com/users/mmoayyed/events{/privacy}","received_events_url":"https://api.github.com/users/mmoayyed/received_events","type":"User","site_admin":false},"body":"I started with that solution, but then realized that since we already have the TGT cached, I should be able to easily establish an authN context/result from that without getting SWF involved.  The approach you have in mind is implemented in MFA where we need that initial context for subsequent flows, so I decided to reuse the existing APIs for now, and provide support for SWF caching when MFA merges in. (The MFA branch does cache the result of course because flows need it later)","created_at":"2016-02-04T12:38:06Z","updated_at":"2016-02-04T12:38:06Z","html_url":"https://github.com/Jasig/cas/pull/1511#discussion_r51866766","pull_request_url":"https://api.github.com/repos/Jasig/cas/pulls/1511","_links":{"self":{"href":"https://api.github.com/repos/Jasig/cas/pulls/comments/51866766"},"html":{"href":"https://github.com/Jasig/cas/pull/1511#discussion_r51866766"},"pull_request":{"href":"https://api.github.com/repos/Jasig/cas/pulls/1511"}}},"pull_request":{"url":"https://api.github.com/repos/Jasig/cas/pulls/1511","id":58274126,"html_url":"https://github.com/Jasig/cas/pull/1511","diff_url":"https://github.com/Jasig/cas/pull/1511.diff","patch_url":"https://github.com/Jasig/cas/pull/1511.patch","issue_url":"https://api.github.com/repos/Jasig/cas/issues/1511","number":1511,"state":"open","locked":false,"title":"Remove double authentication when generating STs","user":{"login":"mmoayyed","id":1205228,"avatar_url":"https://avatars.githubusercontent.com/u/1205228?v=3","gravatar_id":"","url":"https://api.github.com/users/mmoayyed","html_url":"https://github.com/mmoayyed","followers_url":"https://api.github.com/users/mmoayyed/followers","following_url":"https://api.github.com/users/mmoayyed/following{/other_user}","gists_url":"https://api.github.com/users/mmoayyed/gists{/gist_id}","starred_url":"https://api.github.com/users/mmoayyed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmoayyed/subscriptions","organizations_url":"https://api.github.com/users/mmoayyed/orgs","repos_url":"https://api.github.com/users/mmoayyed/repos","events_url":"https://api.github.com/users/mmoayyed/events{/privacy}","received_events_url":"https://api.github.com/users/mmoayyed/received_events","type":"User","site_admin":false},"body":"Closes #1506 \r\n\r\nGrabs the authentication object from the existing TGT and builds a result out of that, rather than authenticating the credentials again. ","created_at":"2016-02-04T11:34:33Z","updated_at":"2016-02-04T12:38:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7376c1f9507817e203cdc956643b8bcbaa72e75d","assignee":null,"milestone":{"url":"https://api.github.com/repos/Jasig/cas/milestones/15","html_url":"https://github.com/Jasig/cas/milestones/4.3.0","labels_url":"https://api.github.com/repos/Jasig/cas/milestones/15/labels","id":1349862,"number":15,"title":"4.3.0","description":"CAS version 4.3.0 minor release","creator":{"login":"mmoayyed","id":1205228,"avatar_url":"https://avatars.githubusercontent.com/u/1205228?v=3","gravatar_id":"","url":"https://api.github.com/users/mmoayyed","html_url":"https://github.com/mmoayyed","followers_url":"https://api.github.com/users/mmoayyed/followers","following_url":"https://api.github.com/users/mmoayyed/following{/other_user}","gists_url":"https://api.github.com/users/mmoayyed/gists{/gist_id}","starred_url":"https://api.github.com/users/mmoayyed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmoayyed/subscriptions","organizations_url":"https://api.github.com/users/mmoayyed/orgs","repos_url":"https://api.github.com/users/mmoayyed/repos","events_url":"https://api.github.com/users/mmoayyed/events{/privacy}","received_events_url":"https://api.github.com/users/mmoayyed/received_events","type":"User","site_admin":false},"open_issues":19,"closed_issues":59,"state":"open","created_at":"2015-10-12T01:28:38Z","updated_at":"2016-02-04T12:32:32Z","due_on":"2016-04-19T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/Jasig/cas/pulls/1511/commits","review_comments_url":"https://api.github.com/repos/Jasig/cas/pulls/1511/comments","review_comment_url":"https://api.github.com/repos/Jasig/cas/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Jasig/cas/issues/1511/comments","statuses_url":"https://api.github.com/repos/Jasig/cas/statuses/c88570a9c78c670d82b5c185795906c71c3f33e1","head":{"label":"Unicon:double-authN","ref":"double-authN","sha":"c88570a9c78c670d82b5c185795906c71c3f33e1","user":{"login":"Unicon","id":835400,"avatar_url":"https://avatars.githubusercontent.com/u/835400?v=3","gravatar_id":"","url":"https://api.github.com/users/Unicon","html_url":"https://github.com/Unicon","followers_url":"https://api.github.com/users/Unicon/followers","following_url":"https://api.github.com/users/Unicon/following{/other_user}","gists_url":"https://api.github.com/users/Unicon/gists{/gist_id}","starred_url":"https://api.github.com/users/Unicon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Unicon/subscriptions","organizations_url":"https://api.github.com/users/Unicon/orgs","repos_url":"https://api.github.com/users/Unicon/repos","events_url":"https://api.github.com/users/Unicon/events{/privacy}","received_events_url":"https://api.github.com/users/Unicon/received_events","type":"Organization","site_admin":false},"repo":{"id":6410069,"name":"cas","full_name":"Unicon/cas","owner":{"login":"Unicon","id":835400,"avatar_url":"https://avatars.githubusercontent.com/u/835400?v=3","gravatar_id":"","url":"https://api.github.com/users/Unicon","html_url":"https://github.com/Unicon","followers_url":"https://api.github.com/users/Unicon/followers","following_url":"https://api.github.com/users/Unicon/following{/other_user}","gists_url":"https://api.github.com/users/Unicon/gists{/gist_id}","starred_url":"https://api.github.com/users/Unicon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Unicon/subscriptions","organizations_url":"https://api.github.com/users/Unicon/orgs","repos_url":"https://api.github.com/users/Unicon/repos","events_url":"https://api.github.com/users/Unicon/events{/privacy}","received_events_url":"https://api.github.com/users/Unicon/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Unicon/cas","description":"Jasig CAS - Single Sign On for the Web","fork":true,"url":"https://api.github.com/repos/Unicon/cas","forks_url":"https://api.github.com/repos/Unicon/cas/forks","keys_url":"https://api.github.com/repos/Unicon/cas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Unicon/cas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Unicon/cas/teams","hooks_url":"https://api.github.com/repos/Unicon/cas/hooks","issue_events_url":"https://api.github.com/repos/Unicon/cas/issues/events{/number}","events_url":"https://api.github.com/repos/Unicon/cas/events","assignees_url":"https://api.github.com/repos/Unicon/cas/assignees{/user}","branches_url":"https://api.github.com/repos/Unicon/cas/branches{/branch}","tags_url":"https://api.github.com/repos/Unicon/cas/tags","blobs_url":"https://api.github.com/repos/Unicon/cas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Unicon/cas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Unicon/cas/git/refs{/sha}","trees_url":"https://api.github.com/repos/Unicon/cas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Unicon/cas/statuses/{sha}","languages_url":"https://api.github.com/repos/Unicon/cas/languages","stargazers_url":"https://api.github.com/repos/Unicon/cas/stargazers","contributors_url":"https://api.github.com/repos/Unicon/cas/contributors","subscribers_url":"https://api.github.com/repos/Unicon/cas/subscribers","subscription_url":"https://api.github.com/repos/Unicon/cas/subscription","commits_url":"https://api.github.com/repos/Unicon/cas/commits{/sha}","git_commits_url":"https://api.github.com/repos/Unicon/cas/git/commits{/sha}","comments_url":"https://api.github.com/repos/Unicon/cas/comments{/number}","issue_comment_url":"https://api.github.com/repos/Unicon/cas/issues/comments{/number}","contents_url":"https://api.github.com/repos/Unicon/cas/contents/{+path}","compare_url":"https://api.github.com/repos/Unicon/cas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Unicon/cas/merges","archive_url":"https://api.github.com/repos/Unicon/cas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Unicon/cas/downloads","issues_url":"https://api.github.com/repos/Unicon/cas/issues{/number}","pulls_url":"https://api.github.com/repos/Unicon/cas/pulls{/number}","milestones_url":"https://api.github.com/repos/Unicon/cas/milestones{/number}","notifications_url":"https://api.github.com/repos/Unicon/cas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Unicon/cas/labels{/name}","releases_url":"https://api.github.com/repos/Unicon/cas/releases{/id}","deployments_url":"https://api.github.com/repos/Unicon/cas/deployments","created_at":"2012-10-26T20:34:46Z","updated_at":"2015-11-25T01:55:15Z","pushed_at":"2016-02-04T12:17:35Z","git_url":"git://github.com/Unicon/cas.git","ssh_url":"git@github.com:Unicon/cas.git","clone_url":"https://github.com/Unicon/cas.git","svn_url":"https://github.com/Unicon/cas","homepage":"http://www.jasig.org/cas","size":36969,"stargazers_count":22,"watchers_count":22,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":0,"forks":23,"open_issues":0,"watchers":22,"default_branch":"master"}},"base":{"label":"Jasig:master","ref":"master","sha":"6aee0311e5e45e7e0f125f9cfabae0419259aa52","user":{"login":"Jasig","id":884285,"avatar_url":"https://avatars.githubusercontent.com/u/884285?v=3","gravatar_id":"","url":"https://api.github.com/users/Jasig","html_url":"https://github.com/Jasig","followers_url":"https://api.github.com/users/Jasig/followers","following_url":"https://api.github.com/users/Jasig/following{/other_user}","gists_url":"https://api.github.com/users/Jasig/gists{/gist_id}","starred_url":"https://api.github.com/users/Jasig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jasig/subscriptions","organizations_url":"https://api.github.com/users/Jasig/orgs","repos_url":"https://api.github.com/users/Jasig/repos","events_url":"https://api.github.com/users/Jasig/events{/privacy}","received_events_url":"https://api.github.com/users/Jasig/received_events","type":"Organization","site_admin":false},"repo":{"id":2352744,"name":"cas","full_name":"Jasig/cas","owner":{"login":"Jasig","id":884285,"avatar_url":"https://avatars.githubusercontent.com/u/884285?v=3","gravatar_id":"","url":"https://api.github.com/users/Jasig","html_url":"https://github.com/Jasig","followers_url":"https://api.github.com/users/Jasig/followers","following_url":"https://api.github.com/users/Jasig/following{/other_user}","gists_url":"https://api.github.com/users/Jasig/gists{/gist_id}","starred_url":"https://api.github.com/users/Jasig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jasig/subscriptions","organizations_url":"https://api.github.com/users/Jasig/orgs","repos_url":"https://api.github.com/users/Jasig/repos","events_url":"https://api.github.com/users/Jasig/events{/privacy}","received_events_url":"https://api.github.com/users/Jasig/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Jasig/cas","description":"Apereo CAS - Single Sign On for the Web","fork":false,"url":"https://api.github.com/repos/Jasig/cas","forks_url":"https://api.github.com/repos/Jasig/cas/forks","keys_url":"https://api.github.com/repos/Jasig/cas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Jasig/cas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Jasig/cas/teams","hooks_url":"https://api.github.com/repos/Jasig/cas/hooks","issue_events_url":"https://api.github.com/repos/Jasig/cas/issues/events{/number}","events_url":"https://api.github.com/repos/Jasig/cas/events","assignees_url":"https://api.github.com/repos/Jasig/cas/assignees{/user}","branches_url":"https://api.github.com/repos/Jasig/cas/branches{/branch}","tags_url":"https://api.github.com/repos/Jasig/cas/tags","blobs_url":"https://api.github.com/repos/Jasig/cas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Jasig/cas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Jasig/cas/git/refs{/sha}","trees_url":"https://api.github.com/repos/Jasig/cas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Jasig/cas/statuses/{sha}","languages_url":"https://api.github.com/repos/Jasig/cas/languages","stargazers_url":"https://api.github.com/repos/Jasig/cas/stargazers","contributors_url":"https://api.github.com/repos/Jasig/cas/contributors","subscribers_url":"https://api.github.com/repos/Jasig/cas/subscribers","subscription_url":"https://api.github.com/repos/Jasig/cas/subscription","commits_url":"https://api.github.com/repos/Jasig/cas/commits{/sha}","git_commits_url":"https://api.github.com/repos/Jasig/cas/git/commits{/sha}","comments_url":"https://api.github.com/repos/Jasig/cas/comments{/number}","issue_comment_url":"https://api.github.com/repos/Jasig/cas/issues/comments{/number}","contents_url":"https://api.github.com/repos/Jasig/cas/contents/{+path}","compare_url":"https://api.github.com/repos/Jasig/cas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Jasig/cas/merges","archive_url":"https://api.github.com/repos/Jasig/cas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Jasig/cas/downloads","issues_url":"https://api.github.com/repos/Jasig/cas/issues{/number}","pulls_url":"https://api.github.com/repos/Jasig/cas/pulls{/number}","milestones_url":"https://api.github.com/repos/Jasig/cas/milestones{/number}","notifications_url":"https://api.github.com/repos/Jasig/cas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Jasig/cas/labels{/name}","releases_url":"https://api.github.com/repos/Jasig/cas/releases{/id}","deployments_url":"https://api.github.com/repos/Jasig/cas/deployments","created_at":"2011-09-09T01:36:42Z","updated_at":"2016-02-04T08:54:54Z","pushed_at":"2016-02-04T12:32:24Z","git_url":"git://github.com/Jasig/cas.git","ssh_url":"git@github.com:Jasig/cas.git","clone_url":"https://github.com/Jasig/cas.git","svn_url":"https://github.com/Jasig/cas","homepage":"http://jasig.github.io/cas/","size":889255,"stargazers_count":1147,"watchers_count":1147,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":857,"mirror_url":null,"open_issues_count":32,"forks":857,"open_issues":32,"watchers":1147,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Jasig/cas/pulls/1511"},"html":{"href":"https://github.com/Jasig/cas/pull/1511"},"issue":{"href":"https://api.github.com/repos/Jasig/cas/issues/1511"},"comments":{"href":"https://api.github.com/repos/Jasig/cas/issues/1511/comments"},"review_comments":{"href":"https://api.github.com/repos/Jasig/cas/pulls/1511/comments"},"review_comment":{"href":"https://api.github.com/repos/Jasig/cas/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Jasig/cas/pulls/1511/commits"},"statuses":{"href":"https://api.github.com/repos/Jasig/cas/statuses/c88570a9c78c670d82b5c185795906c71c3f33e1"}}}}