Cannot pass AAD client id in ActiveDirectoryServiceSettings because it's not a Uri #835

Closed
amolenk opened this Issue Mar 12, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@amolenk

amolenk commented Mar 12, 2016

I’ve got two applications registered in AAD, the first one representing a Web API and the second one representing a Web Site that calls the Web API. The Web Site application is given the permission to call the Web API application.

I’ve got the following information from AAD:

  • Web API client id (the audience)
  • Web Site client id / Web Site client secret (the client credentials)

Using the following code I can succesfully authenticate and call the Web API:

var clientCredential = new ClientCredential(webSiteClientId, webSiteClientSecret);
 
AuthenticationContext context = new AuthenticationContext(authority);
AuthenticationResult authenticationResult = context.AcquireToken(webApiClientId, clientCredential);
var tokenProvider = new ApplicationTokenProvider(context, webApiClientId, clientCredential, authenticationResult);
 
TokenCredentials creds = new TokenCredentials(tokenProvider);

var client = new MyWebApiClient(creds);

 
This works fine. However, as far as I can see, I’m not able to use any of the much simpler LoginSilentAsync overloads.

I’d like to do something like this:

var creds = ApplicationTokenProvider.LoginSilentAsync(domain, audience, clientCredential)

However, the only way to pass the audience (in my case the Web API client id) to the LoginSilentAsync method is by passing an ActiveDirectoryServiceSettings instance which exposes an Audience property. Since this property is of type Uri I cannot use it in combination with the Web API client id which is a guid.

Wouldn’t it be more flexible to change this property’s type to string? Or is there some other reason it must be a Uri?

@devigned

This comment has been minimized.

Show comment
Hide comment
@devigned

devigned Mar 14, 2016

Member

@markcowl do you have any insight into this one?

Member

devigned commented Mar 14, 2016

@markcowl do you have any insight into this one?

@fearthecowboy

This comment has been minimized.

Show comment
Hide comment
@fearthecowboy

fearthecowboy Jun 15, 2016

Member

Howdy!

In our planning for driving towards a stable '1.0' release, I'm marking this issue as 'deferred' 💤 and we're going to review it during the post-1.0 planning cycle.

It's not to say that we're not going to work on it, or that this isn't not important, but at the moment, we're picking and choosing the stuff we must do before 1.0. 🏇 🏇 🏇

We'll make sure we pick this back up at that point. 🎉

Member

fearthecowboy commented Jun 15, 2016

Howdy!

In our planning for driving towards a stable '1.0' release, I'm marking this issue as 'deferred' 💤 and we're going to review it during the post-1.0 planning cycle.

It's not to say that we're not going to work on it, or that this isn't not important, but at the moment, we're picking and choosing the stuff we must do before 1.0. 🏇 🏇 🏇

We'll make sure we pick this back up at that point. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment