{"action":"created","comment":{"url":"https://api.github.com/repos/MastodonC/kixi.heimdall/pulls/comments/77006916","id":77006916,"diff_hunk":"@@ -32,37 +32,46 @@\n \n (defn- make-auth-token [user auth-conf]\n   (let [exp (-> (t/plus (t/now) (t/minutes 30)) (c/to-long))]\n-    (jwt/sign user\n-              (private-key auth-conf)\n-              {:alg :rs256 :exp exp})))\n+    (if user (try (jwt/sign user\n+                              (private-key auth-conf)\n+                              {:alg :rs256 :exp exp})\n+                    (catch Exception _ (do (log/debug \"Sign auth token failed\")\n+                                           nil)))\n+        (do (log/debug \"User credentials missing\") nil))))\n \n (defn unsign-token [auth-conf token]\n   (and token\n        (try (jwt/unsign token (public-key auth-conf)\n                         {:alg :rs256 :now (c/to-long (t/now))})\n-            (catch clojure.lang.ExceptionInfo e\n+            (catch clojure.lang.ExceptionInfo _\n               (do (log/debug \"Unsign refresh token failed\")\n                   nil)))))\n \n (defn make-refresh-token [issued-at-time auth-conf user]\n   (let [exp (-> (t/plus (t/now) (t/days 30)) (c/to-long))]\n-    (jwt/sign {:user-id (:id user)}\n-              (private-key auth-conf)\n-              {:alg :rs256 :iat issued-at-time :exp exp})))\n+    (if user (try (jwt/sign {:user-id (:id user)}\n+                            (private-key auth-conf)\n+                            {:alg :rs256 :iat issued-at-time :exp exp})\n+                  (catch Exception _ (do (log/debug \"Sign refresh token failed\")\n+                                         nil)))\n+        (do (log/debug \"User credentials missing\") nil))))\n \n (defn make-token-pair! [session auth-conf user]\n   (let [issued-at-time (c/to-long (t/now))\n-        refresh-token (make-refresh-token issued-at-time auth-conf user)]\n-    (refresh-token/add! session {:refresh-token refresh-token\n-                                 :issued issued-at-time\n-                                 :user-id (:id user)})\n-    {:token-pair {:auth-token (make-auth-token user auth-conf)\n-                  :refresh-token refresh-token}}))\n+        refresh-token (make-refresh-token issued-at-time auth-conf user)","path":"src/kixi/heimdall/service.clj","position":40,"original_position":43,"commit_id":"882f12316e2912bf8f4b355478db8c68c3401195","original_commit_id":"e8d7776c640bbc4608dc6a88623e0fe5debabc86","user":{"login":"Eleonore9","id":2502761,"avatar_url":"https://avatars.githubusercontent.com/u/2502761?v=3","gravatar_id":"","url":"https://api.github.com/users/Eleonore9","html_url":"https://github.com/Eleonore9","followers_url":"https://api.github.com/users/Eleonore9/followers","following_url":"https://api.github.com/users/Eleonore9/following{/other_user}","gists_url":"https://api.github.com/users/Eleonore9/gists{/gist_id}","starred_url":"https://api.github.com/users/Eleonore9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Eleonore9/subscriptions","organizations_url":"https://api.github.com/users/Eleonore9/orgs","repos_url":"https://api.github.com/users/Eleonore9/repos","events_url":"https://api.github.com/users/Eleonore9/events{/privacy}","received_events_url":"https://api.github.com/users/Eleonore9/received_events","type":"User","site_admin":false},"body":"I'm not sure of what you mean here. \r\n`auth-token` and `refresh-token` could be `nil` in which case we also want `make-token-pair!` to return `nil` so that `create-auth-token` returns a 401.","created_at":"2016-08-31T15:14:44Z","updated_at":"2016-08-31T15:14:44Z","html_url":"https://github.com/MastodonC/kixi.heimdall/pull/10#discussion_r77006916","pull_request_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/MastodonC/kixi.heimdall/pulls/comments/77006916"},"html":{"href":"https://github.com/MastodonC/kixi.heimdall/pull/10#discussion_r77006916"},"pull_request":{"href":"https://api.github.com/repos/MastodonC/kixi.heimdall/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/MastodonC/kixi.heimdall/pulls/10","id":83432794,"html_url":"https://github.com/MastodonC/kixi.heimdall/pull/10","diff_url":"https://github.com/MastodonC/kixi.heimdall/pull/10.diff","patch_url":"https://github.com/MastodonC/kixi.heimdall/pull/10.patch","issue_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/issues/10","number":10,"state":"open","locked":false,"title":"(Un)sign fns calls in try block","user":{"login":"Eleonore9","id":2502761,"avatar_url":"https://avatars.githubusercontent.com/u/2502761?v=3","gravatar_id":"","url":"https://api.github.com/users/Eleonore9","html_url":"https://github.com/Eleonore9","followers_url":"https://api.github.com/users/Eleonore9/followers","following_url":"https://api.github.com/users/Eleonore9/following{/other_user}","gists_url":"https://api.github.com/users/Eleonore9/gists{/gist_id}","starred_url":"https://api.github.com/users/Eleonore9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Eleonore9/subscriptions","organizations_url":"https://api.github.com/users/Eleonore9/orgs","repos_url":"https://api.github.com/users/Eleonore9/repos","events_url":"https://api.github.com/users/Eleonore9/events{/privacy}","received_events_url":"https://api.github.com/users/Eleonore9/received_events","type":"User","site_admin":false},"body":"Try and prevent (un)signing steps from \"exploding\" or at least log a message when it does.","created_at":"2016-08-31T11:12:39Z","updated_at":"2016-08-31T15:14:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c44e6e19e614f9c0c49d5cb6677ee40fe76d3db2","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/pulls/10/commits","review_comments_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/pulls/10/comments","review_comment_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/issues/10/comments","statuses_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/statuses/882f12316e2912bf8f4b355478db8c68c3401195","head":{"label":"MastodonC:improve/sign-unsign-in-try-block","ref":"improve/sign-unsign-in-try-block","sha":"882f12316e2912bf8f4b355478db8c68c3401195","user":{"login":"MastodonC","id":2911834,"avatar_url":"https://avatars.githubusercontent.com/u/2911834?v=3","gravatar_id":"","url":"https://api.github.com/users/MastodonC","html_url":"https://github.com/MastodonC","followers_url":"https://api.github.com/users/MastodonC/followers","following_url":"https://api.github.com/users/MastodonC/following{/other_user}","gists_url":"https://api.github.com/users/MastodonC/gists{/gist_id}","starred_url":"https://api.github.com/users/MastodonC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MastodonC/subscriptions","organizations_url":"https://api.github.com/users/MastodonC/orgs","repos_url":"https://api.github.com/users/MastodonC/repos","events_url":"https://api.github.com/users/MastodonC/events{/privacy}","received_events_url":"https://api.github.com/users/MastodonC/received_events","type":"Organization","site_admin":false},"repo":{"id":65217657,"name":"kixi.heimdall","full_name":"MastodonC/kixi.heimdall","owner":{"login":"MastodonC","id":2911834,"avatar_url":"https://avatars.githubusercontent.com/u/2911834?v=3","gravatar_id":"","url":"https://api.github.com/users/MastodonC","html_url":"https://github.com/MastodonC","followers_url":"https://api.github.com/users/MastodonC/followers","following_url":"https://api.github.com/users/MastodonC/following{/other_user}","gists_url":"https://api.github.com/users/MastodonC/gists{/gist_id}","starred_url":"https://api.github.com/users/MastodonC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MastodonC/subscriptions","organizations_url":"https://api.github.com/users/MastodonC/orgs","repos_url":"https://api.github.com/users/MastodonC/repos","events_url":"https://api.github.com/users/MastodonC/events{/privacy}","received_events_url":"https://api.github.com/users/MastodonC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MastodonC/kixi.heimdall","description":"kixi.heimdall","fork":false,"url":"https://api.github.com/repos/MastodonC/kixi.heimdall","forks_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/forks","keys_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/teams","hooks_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/hooks","issue_events_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/issues/events{/number}","events_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/events","assignees_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/assignees{/user}","branches_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/branches{/branch}","tags_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/tags","blobs_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/git/refs{/sha}","trees_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/statuses/{sha}","languages_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/languages","stargazers_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/stargazers","contributors_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/contributors","subscribers_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/subscribers","subscription_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/subscription","commits_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/commits{/sha}","git_commits_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/git/commits{/sha}","comments_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/comments{/number}","issue_comment_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/issues/comments{/number}","contents_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/contents/{+path}","compare_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/merges","archive_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/downloads","issues_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/issues{/number}","pulls_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/pulls{/number}","milestones_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/milestones{/number}","notifications_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/labels{/name}","releases_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/releases{/id}","deployments_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/deployments","created_at":"2016-08-08T15:51:34Z","updated_at":"2016-08-08T15:52:46Z","pushed_at":"2016-08-31T14:52:57Z","git_url":"git://github.com/MastodonC/kixi.heimdall.git","ssh_url":"git@github.com:MastodonC/kixi.heimdall.git","clone_url":"https://github.com/MastodonC/kixi.heimdall.git","svn_url":"https://github.com/MastodonC/kixi.heimdall","homepage":null,"size":759,"stargazers_count":0,"watchers_count":0,"language":"Clojure","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"MastodonC:master","ref":"master","sha":"a0ad17faf67c5fefd6b82065d869f6c40250e287","user":{"login":"MastodonC","id":2911834,"avatar_url":"https://avatars.githubusercontent.com/u/2911834?v=3","gravatar_id":"","url":"https://api.github.com/users/MastodonC","html_url":"https://github.com/MastodonC","followers_url":"https://api.github.com/users/MastodonC/followers","following_url":"https://api.github.com/users/MastodonC/following{/other_user}","gists_url":"https://api.github.com/users/MastodonC/gists{/gist_id}","starred_url":"https://api.github.com/users/MastodonC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MastodonC/subscriptions","organizations_url":"https://api.github.com/users/MastodonC/orgs","repos_url":"https://api.github.com/users/MastodonC/repos","events_url":"https://api.github.com/users/MastodonC/events{/privacy}","received_events_url":"https://api.github.com/users/MastodonC/received_events","type":"Organization","site_admin":false},"repo":{"id":65217657,"name":"kixi.heimdall","full_name":"MastodonC/kixi.heimdall","owner":{"login":"MastodonC","id":2911834,"avatar_url":"https://avatars.githubusercontent.com/u/2911834?v=3","gravatar_id":"","url":"https://api.github.com/users/MastodonC","html_url":"https://github.com/MastodonC","followers_url":"https://api.github.com/users/MastodonC/followers","following_url":"https://api.github.com/users/MastodonC/following{/other_user}","gists_url":"https://api.github.com/users/MastodonC/gists{/gist_id}","starred_url":"https://api.github.com/users/MastodonC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MastodonC/subscriptions","organizations_url":"https://api.github.com/users/MastodonC/orgs","repos_url":"https://api.github.com/users/MastodonC/repos","events_url":"https://api.github.com/users/MastodonC/events{/privacy}","received_events_url":"https://api.github.com/users/MastodonC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MastodonC/kixi.heimdall","description":"kixi.heimdall","fork":false,"url":"https://api.github.com/repos/MastodonC/kixi.heimdall","forks_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/forks","keys_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/teams","hooks_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/hooks","issue_events_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/issues/events{/number}","events_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/events","assignees_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/assignees{/user}","branches_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/branches{/branch}","tags_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/tags","blobs_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/git/refs{/sha}","trees_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/statuses/{sha}","languages_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/languages","stargazers_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/stargazers","contributors_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/contributors","subscribers_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/subscribers","subscription_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/subscription","commits_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/commits{/sha}","git_commits_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/git/commits{/sha}","comments_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/comments{/number}","issue_comment_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/issues/comments{/number}","contents_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/contents/{+path}","compare_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/merges","archive_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/downloads","issues_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/issues{/number}","pulls_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/pulls{/number}","milestones_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/milestones{/number}","notifications_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/labels{/name}","releases_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/releases{/id}","deployments_url":"https://api.github.com/repos/MastodonC/kixi.heimdall/deployments","created_at":"2016-08-08T15:51:34Z","updated_at":"2016-08-08T15:52:46Z","pushed_at":"2016-08-31T14:52:57Z","git_url":"git://github.com/MastodonC/kixi.heimdall.git","ssh_url":"git@github.com:MastodonC/kixi.heimdall.git","clone_url":"https://github.com/MastodonC/kixi.heimdall.git","svn_url":"https://github.com/MastodonC/kixi.heimdall","homepage":null,"size":759,"stargazers_count":0,"watchers_count":0,"language":"Clojure","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MastodonC/kixi.heimdall/pulls/10"},"html":{"href":"https://github.com/MastodonC/kixi.heimdall/pull/10"},"issue":{"href":"https://api.github.com/repos/MastodonC/kixi.heimdall/issues/10"},"comments":{"href":"https://api.github.com/repos/MastodonC/kixi.heimdall/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/MastodonC/kixi.heimdall/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/MastodonC/kixi.heimdall/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MastodonC/kixi.heimdall/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/MastodonC/kixi.heimdall/statuses/882f12316e2912bf8f4b355478db8c68c3401195"}}}}
{"actor":{"display_login":"Eleonore9"}}