Giter Site home page Giter Site logo

Comments (11)

tidyui avatar tidyui commented on August 22, 2024 1

We will provide a tutorial for you

from piranha.core.docs.

tidyui avatar tidyui commented on August 22, 2024 1

Please take a look at this tutorial and let us know if it makes sense or should be improved in any way!

Source code:
https://github.com/PiranhaCMS/piranha.core.docs/blob/master/src/08.%20Tutorials/01.%20Securing%20Pages.md

Webpage:
http://piranhacms.org/docs/tutorials/securing-pages

Regards

from piranha.core.docs.

tidyui avatar tidyui commented on August 22, 2024 1

I think I missed out one thing for MVC. This baseclass when using Razor Pages catches the exception thrown by model loader and returns unauthorized:

https://github.com/PiranhaCMS/piranha.core/blob/master/core/Piranha.AspNetCore/Models/SinglePost.cs#L72

You need to add the same behavior by yourself in your controller actions in CmsController, otherwise you will just get an exception and not a 401.

Regards

from piranha.core.docs.

tidyui avatar tidyui commented on August 22, 2024

No. The minimum requirements for logging into the admin interface is that the user is an admin. It hasn’t been designed with that use case in mind.

from piranha.core.docs.

traustitj avatar traustitj commented on August 22, 2024

Thank you for the quick reply. Do you have any instructions on how to use the admin to go to authorized pages? Or how to do best practice of authorized pages?

from piranha.core.docs.

tidyui avatar tidyui commented on August 22, 2024

I think we will have to do a tutorial on it, but in short, here are my suggestions:

  1. Add AuthorizeAttribute on manager pages.
  2. Do not add AuthorizeAttribute on public pages, instead select the claims the user should have on the page instance.
  3. For public pages, get them using the IModelLoader, like in the template projects. The loader will perform security checks for the current user and the requested page.
  4. If the user doesn't have access, the IModelLoader will throw a UnathorizedException, customize the middleware pipeline to redirect users when this happen to a public login page, not the login page of the manager.

Best regards

from piranha.core.docs.

traustitj avatar traustitj commented on August 22, 2024

I don't understand you here

from piranha.core.docs.

tidyui avatar tidyui commented on August 22, 2024

I moved this issue to the docs repo as well

from piranha.core.docs.

traustitj avatar traustitj commented on August 22, 2024

Hi.
Thank you so much.
I made this repo, https://github.com/traustitj/piranhalogin.git

Not Sure what I am doing wrong here.

from piranha.core.docs.

traustitj avatar traustitj commented on August 22, 2024

Ahh, thank you. You really helped me a great deal.

from piranha.core.docs.

traustitj avatar traustitj commented on August 22, 2024

Works like a charm.

from piranha.core.docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.