IContentFinder: show protected node without authentication
Hi everyone!
I'm implementing my custom Content Finder and I'm almost done, but there's a problem: the code retrieve correctly the node, but it's protected (role based) and when I set the PublishedContentRequest.PublishedContent to the protected node I've found, Umbraco (correctly) redirect me to the login page. Is there a way to temporary remove this protection?
I've the following structure:
HP
SubHome1 (MultinodePicker to ProtectedNode1 and ProtectedNode2)
SubHome2
...
ProtectedHP
ProtectedNode1
ProtectedNode2
...
The purpose is to have "virtual pages" under SubHome1 (/SubHome1/ProtectedNode1 and /SubHome1/ProtectedNode2) without duplicating the nodes, so I can show the user some of my protected pages.
The IContentFinder works, it find the protected nodes, but I'm always redirected to the login page.
public class PreviewsContentFinder : IContentFinder
{
public bool TryFindContent(PublishedContentRequest request)
{
//find my protected node from the last url segment
//...
if(nodeIsFound)
{
request.PublishedContent = foundNode; //foundNode is my protected node
//some other istruction to avoid redirect to the login page
}
return nodeIsFound;
}
}
Maybe a stupid question ? But why do you want to show a page that is protected without the user having to log in ? Doesn't that make the proctection useless ?
Same question I asked to my customer when he told me "Ok, now remove the protection from these pages!"... He wanted neither duplicate nor move the node so I thought about the content finder... I know it's kinda weird...
I don't think you are going to be able to achieve what you are after directly because the parent node is protected. However, what about if you created a "virtual" page. This would have a different url, but instead of using the content finder approach you load the data via the Umbraco cache using a partial view. You have full control on this I think.
You'd have to put some meta bits in place as the same content would be available on two urls, but you wouldn't have duplication in the back office, so a single point of managing it.
IContentFinder: show protected node without authentication
Hi everyone!
I'm implementing my custom Content Finder and I'm almost done, but there's a problem: the code retrieve correctly the node, but it's protected (role based) and when I set the PublishedContentRequest.PublishedContent to the protected node I've found, Umbraco (correctly) redirect me to the login page. Is there a way to temporary remove this protection?
I've the following structure:
HP
The purpose is to have "virtual pages" under SubHome1 (/SubHome1/ProtectedNode1 and /SubHome1/ProtectedNode2) without duplicating the nodes, so I can show the user some of my protected pages.
The IContentFinder works, it find the protected nodes, but I'm always redirected to the login page.
Thank you S
Hi Stefano,
Maybe a stupid question ? But why do you want to show a page that is protected without the user having to log in ? Doesn't that make the proctection useless ?
Dave
Same question I asked to my customer when he told me "Ok, now remove the protection from these pages!"... He wanted neither duplicate nor move the node so I thought about the content finder... I know it's kinda weird...
I don't think you are going to be able to achieve what you are after directly because the parent node is protected. However, what about if you created a "virtual" page. This would have a different url, but instead of using the content finder approach you load the data via the Umbraco cache using a partial view. You have full control on this I think.
You'd have to put some meta bits in place as the same content would be available on two urls, but you wouldn't have duplication in the back office, so a single point of managing it.
is working on a reply...