@@ -73,7 +73,6 @@ public IamAuthenticator(Dictionary<string, string> config)
73
73
config . TryGetValue ( PropNameClientSecret , out string clientSecret ) ;
74
74
config . TryGetValue ( PropNameDisableSslVerification , out string disableSslVerficiationString ) ;
75
75
bool . TryParse ( disableSslVerficiationString , out bool disableSslVerification ) ;
76
- Log . Debug ( "IamAuthenticator:{0} {1} {2} {3}" , apikey ) ;
77
76
Init ( apikey , url , clientId , clientSecret , disableSslVerification ) ;
78
77
}
79
78
@@ -168,19 +167,6 @@ bool RequestToken(Callback<IamTokenResponse> callback)
168
167
if ( callback == null )
169
168
throw new ArgumentNullException ( "successCallback" ) ;
170
169
171
- // Use bx:bx as default auth header creds.
172
- var clientId = "bx" ;
173
- var clientSecret = "bx" ;
174
-
175
- // If both the clientId and secret were specified by the user, then use them.
176
- if ( ! string . IsNullOrEmpty ( ClientId ) && ! string . IsNullOrEmpty ( ClientSecret ) )
177
- {
178
- Log . Debug ( "not null: {0}" , ClientId ) ;
179
-
180
- clientId = ClientId ;
181
- clientSecret = ClientSecret ;
182
- }
183
-
184
170
RESTConnector connector = new RESTConnector ( ) ;
185
171
connector . URL = Url ;
186
172
if ( connector == null )
@@ -190,7 +176,11 @@ bool RequestToken(Callback<IamTokenResponse> callback)
190
176
req . Callback = callback ;
191
177
req . HttpMethod = UnityWebRequest . kHttpVerbGET ;
192
178
req . Headers . Add ( "Content-type" , "application/x-www-form-urlencoded" ) ;
193
- req . Headers . Add ( "Authorization" , Utility . CreateAuthorization ( clientId , clientSecret ) ) ;
179
+ // If both the clientId and secret were specified by the user, then use them.
180
+ if ( ! string . IsNullOrEmpty ( ClientId ) && ! string . IsNullOrEmpty ( ClientSecret ) )
181
+ {
182
+ req . Headers . Add ( "Authorization" , Utility . CreateAuthorization ( ClientId , ClientSecret ) ) ;
183
+ }
194
184
req . OnResponse = OnRequestIamTokenResponse ;
195
185
req . DisableSslVerification = DisableSslVerification ;
196
186
req . Forms = new Dictionary < string , RESTConnector . Form > ( ) ;
@@ -250,9 +240,10 @@ public override void Validate()
250
240
throw new ArgumentException ( string . Format ( ErrorMessagePropInvalid , "url" ) ) ;
251
241
}
252
242
253
- if ( string . IsNullOrEmpty ( ClientSecret ) || string . IsNullOrEmpty ( ClientId ) )
243
+ if ( ! string . IsNullOrEmpty ( ClientSecret ) && string . IsNullOrEmpty ( ClientId ) || string . IsNullOrEmpty ( ClientSecret ) && ! string . IsNullOrEmpty ( ClientId ) )
254
244
{
255
- Log . Warning ( "IamTokenManager():" , "Warning: Client ID and Secret must BOTH be given, or the defaults will be used." ) ;
245
+
246
+ throw new ArgumentException ( "Client ID and Secret must BOTH be provided." ) ;
256
247
}
257
248
}
258
249
}
0 commit comments