Skip to content

Commit

Permalink
feat(credentials): If the password begins with 'icp-' authenticate us…
Browse files Browse the repository at this point in the history
…ing basicauth instead of doing token exchange
  • Loading branch information
mediumTaj committed Sep 12, 2018
1 parent 1864798 commit 0386527
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/IBM.WatsonDeveloperCloud/Service/WatsonService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace IBM.WatsonDeveloperCloud.Service
public abstract class WatsonService : IWatsonService
{
const string PATH_AUTHORIZATION_V1_TOKEN = "/authorization/api/v1/token";

const string ICP_PREFIX = "icp-";
public IClient Client { get; set; }

public string ServiceName { get; set; }
Expand Down Expand Up @@ -89,7 +89,7 @@ protected WatsonService(string serviceName, string url, IClient httpClient)
/// <param name="password">The password</param>
public void SetCredential(string userName, string password)
{
if (userName == "apikey")
if (userName == "apikey" && !password.StartsWith(ICP_PREFIX))
{
TokenOptions tokenOptions = new TokenOptions()
{
Expand Down

0 comments on commit 0386527

Please sign in to comment.