-
ABP Framework version: v6.0.1
-
UI type: MVC
-
DB provider: EF Core
-
Tiered (MVC) or Identity Server Separated (Angular): Tired
Hi,
I want to deny access from some client_id application with some role to some application sevice.
Is that possbile? How can I do that?
Thanks for all
17 Answer(s)
-
0
-
0
Hi,
My cuestion is, how can I deny access some user/role that tries to access through some client_id?
Thanks
-
0
hi
You can try to get the client_id of
CurrentPrincipal
in application services.Or add some custom policy
-
0
Hi,
I can't acces to the CurrentPrincipal from my application services.
Can you give me some examples please?
Thanks
-
0
var allClaims = CurrentUser.GetAllClaims(); // Inject ICurrentPrincipalAccessor from ctor var claimsPrincipal = LazyServiceProvider.LazyGetRequiredService<ICurrentPrincipalAccessor>().Principal;
-
0
Hi,
Sorry but I think that I didn't explain myself very well
How can I only allow access from 'web.public' project, client_id="public", to users belonging to role 'A', but block these users trying to access from 'web' project, client_id="private" and throw the message Unauthorized.
-
0
You can get the current clientid. Then you can execute custom logic
public async Task<string> MyMethodAsync() { var clientIdClaim = CurrentUser.GetAllClaims().FirstOrDefault(x => x.Type == AbpClaimTypes.ClientId); if (clientIdClaim != null) { if (clientIdClaim.Value == "public") { } if (clientIdClaim.Value == "private") { } } }
-
0
Hi,
I would that the user with role A can't Login from Web, the system throw UnAuthorized, and if the same role LogIn from Web.public, they can go on
-
0
You can try to override the
OnPostAsync
ofOpenIddictSupportedLoginModel
In this method, you can get
username
andClientId
. It can complete the login or deny the login -
0
Where is this method?
-
0
account/src/Volo.Abp.Account.Pro.Public.Web.OpenIddict/Pages/Account/OpenIddictSupportedLoginModel.cs
-
0
And Where can I override this method, in AuthServer project?
-
0
Yes, in the AuthServer project.
-
0
Sorry but I can't see where.
In AuthServer project there are only two folders, Themes and pages. And pages only has Index without any Post method
-
0
hi
This is a class. You can put it in any folder.
-
0
Sorry but I don't undestand.
Can you give me an example?
Thanks
-
0