{"action":"created","issue":{"url":"https://api.github.com/repos/IBM-Swift/Kitura/issues/690","repository_url":"https://api.github.com/repos/IBM-Swift/Kitura","labels_url":"https://api.github.com/repos/IBM-Swift/Kitura/issues/690/labels{/name}","comments_url":"https://api.github.com/repos/IBM-Swift/Kitura/issues/690/comments","events_url":"https://api.github.com/repos/IBM-Swift/Kitura/issues/690/events","html_url":"https://github.com/IBM-Swift/Kitura/issues/690","id":171432978,"number":690,"title":"Credentials middleware should fail explicitly if session isn't available","user":{"login":"youming-lin","id":19825876,"avatar_url":"https://avatars.githubusercontent.com/u/19825876?v=3","gravatar_id":"","url":"https://api.github.com/users/youming-lin","html_url":"https://github.com/youming-lin","followers_url":"https://api.github.com/users/youming-lin/followers","following_url":"https://api.github.com/users/youming-lin/following{/other_user}","gists_url":"https://api.github.com/users/youming-lin/gists{/gist_id}","starred_url":"https://api.github.com/users/youming-lin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/youming-lin/subscriptions","organizations_url":"https://api.github.com/users/youming-lin/orgs","repos_url":"https://api.github.com/users/youming-lin/repos","events_url":"https://api.github.com/users/youming-lin/events{/privacy}","received_events_url":"https://api.github.com/users/youming-lin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/IBM-Swift/Kitura/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"youming-lin","id":19825876,"avatar_url":"https://avatars.githubusercontent.com/u/19825876?v=3","gravatar_id":"","url":"https://api.github.com/users/youming-lin","html_url":"https://github.com/youming-lin","followers_url":"https://api.github.com/users/youming-lin/followers","following_url":"https://api.github.com/users/youming-lin/following{/other_user}","gists_url":"https://api.github.com/users/youming-lin/gists{/gist_id}","starred_url":"https://api.github.com/users/youming-lin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/youming-lin/subscriptions","organizations_url":"https://api.github.com/users/youming-lin/orgs","repos_url":"https://api.github.com/users/youming-lin/repos","events_url":"https://api.github.com/users/youming-lin/events{/privacy}","received_events_url":"https://api.github.com/users/youming-lin/received_events","type":"User","site_admin":false},"assignees":[{"login":"youming-lin","id":19825876,"avatar_url":"https://avatars.githubusercontent.com/u/19825876?v=3","gravatar_id":"","url":"https://api.github.com/users/youming-lin","html_url":"https://github.com/youming-lin","followers_url":"https://api.github.com/users/youming-lin/followers","following_url":"https://api.github.com/users/youming-lin/following{/other_user}","gists_url":"https://api.github.com/users/youming-lin/gists{/gist_id}","starred_url":"https://api.github.com/users/youming-lin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/youming-lin/subscriptions","organizations_url":"https://api.github.com/users/youming-lin/orgs","repos_url":"https://api.github.com/users/youming-lin/repos","events_url":"https://api.github.com/users/youming-lin/events{/privacy}","received_events_url":"https://api.github.com/users/youming-lin/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/IBM-Swift/Kitura/milestones/23","html_url":"https://github.com/IBM-Swift/Kitura/milestones/1.0.2","labels_url":"https://api.github.com/repos/IBM-Swift/Kitura/milestones/23/labels","id":2049827,"number":23,"title":"1.0.2","description":"","creator":{"login":"ianpartridge","id":1423497,"avatar_url":"https://avatars.githubusercontent.com/u/1423497?v=3","gravatar_id":"","url":"https://api.github.com/users/ianpartridge","html_url":"https://github.com/ianpartridge","followers_url":"https://api.github.com/users/ianpartridge/followers","following_url":"https://api.github.com/users/ianpartridge/following{/other_user}","gists_url":"https://api.github.com/users/ianpartridge/gists{/gist_id}","starred_url":"https://api.github.com/users/ianpartridge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianpartridge/subscriptions","organizations_url":"https://api.github.com/users/ianpartridge/orgs","repos_url":"https://api.github.com/users/ianpartridge/repos","events_url":"https://api.github.com/users/ianpartridge/events{/privacy}","received_events_url":"https://api.github.com/users/ianpartridge/received_events","type":"User","site_admin":false},"open_issues":19,"closed_issues":2,"state":"open","created_at":"2016-10-05T14:49:15Z","updated_at":"2016-10-07T12:23:09Z","due_on":"2016-10-19T00:00:00Z","closed_at":null},"comments":5,"created_at":"2016-08-16T14:44:46Z","updated_at":"2016-10-09T08:33:46Z","closed_at":null,"body":"@youming-lin commented on [Mon Aug 15 2016](https://github.com/IBM-Swift/Kitura-Credentials/issues/15)\n\nCurrently, if session isn't configured and added to middlewares before credentials is used, authentication can fail silently (i.e., if web-based OAuth2 authentication, authentication callback can fail with a 404 Not Found error). We should explicitly throw(?) an error if session isn't available.\n\n"},"comment":{"url":"https://api.github.com/repos/IBM-Swift/Kitura/issues/comments/252472898","html_url":"https://github.com/IBM-Swift/Kitura/issues/690#issuecomment-252472898","issue_url":"https://api.github.com/repos/IBM-Swift/Kitura/issues/690","id":252472898,"user":{"login":"irar2","id":16818592,"avatar_url":"https://avatars.githubusercontent.com/u/16818592?v=3","gravatar_id":"","url":"https://api.github.com/users/irar2","html_url":"https://github.com/irar2","followers_url":"https://api.github.com/users/irar2/followers","following_url":"https://api.github.com/users/irar2/following{/other_user}","gists_url":"https://api.github.com/users/irar2/gists{/gist_id}","starred_url":"https://api.github.com/users/irar2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/irar2/subscriptions","organizations_url":"https://api.github.com/users/irar2/orgs","repos_url":"https://api.github.com/users/irar2/repos","events_url":"https://api.github.com/users/irar2/events{/privacy}","received_events_url":"https://api.github.com/users/irar2/received_events","type":"User","site_admin":false},"created_at":"2016-10-09T08:33:46Z","updated_at":"2016-10-09T08:33:46Z","body":"@youming-lin I finally understand the problem: you simply called Credentials.authenticate() without going through handle() first. This was not our intention, the scenario should be: request for protected path is checked in handle() and redirected if necessary to login page, and authenticate() called from there. All this with session, otherwise it makes no sense to log in if there is no state that remembers that the user is logged in.\r\n\r\nSo, the proposed solution is to add an error message as in my previous comment (and also add this to the response itself). And add a similar treatment in case  there is no session in authenticate(), i.e. set response.error to indicate that the server was not configured properly."}}
{"actor":{"display_login":"irar2"}}