{"action":"created","comment":{"url":"https://api.github.com/repos/apereo/cas/pulls/comments/77102570","id":77102570,"diff_hunk":"@@ -30,14 +52,65 @@ public AccessTokenImpl() {\n     /**\n      * Constructs a new access token with unique id for a service and authentication.\n      *\n-     * @param id the unique identifier for the ticket.\n-     * @param service the service this ticket is for.\n-     * @param authentication the authentication.\n+     * @param id               the unique identifier for the ticket.\n+     * @param service          the service this ticket is for.\n+     * @param authentication   the authentication.\n      * @param expirationPolicy the expiration policy.\n      * @throws IllegalArgumentException if the service or authentication are null.\n      */\n     public AccessTokenImpl(final String id, final Service service, final Authentication authentication,\n                            final ExpirationPolicy expirationPolicy) {\n         super(id, service, authentication, expirationPolicy);\n+        scope = null;\n+    }\n+\n+    /**\n+     * Constructs a new limited scope access token with unique id for a service and authentication.\n+     *\n+     * @param id               the unique identifier for the ticket.\n+     * @param service          the service this ticket is for.\n+     * @param authentication   the authentication.\n+     * @param expirationPolicy the expiration policy.\n+     * @param scopes           limited scope\n+     * @throws IllegalArgumentException if the service or authentication are null.\n+     */\n+    public AccessTokenImpl(final String id, final Service service, final Authentication authentication,\n+                           final ExpirationPolicy expirationPolicy, List<String> scopes) {\n+        super(id, service, authentication, expirationPolicy);\n+        scope = new HashSet<>(scopes);\n+    }\n+\n+    @Override\n+    public boolean isValidFor(Service serviceToValidate) {\n+        update();\n+        if (scope == null)\n+            return true;\n+        return this.scope.contains(serviceToValidate.getId());\n+    }\n+\n+    @Override\n+    public TicketGrantingTicket getGrantingTicket() {\n+        return this.ticketGrantingTicket;\n+    }\n+\n+    public void setRefreshToken(RefreshToken refreshToken) {\n+        this.ticketGrantingTicket = refreshToken;\n+    }\n+\n+    @Override\n+    public void setPrincipal(Principal principal) {\n+\n+    }\n+\n+    @Override\n+    public boolean matches(Service service) {","path":"cas-server-support-oauth-core/src/main/java/org/apereo/cas/ticket/accesstoken/AccessTokenImpl.java","position":103,"original_position":103,"commit_id":"5b8c5397fdacd667b2e78a2a7fe5ba3d698c34d7","original_commit_id":"5b8c5397fdacd667b2e78a2a7fe5ba3d698c34d7","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars.githubusercontent.com/u/19940114?v=3","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://www.codacy.com/assets/images/favicon.png) Issue found: [Parameter service should be final.](https://www.codacy.com/app/mmoayyed/cas/file/3689912718/issues/source?bid=3256115&fileBranchId=3656152#l106)","created_at":"2016-09-01T01:39:37Z","updated_at":"2016-09-01T01:39:37Z","html_url":"https://github.com/apereo/cas/pull/1982#discussion_r77102570","pull_request_url":"https://api.github.com/repos/apereo/cas/pulls/1982","_links":{"self":{"href":"https://api.github.com/repos/apereo/cas/pulls/comments/77102570"},"html":{"href":"https://github.com/apereo/cas/pull/1982#discussion_r77102570"},"pull_request":{"href":"https://api.github.com/repos/apereo/cas/pulls/1982"}}},"pull_request":{"url":"https://api.github.com/repos/apereo/cas/pulls/1982","id":83407069,"html_url":"https://github.com/apereo/cas/pull/1982","diff_url":"https://github.com/apereo/cas/pull/1982.diff","patch_url":"https://github.com/apereo/cas/pull/1982.patch","issue_url":"https://api.github.com/repos/apereo/cas/issues/1982","number":1982,"state":"open","locked":false,"title":"Code optimization, scalability。Ensure user-defined tokens are available","user":{"login":"zawn","id":5005199,"avatar_url":"https://avatars.githubusercontent.com/u/5005199?v=3","gravatar_id":"","url":"https://api.github.com/users/zawn","html_url":"https://github.com/zawn","followers_url":"https://api.github.com/users/zawn/followers","following_url":"https://api.github.com/users/zawn/following{/other_user}","gists_url":"https://api.github.com/users/zawn/gists{/gist_id}","starred_url":"https://api.github.com/users/zawn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zawn/subscriptions","organizations_url":"https://api.github.com/users/zawn/orgs","repos_url":"https://api.github.com/users/zawn/repos","events_url":"https://api.github.com/users/zawn/events{/privacy}","received_events_url":"https://api.github.com/users/zawn/received_events","type":"User","site_admin":false},"body":"Direct use prefix to find the type","created_at":"2016-08-31T08:15:18Z","updated_at":"2016-09-01T01:39:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"259f5792356f0bababdfe6cae5de1a11742ebc48","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apereo/cas/pulls/1982/commits","review_comments_url":"https://api.github.com/repos/apereo/cas/pulls/1982/comments","review_comment_url":"https://api.github.com/repos/apereo/cas/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apereo/cas/issues/1982/comments","statuses_url":"https://api.github.com/repos/apereo/cas/statuses/5b8c5397fdacd667b2e78a2a7fe5ba3d698c34d7","head":{"label":"zawn:cas-1981","ref":"cas-1981","sha":"5b8c5397fdacd667b2e78a2a7fe5ba3d698c34d7","user":{"login":"zawn","id":5005199,"avatar_url":"https://avatars.githubusercontent.com/u/5005199?v=3","gravatar_id":"","url":"https://api.github.com/users/zawn","html_url":"https://github.com/zawn","followers_url":"https://api.github.com/users/zawn/followers","following_url":"https://api.github.com/users/zawn/following{/other_user}","gists_url":"https://api.github.com/users/zawn/gists{/gist_id}","starred_url":"https://api.github.com/users/zawn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zawn/subscriptions","organizations_url":"https://api.github.com/users/zawn/orgs","repos_url":"https://api.github.com/users/zawn/repos","events_url":"https://api.github.com/users/zawn/events{/privacy}","received_events_url":"https://api.github.com/users/zawn/received_events","type":"User","site_admin":false},"repo":{"id":55386607,"name":"cas","full_name":"zawn/cas","owner":{"login":"zawn","id":5005199,"avatar_url":"https://avatars.githubusercontent.com/u/5005199?v=3","gravatar_id":"","url":"https://api.github.com/users/zawn","html_url":"https://github.com/zawn","followers_url":"https://api.github.com/users/zawn/followers","following_url":"https://api.github.com/users/zawn/following{/other_user}","gists_url":"https://api.github.com/users/zawn/gists{/gist_id}","starred_url":"https://api.github.com/users/zawn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zawn/subscriptions","organizations_url":"https://api.github.com/users/zawn/orgs","repos_url":"https://api.github.com/users/zawn/repos","events_url":"https://api.github.com/users/zawn/events{/privacy}","received_events_url":"https://api.github.com/users/zawn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zawn/cas","description":"Apereo CAS - Enterprise Single Sign On for all ","fork":true,"url":"https://api.github.com/repos/zawn/cas","forks_url":"https://api.github.com/repos/zawn/cas/forks","keys_url":"https://api.github.com/repos/zawn/cas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zawn/cas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zawn/cas/teams","hooks_url":"https://api.github.com/repos/zawn/cas/hooks","issue_events_url":"https://api.github.com/repos/zawn/cas/issues/events{/number}","events_url":"https://api.github.com/repos/zawn/cas/events","assignees_url":"https://api.github.com/repos/zawn/cas/assignees{/user}","branches_url":"https://api.github.com/repos/zawn/cas/branches{/branch}","tags_url":"https://api.github.com/repos/zawn/cas/tags","blobs_url":"https://api.github.com/repos/zawn/cas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zawn/cas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zawn/cas/git/refs{/sha}","trees_url":"https://api.github.com/repos/zawn/cas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zawn/cas/statuses/{sha}","languages_url":"https://api.github.com/repos/zawn/cas/languages","stargazers_url":"https://api.github.com/repos/zawn/cas/stargazers","contributors_url":"https://api.github.com/repos/zawn/cas/contributors","subscribers_url":"https://api.github.com/repos/zawn/cas/subscribers","subscription_url":"https://api.github.com/repos/zawn/cas/subscription","commits_url":"https://api.github.com/repos/zawn/cas/commits{/sha}","git_commits_url":"https://api.github.com/repos/zawn/cas/git/commits{/sha}","comments_url":"https://api.github.com/repos/zawn/cas/comments{/number}","issue_comment_url":"https://api.github.com/repos/zawn/cas/issues/comments{/number}","contents_url":"https://api.github.com/repos/zawn/cas/contents/{+path}","compare_url":"https://api.github.com/repos/zawn/cas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zawn/cas/merges","archive_url":"https://api.github.com/repos/zawn/cas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zawn/cas/downloads","issues_url":"https://api.github.com/repos/zawn/cas/issues{/number}","pulls_url":"https://api.github.com/repos/zawn/cas/pulls{/number}","milestones_url":"https://api.github.com/repos/zawn/cas/milestones{/number}","notifications_url":"https://api.github.com/repos/zawn/cas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zawn/cas/labels{/name}","releases_url":"https://api.github.com/repos/zawn/cas/releases{/id}","deployments_url":"https://api.github.com/repos/zawn/cas/deployments","created_at":"2016-04-04T05:11:22Z","updated_at":"2016-05-26T13:38:33Z","pushed_at":"2016-08-31T17:05:09Z","git_url":"git://github.com/zawn/cas.git","ssh_url":"git@github.com:zawn/cas.git","clone_url":"https://github.com/zawn/cas.git","svn_url":"https://github.com/zawn/cas","homepage":"http://apereo.github.io/cas/","size":1004129,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"apereo:master","ref":"master","sha":"fadd7c9844ae709391865e2d75c6de32bf0bffd8","user":{"login":"apereo","id":4679233,"avatar_url":"https://avatars.githubusercontent.com/u/4679233?v=3","gravatar_id":"","url":"https://api.github.com/users/apereo","html_url":"https://github.com/apereo","followers_url":"https://api.github.com/users/apereo/followers","following_url":"https://api.github.com/users/apereo/following{/other_user}","gists_url":"https://api.github.com/users/apereo/gists{/gist_id}","starred_url":"https://api.github.com/users/apereo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apereo/subscriptions","organizations_url":"https://api.github.com/users/apereo/orgs","repos_url":"https://api.github.com/users/apereo/repos","events_url":"https://api.github.com/users/apereo/events{/privacy}","received_events_url":"https://api.github.com/users/apereo/received_events","type":"Organization","site_admin":false},"repo":{"id":2352744,"name":"cas","full_name":"apereo/cas","owner":{"login":"apereo","id":4679233,"avatar_url":"https://avatars.githubusercontent.com/u/4679233?v=3","gravatar_id":"","url":"https://api.github.com/users/apereo","html_url":"https://github.com/apereo","followers_url":"https://api.github.com/users/apereo/followers","following_url":"https://api.github.com/users/apereo/following{/other_user}","gists_url":"https://api.github.com/users/apereo/gists{/gist_id}","starred_url":"https://api.github.com/users/apereo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apereo/subscriptions","organizations_url":"https://api.github.com/users/apereo/orgs","repos_url":"https://api.github.com/users/apereo/repos","events_url":"https://api.github.com/users/apereo/events{/privacy}","received_events_url":"https://api.github.com/users/apereo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apereo/cas","description":"Apereo CAS - Enterprise Single Sign On for all","fork":false,"url":"https://api.github.com/repos/apereo/cas","forks_url":"https://api.github.com/repos/apereo/cas/forks","keys_url":"https://api.github.com/repos/apereo/cas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apereo/cas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apereo/cas/teams","hooks_url":"https://api.github.com/repos/apereo/cas/hooks","issue_events_url":"https://api.github.com/repos/apereo/cas/issues/events{/number}","events_url":"https://api.github.com/repos/apereo/cas/events","assignees_url":"https://api.github.com/repos/apereo/cas/assignees{/user}","branches_url":"https://api.github.com/repos/apereo/cas/branches{/branch}","tags_url":"https://api.github.com/repos/apereo/cas/tags","blobs_url":"https://api.github.com/repos/apereo/cas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apereo/cas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apereo/cas/git/refs{/sha}","trees_url":"https://api.github.com/repos/apereo/cas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apereo/cas/statuses/{sha}","languages_url":"https://api.github.com/repos/apereo/cas/languages","stargazers_url":"https://api.github.com/repos/apereo/cas/stargazers","contributors_url":"https://api.github.com/repos/apereo/cas/contributors","subscribers_url":"https://api.github.com/repos/apereo/cas/subscribers","subscription_url":"https://api.github.com/repos/apereo/cas/subscription","commits_url":"https://api.github.com/repos/apereo/cas/commits{/sha}","git_commits_url":"https://api.github.com/repos/apereo/cas/git/commits{/sha}","comments_url":"https://api.github.com/repos/apereo/cas/comments{/number}","issue_comment_url":"https://api.github.com/repos/apereo/cas/issues/comments{/number}","contents_url":"https://api.github.com/repos/apereo/cas/contents/{+path}","compare_url":"https://api.github.com/repos/apereo/cas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apereo/cas/merges","archive_url":"https://api.github.com/repos/apereo/cas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apereo/cas/downloads","issues_url":"https://api.github.com/repos/apereo/cas/issues{/number}","pulls_url":"https://api.github.com/repos/apereo/cas/pulls{/number}","milestones_url":"https://api.github.com/repos/apereo/cas/milestones{/number}","notifications_url":"https://api.github.com/repos/apereo/cas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apereo/cas/labels{/name}","releases_url":"https://api.github.com/repos/apereo/cas/releases{/id}","deployments_url":"https://api.github.com/repos/apereo/cas/deployments","created_at":"2011-09-09T01:36:42Z","updated_at":"2016-08-31T14:58:31Z","pushed_at":"2016-08-31T21:29:03Z","git_url":"git://github.com/apereo/cas.git","ssh_url":"git@github.com:apereo/cas.git","clone_url":"https://github.com/apereo/cas.git","svn_url":"https://github.com/apereo/cas","homepage":"https://apereo.github.io/cas/","size":1278101,"stargazers_count":1700,"watchers_count":1700,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1151,"mirror_url":null,"open_issues_count":27,"forks":1151,"open_issues":27,"watchers":1700,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apereo/cas/pulls/1982"},"html":{"href":"https://github.com/apereo/cas/pull/1982"},"issue":{"href":"https://api.github.com/repos/apereo/cas/issues/1982"},"comments":{"href":"https://api.github.com/repos/apereo/cas/issues/1982/comments"},"review_comments":{"href":"https://api.github.com/repos/apereo/cas/pulls/1982/comments"},"review_comment":{"href":"https://api.github.com/repos/apereo/cas/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apereo/cas/pulls/1982/commits"},"statuses":{"href":"https://api.github.com/repos/apereo/cas/statuses/5b8c5397fdacd667b2e78a2a7fe5ba3d698c34d7"}}}}
{"actor":{"display_login":"codacy-bot"}}