I've extended the IdentityUser entity using the directions outlined here: https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities In my test project, this has worked to add a "MiddleName" field that is present as a column on the AbpUsers table. They also show up on the Users CRUD page and modals.
However, they are not present on the profile management page (the one you reach by selecting the user icon on the top of the page and selecting "My Profile"). I've attempted to override the Manage Profile tab component so I could add it myself, following the steps in this guide: https://docs.abp.io/en/abp/latest/UI/AspNetCore/Customization-User-Interface. However, trying to visit this page throws the following exception:
InvalidOperationException: The model item passed into the ViewDataDictionary is of type 'Volo.Abp.Account.Public.Web.Pages.Account.Components.ProfileManagementGroup.PersonalInfo.AccountProfilePersonalInfoManagementGroupViewComponent+PersonalInfoModel', but this ViewDataDictionary instance requires a model item of type 'TieredTestProject.Pages.Account.Components.ProfileManagementGroup.PersonalInfo.MyProfileManagementModel'.
With "MyProfileManagementModel" being the model of my overriding component. I can do what I'm looking for if I include the source code for the Account module, but I'd rather not go that route as I don't seem to be able to easily update the ABP version after that (Suite, for example, only updates the main projects, not any of the modules, and updating the ABP packages manually causes errors).
I would like to know how to do one of the following:
Thank you.
As stated above, after upgrading Suite to 5.3.0 or higher, I can no longer use it in two already-existing 5.2.2 projects to generate new entities. Suite keeps telling me the project is running, even though it isn't. I've been able to create new entities on entirely new projects, as well as a project that has never been "published" through Visual Studio before (the two projects I receive this error for have). What is making Suite think that the project is running, and how do I correct it? I'm no longer able to use the latest version of ABP until I figure this out.
We are attempting to incorporate support for calling Microsoft Graph APIs in our ABP application, using the Microsoft.Graph package. We've already successfully implemented authentication using Azure AD accounts according to the directions in this post: https://community.abp.io/posts/how-to-use-the-azure-active-directory-authentication-for-mvc-razor-page-applications-4603b9cf (we used the second approach, using AddMicrosoftIdentityWebApp).
However, when attempting to add lines to set up the Microsoft Graph client, login with Azure AD no longer works (when Azure AD is selected as the login option, the login page reloads without logging in). Here is the code for our ConfigureAuthentication function in the BlazorModule.cs file:
private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.AddAuthentication()
.AddJwtBearer(options =>
{
options.Authority = configuration["AuthServer:Authority"];
options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
options.Audience = "Link";
})
.AddMicrosoftIdentityWebApp(configuration.GetSection("AzureAd"))
// Login only succeeds when these three lines are commented out:
.EnableTokenAcquisitionToCallDownstreamApi(new string[] { "Group.ReadWrite.All", "User.ReadBasic.All" })
.AddMicrosoftGraph(configuration.GetSection("Graph"))
.AddInMemoryTokenCaches();
context.Services.Configure<OpenIdConnectOptions>(OpenIdConnectDefaults.AuthenticationScheme, options =>
{
options.Authority = configuration["AzureAd:Instance"] + configuration["AzureAd:TenantId"] + "/v2.0/";
options.ClientId = configuration["AzureAd:ClientId"];
options.ResponseType = OpenIdConnectResponseType.CodeIdToken;
options.CallbackPath = configuration["AzureAd:CallbackPath"];
options.ClientSecret = configuration["AzureAd:ClientSecret"];
options.RequireHttpsMetadata = false;
options.SaveTokens = false;
options.GetClaimsFromUserInfoEndpoint = true;
options.SignInScheme = IdentityConstants.ExternalScheme;
options.ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "sub");
});
}
The "Graph" section of appsettings.json consists of the following:
"Graph": {
"BaseUrl": "https://graph.microsoft.com/v1.0",
"Scopes": [ "Group.ReadWrite.All", "User.ReadBasic.All" ]
}
What would be the correct way to implement the Microsoft.Graph package into our ABP app?