{"action":"created","comment":{"url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/comments/47418885","id":47418885,"diff_hunk":"@@ -0,0 +1,59 @@\n+/*\n+ * Copyright 2015 Stormpath, Inc.\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+package com.stormpath.spring.security.token;\n+\n+import com.stormpath.sdk.account.Account;\n+import com.stormpath.sdk.lang.Assert;\n+import org.springframework.security.authentication.AbstractAuthenticationToken;\n+\n+/**\n+ * @since 1.0.RC7.2\n+ */\n+public class IdSiteAuthentication extends AbstractAuthenticationToken {","path":"extensions/spring/stormpath-spring-security/src/main/java/com/stormpath/spring/security/token/IdSiteAuthentication.java","position":25,"original_position":25,"commit_id":"11549250e6aa944e0b45b0697874444043c62261","original_commit_id":"11549250e6aa944e0b45b0697874444043c62261","user":{"login":"dogeared","id":364562,"avatar_url":"https://avatars.githubusercontent.com/u/364562?v=3","gravatar_id":"","url":"https://api.github.com/users/dogeared","html_url":"https://github.com/dogeared","followers_url":"https://api.github.com/users/dogeared/followers","following_url":"https://api.github.com/users/dogeared/following{/other_user}","gists_url":"https://api.github.com/users/dogeared/gists{/gist_id}","starred_url":"https://api.github.com/users/dogeared/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dogeared/subscriptions","organizations_url":"https://api.github.com/users/dogeared/orgs","repos_url":"https://api.github.com/users/dogeared/repos","events_url":"https://api.github.com/users/dogeared/events{/privacy}","received_events_url":"https://api.github.com/users/dogeared/received_events","type":"User","site_admin":false},"body":"Yeah - it's a little strange.\r\n\r\n`AbstractAuthenticationToken` implements `Authentication` and the `AuthenticationProvider.authenticate` take an `Authentication` object as its parameter.\r\n\r\nWhile it looks a little odd here, I thought it looked better in `StormpathAuthenticationProvider.authenticate`\r\n\r\nI'll push up the refactor and let me know what you think. It's easy enough to revert if we don't like it...","created_at":"2015-12-11T23:40:39Z","updated_at":"2015-12-11T23:40:39Z","html_url":"https://github.com/stormpath/stormpath-sdk-java/pull/380#discussion_r47418885","pull_request_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/380","_links":{"self":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/comments/47418885"},"html":{"href":"https://github.com/stormpath/stormpath-sdk-java/pull/380#discussion_r47418885"},"pull_request":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/380"}}},"pull_request":{"url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/380","id":52633075,"html_url":"https://github.com/stormpath/stormpath-sdk-java/pull/380","diff_url":"https://github.com/stormpath/stormpath-sdk-java/pull/380.diff","patch_url":"https://github.com/stormpath/stormpath-sdk-java/pull/380.patch","issue_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/issues/380","number":380,"state":"open","locked":false,"title":"setup ID Site to set Spring Security authentication when applicable","user":{"login":"dogeared","id":364562,"avatar_url":"https://avatars.githubusercontent.com/u/364562?v=3","gravatar_id":"","url":"https://api.github.com/users/dogeared","html_url":"https://github.com/dogeared","followers_url":"https://api.github.com/users/dogeared/followers","following_url":"https://api.github.com/users/dogeared/following{/other_user}","gists_url":"https://api.github.com/users/dogeared/gists{/gist_id}","starred_url":"https://api.github.com/users/dogeared/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dogeared/subscriptions","organizations_url":"https://api.github.com/users/dogeared/orgs","repos_url":"https://api.github.com/users/dogeared/repos","events_url":"https://api.github.com/users/dogeared/events{/privacy}","received_events_url":"https://api.github.com/users/dogeared/received_events","type":"User","site_admin":false},"body":"The motivation for this design is that:\r\n\r\n1. We do not need a different `IDSiteResultController` when Spring Security is in use\r\n\r\n2. By the time we get into the methods of an `IDSiteResultListener`, authentication via ID Site has already occurred. In the context of Spring Security, all that is necessary is to set the authentication in the `SecurityContextHolder`\r\n\r\nWith that in mind, this is a summary of the primary changes in this PR:\r\n\r\n1. `IdSiteResultController` now has a `List` of `IdSiteResultListener` rather than just one `IdSiteResultListener`\r\n\r\n2. `IdSiteCallbackHandler` now has a `List` of `IdSiteResultListener` rather than just one `IdSiteResultListener`\r\n\r\n3. In `AbstractStormpathWebMvcConfiguration`, inside the `stormpathIdSiteResultController` method, the following lined is executed: `controller.addIdSiteResultListener(springSecurityIdSiteResultListener)`.\r\n\r\n4. The Spring Security `IdSiteResultListener` is exposed as a bean in `StormpathWebSecurityAutoConfiguration` and `StormpathWebSecurityConfiguration`\r\n\r\nThe upshot of this configuration is that when Spring Security is enabled, in addition to the default `IdSiteListener` being registered in `IdSiteResultController`, a Spring Security `IdSiteListener` will be registered with `IdSiteResultController`.\r\n\r\nThis approach introduces minimal changes to `IdSiteResultController`, alleviates the need for a Spring Security specific `IdSiteResultController` and ensures that authentication, registration and logout work through the stack with Spring Security and ID Site.","created_at":"2015-12-04T06:01:44Z","updated_at":"2015-12-11T23:40:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4b27db7ad0d183bb2e78589e2d41e47d049cadba","assignee":{"login":"mrioan","id":717498,"avatar_url":"https://avatars.githubusercontent.com/u/717498?v=3","gravatar_id":"","url":"https://api.github.com/users/mrioan","html_url":"https://github.com/mrioan","followers_url":"https://api.github.com/users/mrioan/followers","following_url":"https://api.github.com/users/mrioan/following{/other_user}","gists_url":"https://api.github.com/users/mrioan/gists{/gist_id}","starred_url":"https://api.github.com/users/mrioan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrioan/subscriptions","organizations_url":"https://api.github.com/users/mrioan/orgs","repos_url":"https://api.github.com/users/mrioan/repos","events_url":"https://api.github.com/users/mrioan/events{/privacy}","received_events_url":"https://api.github.com/users/mrioan/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/milestones/33","html_url":"https://github.com/stormpath/stormpath-sdk-java/milestones/1.0.RC7.3","labels_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/milestones/33/labels","id":1452300,"number":33,"title":"1.0.RC7.3","description":"","creator":{"login":"dogeared","id":364562,"avatar_url":"https://avatars.githubusercontent.com/u/364562?v=3","gravatar_id":"","url":"https://api.github.com/users/dogeared","html_url":"https://github.com/dogeared","followers_url":"https://api.github.com/users/dogeared/followers","following_url":"https://api.github.com/users/dogeared/following{/other_user}","gists_url":"https://api.github.com/users/dogeared/gists{/gist_id}","starred_url":"https://api.github.com/users/dogeared/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dogeared/subscriptions","organizations_url":"https://api.github.com/users/dogeared/orgs","repos_url":"https://api.github.com/users/dogeared/repos","events_url":"https://api.github.com/users/dogeared/events{/privacy}","received_events_url":"https://api.github.com/users/dogeared/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":0,"state":"open","created_at":"2015-12-09T17:14:20Z","updated_at":"2015-12-10T15:47:09Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/380/commits","review_comments_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/380/comments","review_comment_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/issues/380/comments","statuses_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/statuses/11549250e6aa944e0b45b0697874444043c62261","head":{"label":"stormpath:idsite_spring_security","ref":"idsite_spring_security","sha":"11549250e6aa944e0b45b0697874444043c62261","user":{"login":"stormpath","id":1377453,"avatar_url":"https://avatars.githubusercontent.com/u/1377453?v=3","gravatar_id":"","url":"https://api.github.com/users/stormpath","html_url":"https://github.com/stormpath","followers_url":"https://api.github.com/users/stormpath/followers","following_url":"https://api.github.com/users/stormpath/following{/other_user}","gists_url":"https://api.github.com/users/stormpath/gists{/gist_id}","starred_url":"https://api.github.com/users/stormpath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stormpath/subscriptions","organizations_url":"https://api.github.com/users/stormpath/orgs","repos_url":"https://api.github.com/users/stormpath/repos","events_url":"https://api.github.com/users/stormpath/events{/privacy}","received_events_url":"https://api.github.com/users/stormpath/received_events","type":"Organization","site_admin":false},"repo":{"id":3913468,"name":"stormpath-sdk-java","full_name":"stormpath/stormpath-sdk-java","owner":{"login":"stormpath","id":1377453,"avatar_url":"https://avatars.githubusercontent.com/u/1377453?v=3","gravatar_id":"","url":"https://api.github.com/users/stormpath","html_url":"https://github.com/stormpath","followers_url":"https://api.github.com/users/stormpath/followers","following_url":"https://api.github.com/users/stormpath/following{/other_user}","gists_url":"https://api.github.com/users/stormpath/gists{/gist_id}","starred_url":"https://api.github.com/users/stormpath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stormpath/subscriptions","organizations_url":"https://api.github.com/users/stormpath/orgs","repos_url":"https://api.github.com/users/stormpath/repos","events_url":"https://api.github.com/users/stormpath/events{/privacy}","received_events_url":"https://api.github.com/users/stormpath/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stormpath/stormpath-sdk-java","description":"Official Java SDK for the Stormpath User Management REST API","fork":false,"url":"https://api.github.com/repos/stormpath/stormpath-sdk-java","forks_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/forks","keys_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/teams","hooks_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/hooks","issue_events_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/issues/events{/number}","events_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/events","assignees_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/assignees{/user}","branches_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/branches{/branch}","tags_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/tags","blobs_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/statuses/{sha}","languages_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/languages","stargazers_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/stargazers","contributors_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/contributors","subscribers_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/subscribers","subscription_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/subscription","commits_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/contents/{+path}","compare_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/merges","archive_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/downloads","issues_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/issues{/number}","pulls_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls{/number}","milestones_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/milestones{/number}","notifications_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/labels{/name}","releases_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/releases{/id}","created_at":"2012-04-03T01:22:09Z","updated_at":"2015-12-11T15:03:28Z","pushed_at":"2015-12-11T22:39:16Z","git_url":"git://github.com/stormpath/stormpath-sdk-java.git","ssh_url":"git@github.com:stormpath/stormpath-sdk-java.git","clone_url":"https://github.com/stormpath/stormpath-sdk-java.git","svn_url":"https://github.com/stormpath/stormpath-sdk-java","homepage":"","size":10187,"stargazers_count":63,"watchers_count":63,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":44,"mirror_url":null,"open_issues_count":84,"forks":44,"open_issues":84,"watchers":63,"default_branch":"master"}},"base":{"label":"stormpath:master","ref":"master","sha":"7f9536c5abd7d5a21c1b2a0b0c5c67e659ffcf42","user":{"login":"stormpath","id":1377453,"avatar_url":"https://avatars.githubusercontent.com/u/1377453?v=3","gravatar_id":"","url":"https://api.github.com/users/stormpath","html_url":"https://github.com/stormpath","followers_url":"https://api.github.com/users/stormpath/followers","following_url":"https://api.github.com/users/stormpath/following{/other_user}","gists_url":"https://api.github.com/users/stormpath/gists{/gist_id}","starred_url":"https://api.github.com/users/stormpath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stormpath/subscriptions","organizations_url":"https://api.github.com/users/stormpath/orgs","repos_url":"https://api.github.com/users/stormpath/repos","events_url":"https://api.github.com/users/stormpath/events{/privacy}","received_events_url":"https://api.github.com/users/stormpath/received_events","type":"Organization","site_admin":false},"repo":{"id":3913468,"name":"stormpath-sdk-java","full_name":"stormpath/stormpath-sdk-java","owner":{"login":"stormpath","id":1377453,"avatar_url":"https://avatars.githubusercontent.com/u/1377453?v=3","gravatar_id":"","url":"https://api.github.com/users/stormpath","html_url":"https://github.com/stormpath","followers_url":"https://api.github.com/users/stormpath/followers","following_url":"https://api.github.com/users/stormpath/following{/other_user}","gists_url":"https://api.github.com/users/stormpath/gists{/gist_id}","starred_url":"https://api.github.com/users/stormpath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stormpath/subscriptions","organizations_url":"https://api.github.com/users/stormpath/orgs","repos_url":"https://api.github.com/users/stormpath/repos","events_url":"https://api.github.com/users/stormpath/events{/privacy}","received_events_url":"https://api.github.com/users/stormpath/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stormpath/stormpath-sdk-java","description":"Official Java SDK for the Stormpath User Management REST API","fork":false,"url":"https://api.github.com/repos/stormpath/stormpath-sdk-java","forks_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/forks","keys_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/teams","hooks_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/hooks","issue_events_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/issues/events{/number}","events_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/events","assignees_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/assignees{/user}","branches_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/branches{/branch}","tags_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/tags","blobs_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/statuses/{sha}","languages_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/languages","stargazers_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/stargazers","contributors_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/contributors","subscribers_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/subscribers","subscription_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/subscription","commits_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/contents/{+path}","compare_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/merges","archive_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/downloads","issues_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/issues{/number}","pulls_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls{/number}","milestones_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/milestones{/number}","notifications_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/labels{/name}","releases_url":"https://api.github.com/repos/stormpath/stormpath-sdk-java/releases{/id}","created_at":"2012-04-03T01:22:09Z","updated_at":"2015-12-11T15:03:28Z","pushed_at":"2015-12-11T22:39:16Z","git_url":"git://github.com/stormpath/stormpath-sdk-java.git","ssh_url":"git@github.com:stormpath/stormpath-sdk-java.git","clone_url":"https://github.com/stormpath/stormpath-sdk-java.git","svn_url":"https://github.com/stormpath/stormpath-sdk-java","homepage":"","size":10187,"stargazers_count":63,"watchers_count":63,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":44,"mirror_url":null,"open_issues_count":84,"forks":44,"open_issues":84,"watchers":63,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/380"},"html":{"href":"https://github.com/stormpath/stormpath-sdk-java/pull/380"},"issue":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-java/issues/380"},"comments":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-java/issues/380/comments"},"review_comments":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/380/comments"},"review_comment":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-java/pulls/380/commits"},"statuses":{"href":"https://api.github.com/repos/stormpath/stormpath-sdk-java/statuses/11549250e6aa944e0b45b0697874444043c62261"}}}}