Skip to content

Commit 164c773

Browse files
authored
Merge pull request #237 from watson-developer-cloud/4609-iam-url
4609 iam url
2 parents 4f4f823 + f274b39 commit 164c773

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

src/IBM.WatsonDeveloperCloud.VisualRecognition.v3/VisualRecognitionService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public VisualRecognitionService(TokenOptions options, string versionDate) : this
6666
throw new ArgumentNullException("versionDate cannot be null.");
6767

6868
VersionDate = versionDate;
69-
this.Endpoint = options.IamUrl;
69+
this.Endpoint = options.ServiceUrl;
7070

7171

7272
_tokenManager = new TokenManager(options);

src/IBM.WatsonDeveloperCloud/Util/Credentials.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,21 @@ public class Credential
9696
/// </summary>
9797
public class TokenOptions
9898
{
99-
[JsonProperty("iamApiKey", NullValueHandling = NullValueHandling.Ignore)]
99+
/// <summary>
100+
/// The IAM Apikey for the service instance. If provided, The SDK will manage authentication through tokens.
101+
/// </summary>
100102
public string IamApiKey { get; set; }
101-
[JsonProperty("iamAcessToken", NullValueHandling = NullValueHandling.Ignore)]
103+
/// <summary>
104+
/// The access token for the service instance. If provided, the SDK will not manage authentication through tokens.
105+
/// </summary>
102106
public string IamAccessToken { get; set; }
103-
[JsonProperty("iamUrl", NullValueHandling = NullValueHandling.Ignore)]
107+
/// <summary>
108+
/// The service URL.
109+
/// </summary>
110+
public string ServiceUrl { get; set; }
111+
/// <summary>
112+
/// The IAM authentication URL. If omitted the value defaults to "https://iam.bluemix.net/identity/token".
113+
/// </summary>
104114
public string IamUrl { get; set; }
105115
}
106116

src/IBM.WatsonDeveloperCloud/Util/TokenManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class TokenManager
3535

3636
public TokenManager(TokenOptions options)
3737
{
38-
_iamUrl = "https://iam.ng.bluemix.net/identity/token";
38+
_iamUrl = !string.IsNullOrEmpty(options.IamUrl) ? options.IamUrl : "https://iam.bluemix.net/identity/token";
3939
_tokenInfo = new IamTokenData();
4040
if (!string.IsNullOrEmpty(options.IamApiKey))
4141
_iamApikey = options.IamApiKey;

test/IBM.WatsonDeveloperCloud.VisualRecognition.v3.IntegrationTests/VisualRecognitionServiceRCIntegrationTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public void Setup()
9191
TokenOptions tokenOptions = new TokenOptions()
9292
{
9393
IamApiKey = _apikey,
94-
IamUrl = _endpoint
94+
ServiceUrl = _endpoint
9595
};
9696
_service = new VisualRecognitionService(tokenOptions, "2018-03-19");
9797
_service.Client.BaseClient.Timeout = TimeSpan.FromMinutes(120);

0 commit comments

Comments
 (0)