{"action":"created","comment":{"url":"https://api.github.com/repos/EiffelWebFramework/ROC/pulls/comments/47642975","id":47642975,"diff_hunk":"@@ -0,0 +1,351 @@\n+note\n+\tdescription: \"[\n+\t\t\tThis module allows the use Session Based Authentication using Cookies to restrict access\n+\t\t\tby looking up users in the given providers.\n+\t\t]\"\n+\tdate: \"$Date$\"\n+\trevision: \"$Revision$\"\n+\n+class\n+\tCMS_SESSION_AUTH_MODULE\n+\n+inherit\n+\tCMS_MODULE\n+\t\trename\n+\t\t\tmodule_api as user_session_api\n+\t\tredefine\n+\t\t\tfilters,\n+\t\t\tsetup_hooks,\n+\t\t\tinitialize,\n+\t\t\tinstall,\n+\t\t\tuser_session_api\n+\t\tend\n+\n+\n+\tCMS_HOOK_AUTO_REGISTER\n+\n+\tCMS_HOOK_BLOCK\n+\n+\tCMS_HOOK_MENU_SYSTEM_ALTER\n+\n+\tCMS_HOOK_VALUE_TABLE_ALTER\n+\n+\tSHARED_LOGGER\n+\n+\tCMS_REQUEST_UTIL\n+\n+create\n+\tmake\n+\n+feature {NONE} -- Initialization\n+\n+\tmake\n+\t\tdo\n+\t\t\tversion := \"1.0\"\n+\t\t\tdescription := \"Service to manage cookie based authentication\"\n+\t\t\tpackage := \"authentication\"\n+\t\t\tadd_dependency ({CMS_AUTHENTICATION_MODULE})\n+\t\tend\n+\n+feature -- Access\n+\n+\tname: STRING = \"session_auth\"\n+\n+\n+\n+feature {CMS_API} -- Module Initialization\t\t\t\n+\n+\tinitialize (a_api: CMS_API)\n+\t\t\t-- <Precursor>\n+\t\tlocal\n+\t\t\tl_session_auth_api: like user_session_api\n+\t\t\tl_user_auth_storage: CMS_SESSION_AUTH_STORAGE_I\n+\t\tdo\n+\t\t\tPrecursor (a_api)\n+\n+\t\t\t\t\t-- Storage initialization\n+\t\t\tif attached a_api.storage.as_sql_storage as l_storage_sql then\n+\t\t\t\tcreate {CMS_SESSION_AUTH_STORAGE_SQL} l_user_auth_storage.make (l_storage_sql)\n+\t\t\telse\n+\t\t\t\t\t-- FIXME: in case of NULL storage, should Current be disabled?\n+\t\t\t\tcreate {CMS_SESSION_AUTH_STORAGE_NULL} l_user_auth_storage\n+\t\t\tend\n+\n+\t\t\t\t-- API initialization\n+\t\t\tcreate l_session_auth_api.make_with_storage (a_api, l_user_auth_storage)\n+\t\t\tuser_session_api := l_session_auth_api\n+\t\tensure then\n+\t\t\tsession_auth_api_set: user_session_api /= Void\n+\t\tend\n+\n+feature {CMS_API} -- Module management\n+\n+\tinstall (api: CMS_API)\n+\t\tlocal\n+\t\t\tl_consumers: LIST [STRING]\n+\t\tdo\n+\t\t\t\t-- Schema\n+\t\t\tif attached api.storage.as_sql_storage as l_sql_storage then\n+\t\t\t\tif not l_sql_storage.sql_table_exists (\"session_auth\") then\n+\t\t\t\t\t--| Schema\n+\t\t\t\t\tl_sql_storage.sql_execute_file_script (api.module_resource_location (Current, (create {PATH}.make_from_string (\"scripts\")).extended (\"session_auth_table.sql\")), Void)\n+\n+\t\t\t\t\tif l_sql_storage.has_error then\n+\t\t\t\t\t\tapi.logger.put_error (\"Could not initialize database for blog module\", generating_type)\n+\t\t\t\t\tend\n+\t\t\t\tend\n+\t\t\t\tl_sql_storage.sql_finalize\n+\t\t\t\tPrecursor {CMS_MODULE}(api)\n+\t\t\tend\n+\t\tend\n+\n+feature {CMS_API} -- Access: API\n+\n+\tuser_session_api: detachable CMS_SESSION_API\n+\t\t\t-- <Precursor>\t\t\n+\n+feature -- Access: router\n+\n+\tsetup_router (a_router: WSF_ROUTER; a_api: CMS_API)\n+\t\t\t-- <Precursor>\n+\t\tdo\n+\t\t\ta_router.handle (\"/account/roc-session-login\", create {WSF_URI_AGENT_HANDLER}.make (agent handle_login(a_api, ?, ?)), a_router.methods_head_get)\n+\t\t\ta_router.handle (\"/account/roc-session-logout\", create {WSF_URI_AGENT_HANDLER}.make (agent handle_logout (a_api, ?, ?)), a_router.methods_get_post)\n+\t\t\ta_router.handle (\"/account/login-with-session\", create {WSF_URI_TEMPLATE_AGENT_HANDLER}.make (agent handle_login_with_session (a_api,user_session_api, ?, ?)), a_router.methods_get_post)\n+\t\tend\n+\n+feature -- Access: filter\n+\n+\tfilters (a_api: CMS_API): detachable LIST [WSF_FILTER]\n+\t\t\t-- Possibly list of Filter's module.\n+\t\tdo\n+\t\t\tcreate {ARRAYED_LIST [WSF_FILTER]} Result.make (1)\n+\t\t\tif attached user_session_api as l_session_api then\n+\t\t\t\tResult.extend (create {CMS_SESSION_AUTH_FILTER}.make (a_api, l_session_api))\n+\t\t\tend\n+\t\tend\n+\n+feature {NONE} -- Implementation: routes\n+\n+\thandle_login (api: CMS_API; req: WSF_REQUEST; res: WSF_RESPONSE)\n+\t\tlocal\n+\t\t\tr: CMS_RESPONSE\n+\t\tdo\n+\t\t\tcreate {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)","path":"modules/session_auth/cms_session_auth_module.e","position":134,"original_position":134,"commit_id":"c25590c9cdf242c171318bdb68afc03c155656c5","original_commit_id":"c25590c9cdf242c171318bdb68afc03c155656c5","user":{"login":"jvelilla","id":23418,"avatar_url":"https://avatars.githubusercontent.com/u/23418?v=3","gravatar_id":"","url":"https://api.github.com/users/jvelilla","html_url":"https://github.com/jvelilla","followers_url":"https://api.github.com/users/jvelilla/followers","following_url":"https://api.github.com/users/jvelilla/following{/other_user}","gists_url":"https://api.github.com/users/jvelilla/gists{/gist_id}","starred_url":"https://api.github.com/users/jvelilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvelilla/subscriptions","organizations_url":"https://api.github.com/users/jvelilla/orgs","repos_url":"https://api.github.com/users/jvelilla/repos","events_url":"https://api.github.com/users/jvelilla/events{/privacy}","received_events_url":"https://api.github.com/users/jvelilla/received_events","type":"User","site_admin":false},"body":"It relies on \"block\" login and it has tabs so not sure where we should add the message.\r\n\r\n","created_at":"2015-12-15T14:39:52Z","updated_at":"2015-12-15T14:39:52Z","html_url":"https://github.com/EiffelWebFramework/ROC/pull/47#discussion_r47642975","pull_request_url":"https://api.github.com/repos/EiffelWebFramework/ROC/pulls/47","_links":{"self":{"href":"https://api.github.com/repos/EiffelWebFramework/ROC/pulls/comments/47642975"},"html":{"href":"https://github.com/EiffelWebFramework/ROC/pull/47#discussion_r47642975"},"pull_request":{"href":"https://api.github.com/repos/EiffelWebFramework/ROC/pulls/47"}}},"pull_request":{"url":"https://api.github.com/repos/EiffelWebFramework/ROC/pulls/47","id":53510038,"html_url":"https://github.com/EiffelWebFramework/ROC/pull/47","diff_url":"https://github.com/EiffelWebFramework/ROC/pull/47.diff","patch_url":"https://github.com/EiffelWebFramework/ROC/pull/47.patch","issue_url":"https://api.github.com/repos/EiffelWebFramework/ROC/issues/47","number":47,"state":"open","locked":false,"title":"Added Module Session Authentication with Cookies.","user":{"login":"jvelilla","id":23418,"avatar_url":"https://avatars.githubusercontent.com/u/23418?v=3","gravatar_id":"","url":"https://api.github.com/users/jvelilla","html_url":"https://github.com/jvelilla","followers_url":"https://api.github.com/users/jvelilla/followers","following_url":"https://api.github.com/users/jvelilla/following{/other_user}","gists_url":"https://api.github.com/users/jvelilla/gists{/gist_id}","starred_url":"https://api.github.com/users/jvelilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvelilla/subscriptions","organizations_url":"https://api.github.com/users/jvelilla/orgs","repos_url":"https://api.github.com/users/jvelilla/repos","events_url":"https://api.github.com/users/jvelilla/events{/privacy}","received_events_url":"https://api.github.com/users/jvelilla/received_events","type":"User","site_admin":false},"body":"Updated Demo example with the Module Session (Authentication with Cookies)\r\nFixed little issue with SQL query in OpenID module.","created_at":"2015-12-13T21:20:26Z","updated_at":"2015-12-15T14:39:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6253ee9a84bccd4717fe7ca105f4cc6c23977ad7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/EiffelWebFramework/ROC/pulls/47/commits","review_comments_url":"https://api.github.com/repos/EiffelWebFramework/ROC/pulls/47/comments","review_comment_url":"https://api.github.com/repos/EiffelWebFramework/ROC/pulls/comments{/number}","comments_url":"https://api.github.com/repos/EiffelWebFramework/ROC/issues/47/comments","statuses_url":"https://api.github.com/repos/EiffelWebFramework/ROC/statuses/c25590c9cdf242c171318bdb68afc03c155656c5","head":{"label":"jvelilla:roc_login_session","ref":"roc_login_session","sha":"c25590c9cdf242c171318bdb68afc03c155656c5","user":{"login":"jvelilla","id":23418,"avatar_url":"https://avatars.githubusercontent.com/u/23418?v=3","gravatar_id":"","url":"https://api.github.com/users/jvelilla","html_url":"https://github.com/jvelilla","followers_url":"https://api.github.com/users/jvelilla/followers","following_url":"https://api.github.com/users/jvelilla/following{/other_user}","gists_url":"https://api.github.com/users/jvelilla/gists{/gist_id}","starred_url":"https://api.github.com/users/jvelilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvelilla/subscriptions","organizations_url":"https://api.github.com/users/jvelilla/orgs","repos_url":"https://api.github.com/users/jvelilla/repos","events_url":"https://api.github.com/users/jvelilla/events{/privacy}","received_events_url":"https://api.github.com/users/jvelilla/received_events","type":"User","site_admin":false},"repo":{"id":24698278,"name":"ROC","full_name":"jvelilla/ROC","owner":{"login":"jvelilla","id":23418,"avatar_url":"https://avatars.githubusercontent.com/u/23418?v=3","gravatar_id":"","url":"https://api.github.com/users/jvelilla","html_url":"https://github.com/jvelilla","followers_url":"https://api.github.com/users/jvelilla/followers","following_url":"https://api.github.com/users/jvelilla/following{/other_user}","gists_url":"https://api.github.com/users/jvelilla/gists{/gist_id}","starred_url":"https://api.github.com/users/jvelilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvelilla/subscriptions","organizations_url":"https://api.github.com/users/jvelilla/orgs","repos_url":"https://api.github.com/users/jvelilla/repos","events_url":"https://api.github.com/users/jvelilla/events{/privacy}","received_events_url":"https://api.github.com/users/jvelilla/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jvelilla/ROC","description":"Rest on CMS ","fork":true,"url":"https://api.github.com/repos/jvelilla/ROC","forks_url":"https://api.github.com/repos/jvelilla/ROC/forks","keys_url":"https://api.github.com/repos/jvelilla/ROC/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jvelilla/ROC/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jvelilla/ROC/teams","hooks_url":"https://api.github.com/repos/jvelilla/ROC/hooks","issue_events_url":"https://api.github.com/repos/jvelilla/ROC/issues/events{/number}","events_url":"https://api.github.com/repos/jvelilla/ROC/events","assignees_url":"https://api.github.com/repos/jvelilla/ROC/assignees{/user}","branches_url":"https://api.github.com/repos/jvelilla/ROC/branches{/branch}","tags_url":"https://api.github.com/repos/jvelilla/ROC/tags","blobs_url":"https://api.github.com/repos/jvelilla/ROC/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jvelilla/ROC/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jvelilla/ROC/git/refs{/sha}","trees_url":"https://api.github.com/repos/jvelilla/ROC/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jvelilla/ROC/statuses/{sha}","languages_url":"https://api.github.com/repos/jvelilla/ROC/languages","stargazers_url":"https://api.github.com/repos/jvelilla/ROC/stargazers","contributors_url":"https://api.github.com/repos/jvelilla/ROC/contributors","subscribers_url":"https://api.github.com/repos/jvelilla/ROC/subscribers","subscription_url":"https://api.github.com/repos/jvelilla/ROC/subscription","commits_url":"https://api.github.com/repos/jvelilla/ROC/commits{/sha}","git_commits_url":"https://api.github.com/repos/jvelilla/ROC/git/commits{/sha}","comments_url":"https://api.github.com/repos/jvelilla/ROC/comments{/number}","issue_comment_url":"https://api.github.com/repos/jvelilla/ROC/issues/comments{/number}","contents_url":"https://api.github.com/repos/jvelilla/ROC/contents/{+path}","compare_url":"https://api.github.com/repos/jvelilla/ROC/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jvelilla/ROC/merges","archive_url":"https://api.github.com/repos/jvelilla/ROC/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jvelilla/ROC/downloads","issues_url":"https://api.github.com/repos/jvelilla/ROC/issues{/number}","pulls_url":"https://api.github.com/repos/jvelilla/ROC/pulls{/number}","milestones_url":"https://api.github.com/repos/jvelilla/ROC/milestones{/number}","notifications_url":"https://api.github.com/repos/jvelilla/ROC/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jvelilla/ROC/labels{/name}","releases_url":"https://api.github.com/repos/jvelilla/ROC/releases{/id}","created_at":"2014-10-01T22:47:50Z","updated_at":"2015-10-12T19:56:16Z","pushed_at":"2015-12-13T21:19:40Z","git_url":"git://github.com/jvelilla/ROC.git","ssh_url":"git@github.com:jvelilla/ROC.git","clone_url":"https://github.com/jvelilla/ROC.git","svn_url":"https://github.com/jvelilla/ROC","homepage":null,"size":5080,"stargazers_count":0,"watchers_count":0,"language":"Eiffel","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"EiffelWebFramework:master","ref":"master","sha":"23d266497b245f0d0659539a64ad6745405e1146","user":{"login":"EiffelWebFramework","id":1617859,"avatar_url":"https://avatars.githubusercontent.com/u/1617859?v=3","gravatar_id":"","url":"https://api.github.com/users/EiffelWebFramework","html_url":"https://github.com/EiffelWebFramework","followers_url":"https://api.github.com/users/EiffelWebFramework/followers","following_url":"https://api.github.com/users/EiffelWebFramework/following{/other_user}","gists_url":"https://api.github.com/users/EiffelWebFramework/gists{/gist_id}","starred_url":"https://api.github.com/users/EiffelWebFramework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EiffelWebFramework/subscriptions","organizations_url":"https://api.github.com/users/EiffelWebFramework/orgs","repos_url":"https://api.github.com/users/EiffelWebFramework/repos","events_url":"https://api.github.com/users/EiffelWebFramework/events{/privacy}","received_events_url":"https://api.github.com/users/EiffelWebFramework/received_events","type":"Organization","site_admin":false},"repo":{"id":24066295,"name":"ROC","full_name":"EiffelWebFramework/ROC","owner":{"login":"EiffelWebFramework","id":1617859,"avatar_url":"https://avatars.githubusercontent.com/u/1617859?v=3","gravatar_id":"","url":"https://api.github.com/users/EiffelWebFramework","html_url":"https://github.com/EiffelWebFramework","followers_url":"https://api.github.com/users/EiffelWebFramework/followers","following_url":"https://api.github.com/users/EiffelWebFramework/following{/other_user}","gists_url":"https://api.github.com/users/EiffelWebFramework/gists{/gist_id}","starred_url":"https://api.github.com/users/EiffelWebFramework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EiffelWebFramework/subscriptions","organizations_url":"https://api.github.com/users/EiffelWebFramework/orgs","repos_url":"https://api.github.com/users/EiffelWebFramework/repos","events_url":"https://api.github.com/users/EiffelWebFramework/events{/privacy}","received_events_url":"https://api.github.com/users/EiffelWebFramework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/EiffelWebFramework/ROC","description":"Rest on CMS ","fork":false,"url":"https://api.github.com/repos/EiffelWebFramework/ROC","forks_url":"https://api.github.com/repos/EiffelWebFramework/ROC/forks","keys_url":"https://api.github.com/repos/EiffelWebFramework/ROC/keys{/key_id}","collaborators_url":"https://api.github.com/repos/EiffelWebFramework/ROC/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/EiffelWebFramework/ROC/teams","hooks_url":"https://api.github.com/repos/EiffelWebFramework/ROC/hooks","issue_events_url":"https://api.github.com/repos/EiffelWebFramework/ROC/issues/events{/number}","events_url":"https://api.github.com/repos/EiffelWebFramework/ROC/events","assignees_url":"https://api.github.com/repos/EiffelWebFramework/ROC/assignees{/user}","branches_url":"https://api.github.com/repos/EiffelWebFramework/ROC/branches{/branch}","tags_url":"https://api.github.com/repos/EiffelWebFramework/ROC/tags","blobs_url":"https://api.github.com/repos/EiffelWebFramework/ROC/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/EiffelWebFramework/ROC/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/EiffelWebFramework/ROC/git/refs{/sha}","trees_url":"https://api.github.com/repos/EiffelWebFramework/ROC/git/trees{/sha}","statuses_url":"https://api.github.com/repos/EiffelWebFramework/ROC/statuses/{sha}","languages_url":"https://api.github.com/repos/EiffelWebFramework/ROC/languages","stargazers_url":"https://api.github.com/repos/EiffelWebFramework/ROC/stargazers","contributors_url":"https://api.github.com/repos/EiffelWebFramework/ROC/contributors","subscribers_url":"https://api.github.com/repos/EiffelWebFramework/ROC/subscribers","subscription_url":"https://api.github.com/repos/EiffelWebFramework/ROC/subscription","commits_url":"https://api.github.com/repos/EiffelWebFramework/ROC/commits{/sha}","git_commits_url":"https://api.github.com/repos/EiffelWebFramework/ROC/git/commits{/sha}","comments_url":"https://api.github.com/repos/EiffelWebFramework/ROC/comments{/number}","issue_comment_url":"https://api.github.com/repos/EiffelWebFramework/ROC/issues/comments{/number}","contents_url":"https://api.github.com/repos/EiffelWebFramework/ROC/contents/{+path}","compare_url":"https://api.github.com/repos/EiffelWebFramework/ROC/compare/{base}...{head}","merges_url":"https://api.github.com/repos/EiffelWebFramework/ROC/merges","archive_url":"https://api.github.com/repos/EiffelWebFramework/ROC/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/EiffelWebFramework/ROC/downloads","issues_url":"https://api.github.com/repos/EiffelWebFramework/ROC/issues{/number}","pulls_url":"https://api.github.com/repos/EiffelWebFramework/ROC/pulls{/number}","milestones_url":"https://api.github.com/repos/EiffelWebFramework/ROC/milestones{/number}","notifications_url":"https://api.github.com/repos/EiffelWebFramework/ROC/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/EiffelWebFramework/ROC/labels{/name}","releases_url":"https://api.github.com/repos/EiffelWebFramework/ROC/releases{/id}","created_at":"2014-09-15T17:38:02Z","updated_at":"2015-05-04T21:17:20Z","pushed_at":"2015-12-13T21:20:26Z","git_url":"git://github.com/EiffelWebFramework/ROC.git","ssh_url":"git@github.com:EiffelWebFramework/ROC.git","clone_url":"https://github.com/EiffelWebFramework/ROC.git","svn_url":"https://github.com/EiffelWebFramework/ROC","homepage":null,"size":5114,"stargazers_count":0,"watchers_count":0,"language":"Eiffel","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":2,"forks":4,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/EiffelWebFramework/ROC/pulls/47"},"html":{"href":"https://github.com/EiffelWebFramework/ROC/pull/47"},"issue":{"href":"https://api.github.com/repos/EiffelWebFramework/ROC/issues/47"},"comments":{"href":"https://api.github.com/repos/EiffelWebFramework/ROC/issues/47/comments"},"review_comments":{"href":"https://api.github.com/repos/EiffelWebFramework/ROC/pulls/47/comments"},"review_comment":{"href":"https://api.github.com/repos/EiffelWebFramework/ROC/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/EiffelWebFramework/ROC/pulls/47/commits"},"statuses":{"href":"https://api.github.com/repos/EiffelWebFramework/ROC/statuses/c25590c9cdf242c171318bdb68afc03c155656c5"}}}}