# XWiki rights, the prevent checkbox, and login extensions

**URL:** <https://forum.xwiki.org/t/xwiki-rights-the-prevent-checkbox-and-login-extensions/6541>\
**Category:** Development\
**Tags:** login, apps\
**Created:** [March 26, 2020, 5:03pm UTC](https://forum.xwiki.org/t/xwiki-rights-the-prevent-checkbox-and-login-extensions/6541 "2020-03-26T17:03:41Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![polx](https://forum.xwiki.org/user_avatar/forum.xwiki.org/polx/32/200_2.png) [@polx](https://forum.xwiki.org/u/polx)\
**Post date:** [March 26, 2020, 5:03pm UTC](https://forum.xwiki.org/t/xwiki-rights-the-prevent-checkbox-and-login-extensions/6541/1 "2020-03-26T17:03:41Z")

</div>

Hello fellow XWikiers,

In the Google Apps world, we would like to make it possible to allow Wikis whose admin has checked the “prevent checkbox” (_Prevent unregistered users from viewing pages, regardless of the page rights_) to use Google-based login.

This fails currently, because a call to `/jsx/GoogleApps/JSExtension` is also prevented.  
It would also fail for any bounce URLs (e.g. a request to login which needs to redirect to an external site, and a redirection back from the external site that would log-in the user).

I believe that the inclusion JS-extensions (and style extensions) and the existence of bounce URLs are actually common to many other login extensions: OpenID would certainly be one.  
Do you, developers of a login-extension, share this view?

By this thread, I would like to get a common-vision on how to adapt our login-application to this checkbox and make sure that the developers of other such extensions can take advantage of it. I would summarise the result of this discussion in a design page.

paul

PS: A workaround is to use prevent-rights (or, similarly, some view rights for groups where xwikiguest is not) but the sense of the checkbox is then not there anymore: It is more trustable than rights that can be done.

---

<div class="post-metadata">

**Author:** ![mflorea](https://forum.xwiki.org/user_avatar/forum.xwiki.org/mflorea/32/49_2.png) [@mflorea](https://forum.xwiki.org/u/mflorea)\
**Post date:** [March 27, 2020, 9:24am UTC](https://forum.xwiki.org/t/xwiki-rights-the-prevent-checkbox-and-login-extensions/6541/2 "2020-03-27T09:24:22Z")

</div>

> [@polx](#):
>
> I believe that the inclusion JS-extensions (and style extensions) and the existence of bounce URLs are actually common to many other login extensions: OpenID would certainly be one.  
> Do you, developers of a login-extension, share this view?

I’m not a login extension developer but I agree. For me the solution could be to use some extension points in the login action / template to allow us to:

- include some JavaScript / CSS when the login page is displayed
- handle the redirect from an external authentication provider (note that this means we should tell the external provider to redirect back to the standard login page, using the login action)

I would start by investigating if this is not already possible using the [https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/ExtensionPoint/AfterHeaderUIX](https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/ExtensionPoint/AfterHeaderUIX) and / or [https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/ExtensionPoint/HTMLHead](https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/ExtensionPoint/HTMLHead) .

Thanks,  
Marius

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [March 31, 2020, 3:51pm UTC](https://forum.xwiki.org/t/xwiki-rights-the-prevent-checkbox-and-login-extensions/6541/3 "2020-03-31T15:51:06Z")

</div>

> [@polx](#):
>
> I believe that the inclusion JS-extensions (and style extensions) and the existence of bounce URLs are actually common to many other login extensions: OpenID would certainly be one.

Actually the OpenID Connect authenticator totally bypass the standard login action (each authenticator can decide what to do when the login is requested in XWikiAuthService#showLogin) and expose its own endpoints using resource handlers so it does not have this kind of issue (each resource handled is taking care of its own access control by default).

---

<div class="post-metadata">

**Author:** ![polx](https://forum.xwiki.org/user_avatar/forum.xwiki.org/polx/32/200_2.png) [@polx](https://forum.xwiki.org/u/polx)\
**Post date:** [March 31, 2020, 4:05pm UTC](https://forum.xwiki.org/t/xwiki-rights-the-prevent-checkbox-and-login-extensions/6541/4 "2020-03-31T16:05:41Z")

</div>

Hold on. I could not entirely grab the details in [the source](https://github.com/xwiki-contrib/oidc/) of what you mean by “resource handlers”. Do you have half-an-inch more of a concrete hint? Are you wiring a new servlet?  
thanks  
Paul

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [March 31, 2020, 4:08pm UTC](https://forum.xwiki.org/t/xwiki-rights-the-prevent-checkbox-and-login-extensions/6541/5 "2020-03-31T16:08:02Z")

</div>

> [@polx](#):
>
> Are you wiring a new servlet?

Kind of. What I mean by “resource handlers” is documented on [https://extensions.xwiki.org/xwiki/bin/view/Extension/Resource%20API](https://extensions.xwiki.org/xwiki/bin/view/Extension/Resource%20API). XWiki has it’s own “servlet” system which allow extensions to easily expose (supposedly generic but usually HTTP) endpoints. There is not a single wiki page in the OpenID Connect tools, full Java (and templates located in JARs).

Resource handler system is even more important for the OpenID Connect provider side of this project which have to expose various endpoints which can’t be disturbed by XWiki actions checks.

---

<div class="post-metadata">

**Author:** ![polx](https://forum.xwiki.org/user_avatar/forum.xwiki.org/polx/32/200_2.png) [@polx](https://forum.xwiki.org/u/polx)\
**Post date:** [March 31, 2020, 4:16pm UTC](https://forum.xwiki.org/t/xwiki-rights-the-prevent-checkbox-and-login-extensions/6541/6 "2020-03-31T16:16:27Z")

</div>

Thanks [Resource API](https://extensions.xwiki.org/xwiki/bin/view/Extension/Resource%20API) looks like an interesting thing indeed. Can I be sure that this is also compatible to installs such as short-URLs?

Also, your answer seems to confirm that there’s no way you can work around the checkbox _Prevent unregistered users from viewing pages, regardless of the page rights_ (probably, as intended).

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [March 31, 2020, 4:18pm UTC](https://forum.xwiki.org/t/xwiki-rights-the-prevent-checkbox-and-login-extensions/6541/7 "2020-03-31T16:18:25Z")

</div>

> [@polx](#):
>
> Also, your answer seems to confirm that there’s no way you can work around the checkbox _Prevent unregistered users from viewing pages, regardless of the page rights_ (probably, as intended).

I did not try actually (I started to work on the provider and then I naturally kept using resource handlers for the authenticator) but yes I don’t see much way around this option.

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [March 31, 2020, 4:24pm UTC](https://forum.xwiki.org/t/xwiki-rights-the-prevent-checkbox-and-login-extensions/6541/8 "2020-03-31T16:24:34Z")

</div>

> [@polx](#):
>
> Thanks [Resource API](https://extensions.xwiki.org/xwiki/bin/view/Extension/Resource%20API) looks like an interesting thing indeed. Can I be sure that this is also compatible to installs such as short-URLs?

Resource handlers starts after [http://host/xwiki/](http://host/xwiki/) so for short URL you will have to add the resource handler to the list of known entry points like it’s done for “webjars” and “asyncrenderer” (which are resource handler based).

---

<div class="post-metadata">

**Author:** ![polx](https://forum.xwiki.org/user_avatar/forum.xwiki.org/polx/32/200_2.png) [@polx](https://forum.xwiki.org/u/polx)\
**Post date:** [April 3, 2020, 11:19am UTC](https://forum.xwiki.org/t/xwiki-rights-the-prevent-checkbox-and-login-extensions/6541/9 "2020-04-03T11:19:12Z")

</div>

I’ve now started [a design page](https://design.xwiki.org/xwiki/bin/view/Proposal/LoginExtensionsinGuestprotectedWikis) in the direction.

I will then try to evaluate the advantages and disadvantages of running things with a resource-API-endpoint or with javascript-embedded in the login’s extension-points.  
In all cases, a form of extension-point for the login page is necessary.

thanks.

paul

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [April 3, 2020, 12:45pm UTC](https://forum.xwiki.org/t/xwiki-rights-the-prevent-checkbox-and-login-extensions/6541/10 "2020-04-03T12:45:40Z")

</div>

> [@polx](#):
>
> In all cases, a form of extension-point for the login page is necessary.

Not sure what you mean. As I said each authenticator can decide what to do exactly for login in XWikiAuthServiceImpl#showLogin(). Showing the login form is just the default behavior.
