Open Closed

Restrict Public Users from Accessing Admin Website and Disable Their Login in Admin website #8071


User avatar
0
devsumati created

ABP Framework version: v8.2.0

UI Type: MVC

Database System: EF Core (SQL Server)

Tiered (for MVC) or Auth Server Separated (for Angular): yes/no

Exception message and full stack trace:

Steps to reproduce the issue:

I have a tiered application. i am treating web as a admin website and public.web as public website. i want to configure it in a way so that the user who have permission to view only public website cannot open admin website. how can i configure this and where should i give permissions.

I dont want any public user to enter admin website.


29 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    1. Yes.

    2. Do you mean that after clicking Logout on the web website, you are redirected to the public website?

  • User Avatar
    0
    devsumati created

    hi

    1. Yes.

    2. Do you mean that after clicking Logout on the web website, you are redirected to the public website?

    My workflow is something like this

    1. When user tries to login in web project/ admin website.
    2. If that user have role as public.
    3. That user should be redirected to public website without login.
    4. with this code user is redirected to public with logged in. But that user cannot logout (don't know the reason).
  • User Avatar
    0
    devsumati created

    hi

    1. Yes.

    2. Do you mean that after clicking Logout on the web website, you are redirected to the public website?

    My workflow is something like this

    1. When user tries to login in web project/ admin website.
    2. If that user have role as public.
    3. That user should be redirected to public website without login.
    4. with this code user is redirected to public with logged in. But that user cannot logout (don't know the reason). "
    app.Use(async (httpContext, next) =>
    {
        var currentUser = httpContext.RequestServices.GetRequiredService();
        if (currentUser.IsInRole("PublicUser"))
        {
            //redirect ...
            return;
        }
        await next();
    });
    

    "

    error user get when click logout after redirect

    "error:invalid_request
    error_description:The client application is not allowed to use the specified identity token hint.
    error_uri:https://documentation.openiddict.com/errors/ID2141"
    
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please use the code from https://abp.io/support/questions/8071/Restrict-Public-Users-from-Accessing-Admin-Website-and-Disable-Their-Login-in-Admin-website?CurrentPage=1#answer-3a15cf9f-1dff-46eb-3f46-458e358d526a

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11