If AppUser
has ExtraProperties
property and AppUserDto
doesn't have this property, then AutoMapper throws such a validation error. So, this is an expected case. You can ignore it or create ExtraProperties in your DTO, based on your business requirement.
Thanks @AndrewT for your feedback.
See https://blog.abp.io/abp/ABP-v2.8.0-Releases-&-Road-Map
Blazor has a very high priority in our road map among major works.
Great explanation :)
Hi,
This UI is used to manage clients. You can create new clients of edit existing ones.
YourProjectName_Web is a pre-defined client used by the Angular UI. Be careful on editing it, since your application may not properly work if you remove some necessary resources from this client.
You can define new clients here. When you define a new client, then you (or anyone you've shared it) can connect to your application with this new client.
If you are not sure what a client is, please refer to the IdentityServer documentation: https://identityserver4.readthedocs.io/en/latest/ If you are new to IDS, the big picture and the termonilogy documents are good points to start with.
Unfortunately, IDS and OAuth are complex, and you need to understand it to customize. ABP Commercial makes it easy by providing UI and pre-defined configuration for you.
BTW, if you want to remove the IdentityServer module from your system and use another Identity Server (like Azure AD), it is another topic. We use standard Identity and IdentityServer libraries, so you can find documents on the web. Since they are not our products, we don't provide advanced support for them as a part of the standard ABP Commercial support.
If you have a specific question, however, we will try to help you.
Thanks.
Check package.json, it should have using @volo/abp.aspnetcore.mvc.ui.theme.lepton 2.4.0
Run yarn
on the command line (in the folder containing your web project)
Run gulp
This will restore missing files.
Can you try to install the latest .net core SDK (v3.1.102)? https://dotnet.microsoft.com/download/dotnet-core/thank-you/sdk-3.1.102-windows-x64-installer
Hi,
We are using the Identity Server for authentication. There are some different flows, but I think the most convinient way is to use the resource owner password flow for your case.
The downloaded startup template has a .HttpApi.Client.ConsoleTestApp project which authenticates using this flow by default. However, it assumes that username and password is hard-coded in the appsettings.json. I will explain you how to convert this project to dynamically get username & password from user, then authenticate and get access token.
AccessTokenManager
class like that:using System;
using System.Net.Http;
using System.Threading.Tasks;
using IdentityModel.Client;
using Volo.Abp.DependencyInjection;
namespace MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp
{
public class AccessTokenManager : ISingletonDependency
{
public string AccessToken { get; private set; }
private readonly IHttpClientFactory _httpClientFactory;
public AccessTokenManager(IHttpClientFactory httpClientFactory)
{
_httpClientFactory = httpClientFactory;
}
public async Task ObtainAccessToken()
{
Console.Write("Username: ");
var userName = Console.ReadLine();
Console.Write("Password: ");
var password = Console.ReadLine();
var discoveryResponse = await GetDiscoveryResponse();
var tokenResponse = await GetTokenResponse(discoveryResponse, userName, password);
AccessToken = tokenResponse.AccessToken;
}
protected async Task<DiscoveryDocumentResponse> GetDiscoveryResponse()
{
using (var httpClient = _httpClientFactory.CreateClient())
{
return await httpClient.GetDiscoveryDocumentAsync(new DiscoveryDocumentRequest
{
Address = "https://localhost:44301",
Policy = { RequireHttps = true }
});
}
}
protected async Task<TokenResponse> GetTokenResponse(
DiscoveryDocumentResponse discoveryResponse,
string userName,
string password
)
{
using (var httpClient = _httpClientFactory.CreateClient())
{
return await httpClient.RequestPasswordTokenAsync(
await CreatePasswordTokenRequestAsync(discoveryResponse, userName, password)
);
}
}
protected virtual Task<PasswordTokenRequest> CreatePasswordTokenRequestAsync(
DiscoveryDocumentResponse discoveryResponse,
string userName,
string password)
{
var request = new PasswordTokenRequest
{
Address = discoveryResponse.TokenEndpoint,
Scope = "MyProjectName",
ClientId = "MyProjectName_App",
ClientSecret = "1q2w3e*",
UserName = userName,
Password = password
};
return Task.FromResult(request);
}
}
}
ObtainAccessToken()
method gets user & pass from console, authenticates to the identity server (just as described in the IDS4 documentation), then sets it to the AccessToken
property. This class is singleton, so you can access the token from another service later.
I've written the configuration hard-coded, you need to refactor the code :)
IRemoteServiceHttpClientAuthenticator
to get the access token. So, you need to implement it:using System.Threading.Tasks;
using IdentityModel.Client;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Http.Client.Authentication;
namespace MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp
{
public class MyRemoteServiceHttpClientAuthenticator : IRemoteServiceHttpClientAuthenticator, ITransientDependency
{
private readonly AccessTokenManager _accessTokenManager;
public MyRemoteServiceHttpClientAuthenticator(AccessTokenManager accessTokenManager)
{
_accessTokenManager = accessTokenManager;
}
public Task Authenticate(RemoteServiceHttpClientAuthenticateContext context)
{
context.Client.SetBearerToken(_accessTokenManager.AccessToken);
return Task.CompletedTask;
}
}
}
This gets the token from the AccessTokenManager
. It is very simple.
AccessTokenManager.ObtainAccessToken()
on your login screen of the WPF app. In this console app, I called it inside the ConsoleTestAppHostedService
, before the ClientDemoService
usage:await application.ServiceProvider
.GetRequiredService<AccessTokenManager>()
.ObtainAccessToken();
var demo = application.ServiceProvider.GetRequiredService<ClientDemoService>();
await demo.RunAsync();
That's all! Enjoy with the ABP Framework :)
I created an issue for this: https://github.com/abpframework/abp/issues/2791
There is no such a feature yet. Actually, it is a good practice to separate them. However, you can do it manually if you need. We can try to help you if you have any problem on your implementation.
Hi @trendline
module
creates a new module with a sample host application uses the free and open source modules and themes. module-pro
uses the commercial modules and themes. It doesn't have much difference for a module development but we suggest you use module pro
if you then will use this module in an ABP Commercial based solution.
We will check the problem for module pro
, thank you for reporting this.
app
creates a free startup template based project with free modules and themes included. if you want to use it, no need to pay for the ABP Commercial :)
app-pro
creates a startup project based on the commercial modules and themes.