{"action":"created","comment":{"url":"https://api.github.com/repos/onelogin/ruby-saml/pulls/comments/27405934","id":27405934,"diff_hunk":"@@ -50,15 +85,204 @@ def issuer\n         end\n       end\n \n-      private\n+      # @return [Time|nil] Gets the NotOnOrAfter Attribute value if exists.\n+      #\n+      def not_on_or_after\n+        @not_on_or_after ||= begin\n+          node = REXML::XPath.first(document, \"/p:LogoutRequest\", { \"p\" => PROTOCOL} )\n+          if node && node.attributes[\"NotOnOrAfter\"]\n+            Time.parse(node.attributes[\"NotOnOrAfter\"])\n+          else\n+            nil\n+          end\n+        end\n+      end\n+\n+      # @return [Array] Gets the SessionIndex if exists (Supported multiple values). Empty Array if none found \n+      #\n+      def session_indexes\n+        session_index = []\n+        nodes = REXML::XPath.match(document, \"/p:LogoutRequest/p:SessionIndex\", { \"p\" => PROTOCOL} )\n \n-      def validate(soft = true)\n-        valid_saml?(document, soft)  && validate_request_state(soft)\n+        if nodes\n+          nodes.each { |node|\n+            session_index << node.text\n+          }\n+        end\n+        session_index\n       end\n \n-      def validate_request_state(soft = true)\n-        if request.empty?\n-          return soft ? false : validation_error(\"Blank request\")\n+      private\n+\n+        # Gets the expected current_url\n+        # (Right now we read this url from the Sinle Logout Service of the Settings)\n+        # TODO: Calculate the real current_url and use it.\n+        # @return [String] The current url\n+        #\n+        def current_url\n+          @current_url ||= begin","path":"lib/onelogin/ruby-saml/slo_logoutrequest.rb","position":132,"original_position":132,"commit_id":"42a7bbd04b730bf248e33591aa0139da2098b4d5","original_commit_id":"42a7bbd04b730bf248e33591aa0139da2098b4d5","user":{"login":"phlipper","id":984,"avatar_url":"https://avatars.githubusercontent.com/u/984?v=3","gravatar_id":"","url":"https://api.github.com/users/phlipper","html_url":"https://github.com/phlipper","followers_url":"https://api.github.com/users/phlipper/followers","following_url":"https://api.github.com/users/phlipper/following{/other_user}","gists_url":"https://api.github.com/users/phlipper/gists{/gist_id}","starred_url":"https://api.github.com/users/phlipper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phlipper/subscriptions","organizations_url":"https://api.github.com/users/phlipper/orgs","repos_url":"https://api.github.com/users/phlipper/repos","events_url":"https://api.github.com/users/phlipper/events{/privacy}","received_events_url":"https://api.github.com/users/phlipper/received_events","type":"User","site_admin":false},"body":"Memoization not needed here.","created_at":"2015-03-30T16:26:17Z","updated_at":"2015-03-30T16:26:17Z","html_url":"https://github.com/onelogin/ruby-saml/pull/197#discussion_r27405934","pull_request_url":"https://api.github.com/repos/onelogin/ruby-saml/pulls/197","_links":{"self":{"href":"https://api.github.com/repos/onelogin/ruby-saml/pulls/comments/27405934"},"html":{"href":"https://github.com/onelogin/ruby-saml/pull/197#discussion_r27405934"},"pull_request":{"href":"https://api.github.com/repos/onelogin/ruby-saml/pulls/197"}}},"pull_request":{"url":"https://api.github.com/repos/onelogin/ruby-saml/pulls/197","id":30411741,"html_url":"https://github.com/onelogin/ruby-saml/pull/197","diff_url":"https://github.com/onelogin/ruby-saml/pull/197.diff","patch_url":"https://github.com/onelogin/ruby-saml/pull/197.patch","issue_url":"https://api.github.com/repos/onelogin/ruby-saml/issues/197","number":197,"state":"open","locked":false,"title":"Add SAML Response, Logout Request and Logout Response validations. Add also tests and documentation","user":{"login":"pitbulk","id":600897,"avatar_url":"https://avatars.githubusercontent.com/u/600897?v=3","gravatar_id":"","url":"https://api.github.com/users/pitbulk","html_url":"https://github.com/pitbulk","followers_url":"https://api.github.com/users/pitbulk/followers","following_url":"https://api.github.com/users/pitbulk/following{/other_user}","gists_url":"https://api.github.com/users/pitbulk/gists{/gist_id}","starred_url":"https://api.github.com/users/pitbulk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pitbulk/subscriptions","organizations_url":"https://api.github.com/users/pitbulk/orgs","repos_url":"https://api.github.com/users/pitbulk/repos","events_url":"https://api.github.com/users/pitbulk/events{/privacy}","received_events_url":"https://api.github.com/users/pitbulk/received_events","type":"User","site_admin":false},"body":"This PR is a meta-PR:\r\n* Add SAML Response, Logout Request and Logout Response validations. (based on this old PR: https://github.com/onelogin/ruby-saml/pull/115)\r\n* Add tests (high coverage, use of Minitest)\r\n* Add HTTP-Redirect Binding Validation Sign (https://github.com/onelogin/ruby-saml/commit/42a7bbd04b730bf248e33591aa0139da2098b4d5)\r\n* Add documentation to the README (https://github.com/onelogin/ruby-saml/issues/187, https://github.com/onelogin/ruby-saml/issues/186) and in the code (YARD style)\r\n* Fix XMLSecurity class: (SHA1 vs RSA_SHA1 issue)\r\n* Ensure IdP certificate is formatted properly (Related to https://github.com/onelogin/ruby-saml/pull/176)\r\n","created_at":"2015-03-03T20:56:38Z","updated_at":"2015-03-30T16:26:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e0feebc9115385e23cddb0fcee79c30433e65259","assignee":{"login":"pitbulk","id":600897,"avatar_url":"https://avatars.githubusercontent.com/u/600897?v=3","gravatar_id":"","url":"https://api.github.com/users/pitbulk","html_url":"https://github.com/pitbulk","followers_url":"https://api.github.com/users/pitbulk/followers","following_url":"https://api.github.com/users/pitbulk/following{/other_user}","gists_url":"https://api.github.com/users/pitbulk/gists{/gist_id}","starred_url":"https://api.github.com/users/pitbulk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pitbulk/subscriptions","organizations_url":"https://api.github.com/users/pitbulk/orgs","repos_url":"https://api.github.com/users/pitbulk/repos","events_url":"https://api.github.com/users/pitbulk/events{/privacy}","received_events_url":"https://api.github.com/users/pitbulk/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/onelogin/ruby-saml/pulls/197/commits","review_comments_url":"https://api.github.com/repos/onelogin/ruby-saml/pulls/197/comments","review_comment_url":"https://api.github.com/repos/onelogin/ruby-saml/pulls/comments{/number}","comments_url":"https://api.github.com/repos/onelogin/ruby-saml/issues/197/comments","statuses_url":"https://api.github.com/repos/onelogin/ruby-saml/statuses/42a7bbd04b730bf248e33591aa0139da2098b4d5","head":{"label":"onelogin:response_validations","ref":"response_validations","sha":"42a7bbd04b730bf248e33591aa0139da2098b4d5","user":{"login":"onelogin","id":263373,"avatar_url":"https://avatars.githubusercontent.com/u/263373?v=3","gravatar_id":"","url":"https://api.github.com/users/onelogin","html_url":"https://github.com/onelogin","followers_url":"https://api.github.com/users/onelogin/followers","following_url":"https://api.github.com/users/onelogin/following{/other_user}","gists_url":"https://api.github.com/users/onelogin/gists{/gist_id}","starred_url":"https://api.github.com/users/onelogin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onelogin/subscriptions","organizations_url":"https://api.github.com/users/onelogin/orgs","repos_url":"https://api.github.com/users/onelogin/repos","events_url":"https://api.github.com/users/onelogin/events{/privacy}","received_events_url":"https://api.github.com/users/onelogin/received_events","type":"Organization","site_admin":false},"repo":{"id":644899,"name":"ruby-saml","full_name":"onelogin/ruby-saml","owner":{"login":"onelogin","id":263373,"avatar_url":"https://avatars.githubusercontent.com/u/263373?v=3","gravatar_id":"","url":"https://api.github.com/users/onelogin","html_url":"https://github.com/onelogin","followers_url":"https://api.github.com/users/onelogin/followers","following_url":"https://api.github.com/users/onelogin/following{/other_user}","gists_url":"https://api.github.com/users/onelogin/gists{/gist_id}","starred_url":"https://api.github.com/users/onelogin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onelogin/subscriptions","organizations_url":"https://api.github.com/users/onelogin/orgs","repos_url":"https://api.github.com/users/onelogin/repos","events_url":"https://api.github.com/users/onelogin/events{/privacy}","received_events_url":"https://api.github.com/users/onelogin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/onelogin/ruby-saml","description":"SAML SSO for Ruby","fork":false,"url":"https://api.github.com/repos/onelogin/ruby-saml","forks_url":"https://api.github.com/repos/onelogin/ruby-saml/forks","keys_url":"https://api.github.com/repos/onelogin/ruby-saml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/onelogin/ruby-saml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/onelogin/ruby-saml/teams","hooks_url":"https://api.github.com/repos/onelogin/ruby-saml/hooks","issue_events_url":"https://api.github.com/repos/onelogin/ruby-saml/issues/events{/number}","events_url":"https://api.github.com/repos/onelogin/ruby-saml/events","assignees_url":"https://api.github.com/repos/onelogin/ruby-saml/assignees{/user}","branches_url":"https://api.github.com/repos/onelogin/ruby-saml/branches{/branch}","tags_url":"https://api.github.com/repos/onelogin/ruby-saml/tags","blobs_url":"https://api.github.com/repos/onelogin/ruby-saml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/onelogin/ruby-saml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/onelogin/ruby-saml/git/refs{/sha}","trees_url":"https://api.github.com/repos/onelogin/ruby-saml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/onelogin/ruby-saml/statuses/{sha}","languages_url":"https://api.github.com/repos/onelogin/ruby-saml/languages","stargazers_url":"https://api.github.com/repos/onelogin/ruby-saml/stargazers","contributors_url":"https://api.github.com/repos/onelogin/ruby-saml/contributors","subscribers_url":"https://api.github.com/repos/onelogin/ruby-saml/subscribers","subscription_url":"https://api.github.com/repos/onelogin/ruby-saml/subscription","commits_url":"https://api.github.com/repos/onelogin/ruby-saml/commits{/sha}","git_commits_url":"https://api.github.com/repos/onelogin/ruby-saml/git/commits{/sha}","comments_url":"https://api.github.com/repos/onelogin/ruby-saml/comments{/number}","issue_comment_url":"https://api.github.com/repos/onelogin/ruby-saml/issues/comments{/number}","contents_url":"https://api.github.com/repos/onelogin/ruby-saml/contents/{+path}","compare_url":"https://api.github.com/repos/onelogin/ruby-saml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/onelogin/ruby-saml/merges","archive_url":"https://api.github.com/repos/onelogin/ruby-saml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/onelogin/ruby-saml/downloads","issues_url":"https://api.github.com/repos/onelogin/ruby-saml/issues{/number}","pulls_url":"https://api.github.com/repos/onelogin/ruby-saml/pulls{/number}","milestones_url":"https://api.github.com/repos/onelogin/ruby-saml/milestones{/number}","notifications_url":"https://api.github.com/repos/onelogin/ruby-saml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/onelogin/ruby-saml/labels{/name}","releases_url":"https://api.github.com/repos/onelogin/ruby-saml/releases{/id}","created_at":"2010-05-03T18:39:04Z","updated_at":"2015-03-29T21:56:18Z","pushed_at":"2015-03-29T00:51:26Z","git_url":"git://github.com/onelogin/ruby-saml.git","ssh_url":"git@github.com:onelogin/ruby-saml.git","clone_url":"https://github.com/onelogin/ruby-saml.git","svn_url":"https://github.com/onelogin/ruby-saml","homepage":"http://support.onelogin.com/entries/165434-saml-toolkit-for-ruby-on-rails","size":3526,"stargazers_count":296,"watchers_count":296,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":253,"mirror_url":null,"open_issues_count":16,"forks":253,"open_issues":16,"watchers":296,"default_branch":"master"}},"base":{"label":"onelogin:master","ref":"master","sha":"a31b3e16adede1e525b55a633125cf2825c43b6e","user":{"login":"onelogin","id":263373,"avatar_url":"https://avatars.githubusercontent.com/u/263373?v=3","gravatar_id":"","url":"https://api.github.com/users/onelogin","html_url":"https://github.com/onelogin","followers_url":"https://api.github.com/users/onelogin/followers","following_url":"https://api.github.com/users/onelogin/following{/other_user}","gists_url":"https://api.github.com/users/onelogin/gists{/gist_id}","starred_url":"https://api.github.com/users/onelogin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onelogin/subscriptions","organizations_url":"https://api.github.com/users/onelogin/orgs","repos_url":"https://api.github.com/users/onelogin/repos","events_url":"https://api.github.com/users/onelogin/events{/privacy}","received_events_url":"https://api.github.com/users/onelogin/received_events","type":"Organization","site_admin":false},"repo":{"id":644899,"name":"ruby-saml","full_name":"onelogin/ruby-saml","owner":{"login":"onelogin","id":263373,"avatar_url":"https://avatars.githubusercontent.com/u/263373?v=3","gravatar_id":"","url":"https://api.github.com/users/onelogin","html_url":"https://github.com/onelogin","followers_url":"https://api.github.com/users/onelogin/followers","following_url":"https://api.github.com/users/onelogin/following{/other_user}","gists_url":"https://api.github.com/users/onelogin/gists{/gist_id}","starred_url":"https://api.github.com/users/onelogin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onelogin/subscriptions","organizations_url":"https://api.github.com/users/onelogin/orgs","repos_url":"https://api.github.com/users/onelogin/repos","events_url":"https://api.github.com/users/onelogin/events{/privacy}","received_events_url":"https://api.github.com/users/onelogin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/onelogin/ruby-saml","description":"SAML SSO for Ruby","fork":false,"url":"https://api.github.com/repos/onelogin/ruby-saml","forks_url":"https://api.github.com/repos/onelogin/ruby-saml/forks","keys_url":"https://api.github.com/repos/onelogin/ruby-saml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/onelogin/ruby-saml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/onelogin/ruby-saml/teams","hooks_url":"https://api.github.com/repos/onelogin/ruby-saml/hooks","issue_events_url":"https://api.github.com/repos/onelogin/ruby-saml/issues/events{/number}","events_url":"https://api.github.com/repos/onelogin/ruby-saml/events","assignees_url":"https://api.github.com/repos/onelogin/ruby-saml/assignees{/user}","branches_url":"https://api.github.com/repos/onelogin/ruby-saml/branches{/branch}","tags_url":"https://api.github.com/repos/onelogin/ruby-saml/tags","blobs_url":"https://api.github.com/repos/onelogin/ruby-saml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/onelogin/ruby-saml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/onelogin/ruby-saml/git/refs{/sha}","trees_url":"https://api.github.com/repos/onelogin/ruby-saml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/onelogin/ruby-saml/statuses/{sha}","languages_url":"https://api.github.com/repos/onelogin/ruby-saml/languages","stargazers_url":"https://api.github.com/repos/onelogin/ruby-saml/stargazers","contributors_url":"https://api.github.com/repos/onelogin/ruby-saml/contributors","subscribers_url":"https://api.github.com/repos/onelogin/ruby-saml/subscribers","subscription_url":"https://api.github.com/repos/onelogin/ruby-saml/subscription","commits_url":"https://api.github.com/repos/onelogin/ruby-saml/commits{/sha}","git_commits_url":"https://api.github.com/repos/onelogin/ruby-saml/git/commits{/sha}","comments_url":"https://api.github.com/repos/onelogin/ruby-saml/comments{/number}","issue_comment_url":"https://api.github.com/repos/onelogin/ruby-saml/issues/comments{/number}","contents_url":"https://api.github.com/repos/onelogin/ruby-saml/contents/{+path}","compare_url":"https://api.github.com/repos/onelogin/ruby-saml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/onelogin/ruby-saml/merges","archive_url":"https://api.github.com/repos/onelogin/ruby-saml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/onelogin/ruby-saml/downloads","issues_url":"https://api.github.com/repos/onelogin/ruby-saml/issues{/number}","pulls_url":"https://api.github.com/repos/onelogin/ruby-saml/pulls{/number}","milestones_url":"https://api.github.com/repos/onelogin/ruby-saml/milestones{/number}","notifications_url":"https://api.github.com/repos/onelogin/ruby-saml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/onelogin/ruby-saml/labels{/name}","releases_url":"https://api.github.com/repos/onelogin/ruby-saml/releases{/id}","created_at":"2010-05-03T18:39:04Z","updated_at":"2015-03-29T21:56:18Z","pushed_at":"2015-03-29T00:51:26Z","git_url":"git://github.com/onelogin/ruby-saml.git","ssh_url":"git@github.com:onelogin/ruby-saml.git","clone_url":"https://github.com/onelogin/ruby-saml.git","svn_url":"https://github.com/onelogin/ruby-saml","homepage":"http://support.onelogin.com/entries/165434-saml-toolkit-for-ruby-on-rails","size":3526,"stargazers_count":296,"watchers_count":296,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":253,"mirror_url":null,"open_issues_count":16,"forks":253,"open_issues":16,"watchers":296,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/onelogin/ruby-saml/pulls/197"},"html":{"href":"https://github.com/onelogin/ruby-saml/pull/197"},"issue":{"href":"https://api.github.com/repos/onelogin/ruby-saml/issues/197"},"comments":{"href":"https://api.github.com/repos/onelogin/ruby-saml/issues/197/comments"},"review_comments":{"href":"https://api.github.com/repos/onelogin/ruby-saml/pulls/197/comments"},"review_comment":{"href":"https://api.github.com/repos/onelogin/ruby-saml/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/onelogin/ruby-saml/pulls/197/commits"},"statuses":{"href":"https://api.github.com/repos/onelogin/ruby-saml/statuses/42a7bbd04b730bf248e33591aa0139da2098b4d5"}}}}