Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ServiceClientCredentials.InitializeServiceClient<T> not called on client constructor #246

Closed
ldemidov opened this issue Jul 23, 2015 · 2 comments

Comments

@ldemidov
Copy link

We have a ServiceClientCredentials implementation that logins to our service on client creation, then stores to authentication credentials for subsequent requests. This worked fine with the old version

public class CustomLoginCredentials : ServiceClientCredentials {
  private string AuthenticationToken { get; set; }
  public override void InitializeServiceClient<T>(ServiceClient<T> client) {
    // make login request.  save authentication token in AuthenticationToken
  }

 public override Task ProcessHttpRequestAsync(HttpRequestMessage request, CancellationToken cancellationToken) {
   // place AuthenticationToken in request header
 }
}

So then declaring our client
var client = new ClientAPI(new Uri("url"), new CustomLoginCredentials());

The InitializeMethod would get called and then all requests would be properly authenticated.

This does work any more in the new version. Please let me know if this is a bug (I could see into fixing it myself) or some new intended behavior.

@markcowl
Copy link
Member

@ldemidov Thank you for the report, we will take a look

stankovski added a commit to stankovski/AutoRest that referenced this issue Jul 31, 2015
@hovsepm
Copy link
Contributor

hovsepm commented Jul 31, 2015

Fixed in dev branch.

@hovsepm hovsepm closed this as completed Jul 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants