-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into disable-CSRF-history
- Loading branch information
Showing
74 changed files
with
837 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
--- | ||
myst: | ||
html_meta: | ||
"description": "The @login endpoint exposes the list of external authentication services that may be used in the Plone site." | ||
"property=og:description": "The @login endpoint exposes the list of external authentication services that may be used in the Plone site." | ||
"property=og:title": "@login for external authentication links" | ||
"keywords": "Plone, plone.restapi, REST, API, login, authentication, external services" | ||
--- | ||
|
||
# Login for external authentication links | ||
|
||
It is common to use add-ons that allow logging in to your site using third party services. | ||
Such add-ons include using authentication services provided by KeyCloak, GitHub, or other OAuth2 or OpenID Connect enabled services. | ||
|
||
When you install one of these add-ons, it modifies the login process, directing the user to third party services. | ||
|
||
To expose the links provided by these add-ons, `plone.restapi` provides an adapter based service registration. | ||
It lets those add-ons know that the REST API can use those services to authenticate users. | ||
This will mostly be used by frontends that need to show the end user the links to those services. | ||
|
||
To achieve that, third party products need to register one or more adapters for the Plone site root object, providing the `plone.restapi.interfaces.IExternalLoginProviders` interface. | ||
|
||
In the adapter, the add-on needs to return the list of external links and some metadata, including the `id`, `title`, and name of the `plugin`. | ||
|
||
An example adapter would be the following, in a file named {file}`adapter.py`: | ||
|
||
```python | ||
from zope.component import adapter | ||
from zope.interface import implementer | ||
|
||
@adapter(IPloneSiteRoot) | ||
@implementer(IExternalLoginProviders) | ||
class MyExternalLinks: | ||
def __init__(self, context): | ||
self.context = context | ||
|
||
def get_providers(self): | ||
return [ | ||
{ | ||
"id": "myprovider", | ||
"title": "Provider", | ||
"plugin": "pas.plugins.authomatic", | ||
"url": "https://some.example.com/login-url", | ||
}, | ||
{ | ||
"id": "github", | ||
"title": "GitHub", | ||
"plugin": "pas.plugins.authomatic", | ||
"url": "https://some.example.com/login-authomatic/github", | ||
}, | ||
] | ||
``` | ||
|
||
With the corresponding ZCML stanza, in the corresponding {file}`configure.zcml` file: | ||
|
||
```xml | ||
<adapter factory=".adapter.MyExternalLinks" name="my-external-links"/> | ||
``` | ||
|
||
The API request would be as follows: | ||
|
||
```{eval-rst} | ||
.. http:example:: curl httpie python-requests | ||
:request: ../../../src/plone/restapi/tests/http-examples/external_authentication_links.req | ||
``` | ||
|
||
The server will respond with a `Status 200` and the list of external providers: | ||
|
||
```{literalinclude} ../../../src/plone/restapi/tests/http-examples/external_authentication_links.resp | ||
:language: http | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add a `@userschema/registration` endpoint to get the fields for the registration form. @erral |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,11 @@ | ||
[buildout] | ||
extends = | ||
https://dist.plone.org/release/6.0.12/versions.cfg | ||
https://dist.plone.org/release/6.0.14/versions.cfg | ||
base.cfg | ||
|
||
[buildout:python37] | ||
parts = | ||
test | ||
code-analysis | ||
|
||
[instance] | ||
recipe = plone.recipe.zope2instance | ||
zodb-temporary-storage = off | ||
|
||
[versions] | ||
# Override pin from Zope. https://github.com/zopefoundation/Zope/issues/1220 | ||
docutils = 0.21.2 | ||
pygments = 2.14.0 | ||
plone.app.linkintegrity = 4.0.3 | ||
robotframework-browser = 17.5.2 | ||
robotframework-assertion-engine = 2.0.0 | ||
robotframework-debuglibrary = 2.3.0 | ||
robotframework-pythonlibcore = 4.2.0 | ||
grpcio-tools = 1.59.0 | ||
twine = 5.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,10 @@ | ||
[buildout] | ||
extends = | ||
https://dist.plone.org/release/6.1.0a3/versions.cfg | ||
https://dist.plone.org/release/6.1.0b2/versions.cfg | ||
base.cfg | ||
|
||
[buildout:python37] | ||
parts = | ||
test | ||
code-analysis | ||
|
||
[instance] | ||
recipe = plone.recipe.zope2instance | ||
zodb-temporary-storage = off | ||
|
||
[versions] | ||
# Override pin from Zope. https://github.com/zopefoundation/Zope/issues/1220 | ||
docutils = 0.21.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
-r https://dist.plone.org/release/6.0.12/requirements.txt | ||
-r https://dist.plone.org/release/6.0.14/requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
-r https://dist.plone.org/release/6.1.0a3/requirements.txt | ||
-r https://dist.plone.org/release/6.1.0b2/requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.