summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2017-10-06 16:14:14 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2017-10-06 16:14:14 +0200
commitf9d490dbb910cdd05ca0a0fa38331708181e4b1e (patch)
tree0329bd87db08ee068d816646adfd48f8b623d608 /lib
parent3e26b0dcd113ade77dc8304137c6733cab4c8718 (diff)
downloadgitlab-ce-f9d490dbb910cdd05ca0a0fa38331708181e4b1e.tar.gz
Improve redirect uri state and fix all remaining tests
Diffstat (limited to 'lib')
-rw-r--r--lib/google_api/cloud_platform/client.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/google_api/cloud_platform/client.rb b/lib/google_api/cloud_platform/client.rb
index 6d0c148b261..a440a3e3562 100644
--- a/lib/google_api/cloud_platform/client.rb
+++ b/lib/google_api/cloud_platform/client.rb
@@ -16,9 +16,14 @@ module GoogleApi
:cloud_platform_expires_at
end
- def session_key_for_second_redirect_uri(secure: nil)
- secure = SecureRandom.hex unless secure
- return "cloud_platform_second_redirect_uri_#{secure}", secure
+ def new_session_key_for_redirect_uri
+ SecureRandom.hex.tap do |state|
+ yield session_key_for_redirect_uri(state)
+ end
+ end
+
+ def session_key_for_redirect_uri(state)
+ "cloud_platform_second_redirect_uri_#{state}"
end
end