0
aZee created
- ABP Framework version: v8.2.3
Hello, can I replace IdentitySessionDynamicClaimsPrincipalContributor
with my own implementation? If so, how can I do it?
2 Answer(s)
-
0
Hi,
Of course, you can replace it.
for example:
[Dependency(ReplaceServices = true)] [ExposeServices(typeof(IdentitySessionDynamicClaimsPrincipalContributor))] public class MyIdentitySessionDynamicClaimsPrincipalContributor : IdentitySessionDynamicClaimsPrincipalContributor { public override Task ContributeAsync(AbpClaimsPrincipalContributorContext context) { .... return base.ContributeAsync(context); } }
-
0
Hello, thank you for your reply. However, I had to use the
IServiceCollection.Replace
method instead ofDependency
attribute. Here's my working code :MyIdentitySessionDynamicClaimsPrincipalContributor.cs
public class MyIdentitySessionDynamicClaimsPrincipalContributor : IdentitySessionDynamicClaimsPrincipalContributor { public override Task ContributeAsync(AbpClaimsPrincipalContributorContext context) { ... } }
MyModule.cs
public class MyModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { ... context.Services.Replace( ServiceDescriptor.Transient< IdentitySessionDynamicClaimsPrincipalContributor, MyIdentitySessionDynamicClaimsPrincipalContributor >()); } }