-
Notifications
You must be signed in to change notification settings - Fork 239
WebApi Updated to latest Microsoft.Owin.Security.* packages and cannot find IIssuerSecurityTokenProvider inteface #28
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
Comments
@vazans The Azure B2C team are not very communicative - the roadmap is updated very infrequently and they don't keep us informed of what's happening at all. They are also not very responsive to change in my opinion, e.g. we've been waiting for over 18 months for on-behalf of flows and we still have to use ADAL 2 to talk to Graph API which is well behind the current versioning. I'd suggest reverting to the earlier libraries |
Thanks @phatcher, I will revert back, we also updated the .net framework so might be a rats nest there trying to revert back just these packages. |
I had noticed @phatcher's comment and flagged it. I have been working to get some resources committed to improving our samples. If there is a list of issues that you would urgently want fixed, please let me know. I can get those prioritized first |
@parakhj nice to see you addressing issues, what I need urgently should be very simple, In the samples give here what needs to change after all packages are moved latest and .net is 4.7 @parakhj Please answer these simple 2 steps and this will save a ton of time.
Thanks and marking this an URGENT Request, |
I have put a detailed request of what I need above, |
Hi @vazans - I'm not sure exactly, sorry. I do so this PR commit related to changing |
Thanks @spottedmahn , will try this today and close when works. |
@spottedmahn @vazans I've managed to get my code working but my code uses the BootstrapContext to push the JWT token down to the API. I noticed that there's a breaking change in that the identity's BoostrapContext is no longer a BootstrapContext but just the JWT token itself - is this intended or a bug in the Microsoft.Identity.Client code? |
Hey @phatcher - I'm not familiar w/ BootstrapContext. Seems like you doing this Access the JWT bearer token when using the JWT middleware in ASP.NET Core but in OWIN, correct? |
Once this change is committed I'll submit a PR to lift out some common code and improve the base ideas - I know this is a sample but it should be a bit cleaner. |
@spottedmahn Yes, that's correct, AFAIK that was the only way to do it in the earlier versions of the libraries |
Though technically I think it was the the WIF token that happens to be a JWT given the context i.e. you set TokenValidationParameters,SaveSigninToken = true and then it's available throughout the request, e.g.
|
@phatcher gotcha. Maybe posting an issue here: AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet would be a good idea as they are the creators of Or maybe it would be a function of OWIN so posting here: aspnet/AspNetKatana would be a good idea? I'm not sure. |
Using idea 1 from here, you can add it as claim manually. app.UseOpenIdConnectAuthentication(
new OpenIdConnectAuthenticationOptions
{
...
// Specify the callbacks for each type of notifications
Notifications = new OpenIdConnectAuthenticationNotifications
{
...
SecurityTokenValidated = OnSecurityTokenValidated
},
}); Add Claim on SecurityTokenValidatedGet IdToken Example |
I'm not sure that survives for the duration of the session or just for the request that authenticates it i.e. when I land on a new page in the same session TokenValidated won't be called again and I'm not sure whether user-assigned claims are persisted in the cookie; I went through something like this about 18 months ago when this first came out. I've avoided scopes etc in the MVC app, apart from basic role checking, since I have to enforce it anyway in the API. I'll try the first link - point is that it is a breaking change from the previous version, though I can see I will have fun when we go to .NET Core since IAuthenticationManager goes away so I'll have to revise the claims enrichment logic in the API |
It is getting persisted between requests. |
The BootstrapContext has been changed to a string due to .NET Core not having BootstrapContext - see AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#897 Would be nice to have some documentation/rationale as to why bother with the TokenCache etc in the MVC app rather than just pushing the JWT down to the API. |
@vazans @spottedmahn I remember why I didn't bother with tokens/scopes, the documentation https://docs.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-reference-oidc says that the only resource supported is the application itself... "Currently, the only resource that you can request a token for is your app's own back-end web API. The convention for requesting a token to yourself is to use your app's client ID as the scope" The example uses read and write scopes and validates them in the API, but this is a simple string match against the data in the scopes claim. Couple of issues here....
|
@spottedmahn @phatcher, I moved to other pressing priorities here at work, but I have a working code that I think should 1) works on latest packages, .net 4.7 2) work without Owin 3) separate Authen/Authorization essentially [Autorize] would only validate Authentication. Authorization can be custom based on claims in the prinicipal.
|
@spottedmahn helped us update the sample. Thanks @spottedmahn! Please check out the update and let me know if you find any other issues. Closing this one for the time being. |
@parakhj Can you point me to documentation about all the breaking changes, and migration instructions? |
Hi, I was running properly on protecting the WebApi with AD B2C AuthBearer token, after I upgraded to latest packages of Microsoft.Owin.Security.* I cannot find the definition for IIssuerSecurityTokenProvider anymore but when I try to use IIssuerSecurityKeyProvider instead of IIssuerSecurityTokenProvider I am running into a whole host of other issues.
Can somebody point me in the correct direction? specifically how Do I get the Owin setup part with code samples using the latest packages.
The text was updated successfully, but these errors were encountered: