File tree Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 55require ( "rbconfig" )
66require_relative ( "./version.rb" )
77
8- DEFAULT_IAM_URL = "https://iam.bluemix.net/identity/token"
9- CONTENT_TYPE = "application/x-www-form-urlencoded"
10- ACCEPT = "application/json"
11- DEFAULT_AUTHORIZATION = "Basic Yng6Yng="
12- REQUEST_TOKEN_GRANT_TYPE = "urn:ibm:params:oauth:grant-type:apikey"
13- REQUEST_TOKEN_RESPONSE_TYPE = "cloud_iam"
14- REFRESH_TOKEN_GRANT_TYPE = "refresh_token"
15-
168# Class to manage IAM Token Authentication
179class IAMTokenManager
10+ DEFAULT_IAM_URL = "https://iam.bluemix.net/identity/token"
11+ CONTENT_TYPE = "application/x-www-form-urlencoded"
12+ ACCEPT = "application/json"
13+ DEFAULT_AUTHORIZATION = "Basic Yng6Yng="
14+ REQUEST_TOKEN_GRANT_TYPE = "urn:ibm:params:oauth:grant-type:apikey"
15+ REQUEST_TOKEN_RESPONSE_TYPE = "cloud_iam"
16+ REFRESH_TOKEN_GRANT_TYPE = "refresh_token"
17+
1818 attr_accessor :token_info , :user_access_token
1919 def initialize ( iam_apikey : nil , iam_access_token : nil , iam_url : nil )
2020 @iam_apikey = iam_apikey
Original file line number Diff line number Diff line change @@ -162,4 +162,14 @@ def test_get_token
162162 token = token_manager . _token
163163 assert_equal ( "dummy" , token )
164164 end
165+
166+ def test_dont_leak_constants
167+ assert_nil ( defined? DEFAULT_IAM_URL )
168+ assert_nil ( defined? CONTENT_TYPE )
169+ assert_nil ( defined? ACCEPT )
170+ assert_nil ( defined? DEFAULT_AUTHORIZATION )
171+ assert_nil ( defined? REQUEST_TOKEN_GRANT_TYPE )
172+ assert_nil ( defined? REQUEST_TOKEN_RESPONSE_TYPE )
173+ assert_nil ( defined? REFRESH_TOKEN_GRANT_TYPE )
174+ end
165175end
You can’t perform that action at this time.
0 commit comments