-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implements Public Access in netcore #10137
Conversation
…ublic-access-10578
…ontroller, reduce content controller
…ublic-access-10578
…uring endpoints are last, refactors pipeline options, adds public access middleware, ensures public access follows all hops
… front-end and back ends. updates how UmbracoApplicationBuilder works in that it explicitly starts endpoints at the time of calling.
…ce, one for members, fixes TryConvertTo, fixes login redirect
I not sure I understand why Why not separate this into its own class like the following. That seems cleaner:
and then do
|
I like this pattern more. Is seems more clear. But maybe the name "AddFrontEnd" should be "AddWebsite" or "AddWebsiteRendering" |
I see these errors in the log..
The error seems to happen for the KeepAlive request: |
My setup is
I added Login, Account and NoAccess pages using this doc type, where the grid just is used to load macros for login and account. My template is just like this:
It seems like the |
It doesn't 'need' to at all was just a quick option to allow this. Separating classes is easy. But sounds like you'd rather go with this option so I'll update to that app.UseUmbraco()
.WithBackOffice()
.WithWebsite()
.WithEndpoints(u =>
{
u.UseInstallerEndpoints();
u.UseBackOfficeEndpoints();
u.UseWebsiteEndpoints();
});
I had that too but seems strange since UmbracoRouteValues shouldn't exist for back office pages. The KeepAlive controller is a back office controller, yet it's URL is
I cannot replicate your error. I have done exactly like you say: Grid page with the template you've specified. 3 pages: Login (with login macro), Account (with Edit Profile macro) and No Access (with Register macro) and I've set public access on the Account page. It all seems to work. Do you have any other info on how to replicate? |
Damn, I cannot replicate anymore.. But notices another thing.. Our 404s fail now |
…tartup code to be more clear and removes magic that registers middleware.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should all the extensions have namespace Umbraco.Extensions
?
src/Umbraco.Web.BackOffice/Controllers/PublicAccessController.cs
Outdated
Show resolved
Hide resolved
src/Umbraco.Web.BackOffice/DependencyInjection/UmbracoBuilder.BackOfficeIdentity.cs
Outdated
Show resolved
Hide resolved
@bergmania I've pushed some changes
Is this a rhetorical question and I've missed something? Or are you asking me a real question? |
You added a lot of new partial |
It was a mistake, it's just in one place where |
…more code between users and members.
…/umbraco/Umbraco-CMS into netcore/task/public-access-10578
… operations, stop re-creating string keys in DefaultRepositoryCachePolicy
This is a pretty hefty PR since I found a few things causing some issues.
null
parameters, this is because the underlying ActivatorUtilities doesn't want to work withnull
parameters so for this particular instance we usestring.Empty
. This isn't going to cause problems for our use caseIUmbracoApplicationBuilder
, it just exposes the services needed for most endpoint routing. It is instantiated and called from with aUseEndpoints
call. It also still needs to expose theIApplicationBuilder
because some endpoint routing still requires to be done via library ext methods on this.There is a couple bits of magic which is worth discussing. For example, if you look at
PublicAccessMiddleware
, it implementsIConfigureOptions<UmbracoPipelineOptions>
and it is registered with ConfigureOptions. This takes advantage of the above IUmbracoPipelineFilter and adds itself to the umbraco pipeline. This is one of a very few front-end/back-office specific middlewares that is not added in the baseUseUmbraco()
call. The alternative is to explicit add these middlewares somewhere. The only issue with that is then our startup calls start getting larger and larger and will be slightly confusing because the user must ensure that the endpoint registrations come last which would be better if we can just guarantee that (which we can by using this approach).The new
Configure
method looks like this:Within the
UseUmbraco
callback, we will be inside of a UseEndpoints callback which guarantees that at that time we've passed the point of adding custom middlewares. So to add middlewares after umbraco core ones but before the endpoint routes, devs will need to use the UmbracoPipelineOptions. Else should we configure this startup in a different way? One proposal is:where WithBackOffice and WithFrontEnd return a new IUmbracoApplicationBuilder and these just register middlewares before endpoints. Then the WithEndpoints is a void and returns nothing since it must come last and uses our IUmbracoEndpointBuilder. And then we'd remove the 'magic' listed above. What do you think? Other ideas?
Public Access Testing
Public Access Testing 2
This is where things get a bit wild and scenarios that didn't work in any previous version. With the new implementation, since we re-route correctly to either the login page or error page, if those pages themselves have public access, we will adhere to those rules too. Similarly, if those pages specify any redirects (
umbracoRedirect
) or internal redirects (umbracoInternalRedirectId
), those rules will be applied too.This means you can have cascading rules applied. For example, if you have 2x Login pages. One of those pages is the login page for your account controller, but it's also protected, and it's own login page is your 2nd login page. If the member is not logged in, they will be internally redirected to your 2nd login page. This wasn't possible before in previous version. Same goes for error pages and redirects.
Once this is merged, then please merge this one #10138