Sure, please email me.
Hi,
We need a project and steps to reproduce the problem, if you can provide them, we can help you solve the problem quickly. You can email me: shiwei.liang@volosoft.com
Yes.
If the specified configuration is not provided, it will fallback to default.
Hi,
You can put the class these Class to .Web
project.
Add the following code to the ConfigureServices
method of .WebModule
context.Services.Replace(ServiceDescriptor.Transient<IClaimsService, MyAbpClaimsService>());
How I can get the claim to check the user property ConCurrentUserID, so that I can block login?
If you are not logged in, you cannot get the user claim, You should query the database values.
Hi,
You can try:
public class MyAbpClaimsPrincipalContributor : IAbpClaimsPrincipalContributor, ITransientDependency
{
public Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
{
var claimsIdentity = new ClaimsIdentity();
claimsIdentity.AddIfNotContains(new Claim("ConCurrentUserId", "value"));
context.ClaimsPrincipal.AddIdentity(claimsIdentity);
return Task.CompletedTask;
}
}
public class MyAbpClaimsService : AbpClaimsService
{
public MyAbpClaimsService(IProfileService profile, ILogger<DefaultClaimsService> logger) : base(profile, logger)
{
}
protected override IEnumerable<string> FilterRequestedClaimTypes(IEnumerable<string> claimTypes)
{
return base.FilterRequestedClaimTypes(claimTypes)
.Union(new []{
AbpClaimTypes.TenantId,
AbpClaimTypes.EditionId,
"ConCurrentUserId"
});
}
}
context.Services.Replace(ServiceDescriptor.Transient<IClaimsService, MyAbpClaimsService>());
Hi,
Yes we can.
You need to reference the AbpIdentityHttpApiClientModule
module.
See https://docs.abp.io/en/abp/latest/API/Dynamic-CSharp-API-Clients#usage
Like:
{
"RemoteServices": {
"AbpIdentity": {
"BaseUrl": "http://localhost:48392/"
}
}
}
Can I check it remotely? shiwei.liang@volosoft.com
Cannot resolve parameter 'Volo.Abp.Identity.IIdentityRoleRepository roleRepository' of constructor
Did you add module dependencies?
[DependsOn(
typeof(AbpIdentityApplicationModule)
)]
Hi,
Example:
public class MyAbpClaimsPrincipalContributor : IAbpClaimsPrincipalContributor, ITransientDependency
{
public Task ContributeAsync(AbpClaimsPrincipalContributorContext context)
{
var claimsIdentity = new ClaimsIdentity();
claimsIdentity.AddIfNotContains(new Claim("Organization", "OrganizationValue"));
context.ClaimsPrincipal.AddIdentity(claimsIdentity);
return Task.CompletedTask;
}
}
public class MyAbpClaimsService : AbpClaimsService
{
public MyAbpClaimsService(IProfileService profile, ILogger<DefaultClaimsService> logger) : base(profile, logger)
{
}
protected override IEnumerable<string> FilterRequestedClaimTypes(IEnumerable<string> claimTypes)
{
return base.FilterRequestedClaimTypes(claimTypes)
.Union(new []{
AbpClaimTypes.TenantId,
AbpClaimTypes.EditionId,
"Organization"
});
}
}
context.Services.Replace(ServiceDescriptor.Transient<IClaimsService, MyAbpClaimsService>());
Hi,
You need to reference Identity
module.
e.g: Account module: https://github.com/abpframework/abp/blob/12d92700a0396367a7e749d662e92c167b7f260d/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AbpAccountApplicationModule.cs#L16
Then you can inject the repository to get the user list.
If you deploy identity as a separate service and use a separate database. You need to set the connection string:
{
"ConnectionStrings": {
"MyModuleNameService": "Server=localhost;Database=MyProjectName_MyModuleNameService;Trusted_Connection=True",
"AbpIdentity": "Server=localhost;Database=MyProjectName_IdentityService;Trusted_Connection=True"
}
}