-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
It looks like the "core" version of the lib is referencing some .NET Framework API's... Also, the docs don't seem correct for how to configure startup.
Docs show ConfigServices like:
services.AddOData()
.AddAuthorization(options =>
{
options.ScopesFinder = context =>
{
var userScopes = context.User.FindAll("Scope").Select(claim => claim.Value);
return Task.FromResult(userScopes);
};
options.ConfigureAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie();
});
But the AddAuthorization() extension method seems to be for .NET Framework. So, I tried ...
services.AddODataAuthorization(options =>
{
options.ScopesFinder = context =>
{
var userScopes = context.User.FindAll("Scope").Select(claim => claim.Value);
return System.Threading.Tasks.Task.FromResult(userScopes);
};
});
And, for authentication, I want to use Azure AD (Bearer tokens)
services.AddMicrosoftIdentityWebApiAuthentication(Configuration);
And, in the Configure method:
app.UseAuthentication();
app.UseODataAuthorization();
But, I get the following exception at startup...
System.TypeLoadException: Could not load type 'Microsoft.AspNet.OData.Interfaces.IODataFeature' from assembly 'Microsoft.AspNetCore.OData, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
at Microsoft.AspNetCore.OData.Authorization.ODataAuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Metadata
Metadata
Assignees
Labels
No labels