plone.restapi icon indicating copy to clipboard operation
plone.restapi copied to clipboard

add new @login endpoint to return available external login options

Open erral opened this issue 1 year ago • 15 comments

This PR adds a generic GET /@login endpoint that would expose links to additional login providers in a Plone site.

This way the endpoints added in packages like pas.plugins.authomatic and pas.plugins.oidc could be exchanged with adapter registrations and allow both products to be installed in the same Plone site for its use.

I am open to discuss whether the adapter needs to adapt just the IPloneSiteRoot object or perhaps may be a multiadapter including the request (perhaps to register the adapter for a given IThemeSpecific interface) or any other things.

erral avatar Feb 28 '24 19:02 erral

@erral thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

mister-roboto avatar Feb 28 '24 19:02 mister-roboto

Deploy Preview for plone-restapi canceled.

Name Link
Latest commit f52a73d453a88d8a727c56a6c226ed820d5079ef
Latest deploy log https://app.netlify.com/sites/plone-restapi/deploys/65f4b29ed1a9c2000846c1d8

netlify[bot] avatar Feb 28 '24 19:02 netlify[bot]

@jenkins-plone-org please run jobs

erral avatar Feb 28 '24 19:02 erral

This needs tests and documentation, similar to other endpoints. https://6.docs.plone.org/plone.restapi/docs/source/endpoints/index.html

Yes, I am preparing that.

erral avatar Feb 29 '24 09:02 erral

@jenkins-plone-org please run jobs

erral avatar Mar 01 '24 08:03 erral

I decided it would be faster, easier, and less frustrating to make the changes directly instead of a proper review. I hope that is OK.

Thanks! :heart:

erral avatar Mar 01 '24 09:03 erral

I am investigating why the output for the documentation is empty.

erral avatar Mar 01 '24 11:03 erral

@erral what output? The preview looks good: https://deploy-preview-1757--plone-restapi.netlify.app/endpoints/login.html

stevepiercy avatar Mar 01 '24 11:03 stevepiercy

@stevepiercy the last output, this one:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "options": []
}

That should not be empty :/

erral avatar Mar 01 '24 12:03 erral

It's not an issue with the docs, because the docs only pull from this file:

https://github.com/plone/plone.restapi/blob/erral-login-options/src/plone/restapi/tests/http-examples/external_authentication_links.resp

Can you show what the content of that file should be?

stevepiercy avatar Mar 01 '24 13:03 stevepiercy

It's not an issue with the docs, because the docs only pull from this file:

https://github.com/plone/plone.restapi/blob/erral-login-options/src/plone/restapi/tests/http-examples/external_authentication_links.resp

Can you show what the content of that file should be?

I have already fixed this. There was a bug in my code :smiling_imp:

erral avatar Mar 03 '24 18:03 erral

@jenkins-plone-org please run jobs

erral avatar Mar 03 '24 19:03 erral

@jenkins-plone-org please run jobs

erral avatar Mar 12 '24 12:03 erral