Skip to content
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

[RFC] J 4.0 REST API use and constraints #32376

Closed
sakiss opened this issue Feb 10, 2021 · 3 comments
Closed

[RFC] J 4.0 REST API use and constraints #32376

sakiss opened this issue Feb 10, 2021 · 3 comments
Labels
No Code Attached Yet RFC Request for Comment

Comments

@sakiss
Copy link
Contributor

sakiss commented Feb 10, 2021

The REST API seems to be a step forward towards the direction, that things move on these days.
Words like headless CMSs and Microservices are all over the place for developers.
That said, i am trying to clarify the usefulness of the Joomla REST API, given it's features and shortages.

My purpose is to find out it's usefulness in real case scenarios.

Problem identified

Seems like there are no roles and permissions that can be set for the Joomla resources.
The above lead to the following requirements:

  1. A valid token needs to be used for every request, even if public resources are requested (e.g. public articles).
  2. The token can be generated only for super users.
  3. Any authentication mechanism is missing in the API (e.g. JWT generation).

Open questions

Taking the the above into consideration, seems like the super user's token needs to be exposed in the public, if we intent to consume the API directly from a public app.
Given that this is a big NO, the alternative is to consume the Joomla API internally (e.g. from a node js app).
But this has it's own shortages since, no authentication mechanism exists in the Joomla API, forfeiting one of the most powerful features of the CMS, it's ACL functionality.

I am really interested to know, the usefulness of the API and how the above constraints can be overcome.

@sakiss sakiss changed the title [RFC] J 4.0 REST API use [RFC] J 4.0 REST API use and constraints Feb 10, 2021
@Quy
Copy link
Contributor

Quy commented Feb 10, 2021

Please add your comment here #27569. Thanks.

@Quy Quy closed this as completed Feb 10, 2021
@sakiss
Copy link
Contributor Author

sakiss commented Feb 10, 2021

For anyone coming here.
At the moment of writing that, the state of the API seems to be far from beta and many things (including decisions) are pending.
Hence any evaluation is pointless.

@wilsonge
Copy link
Contributor

Taking the the above into consideration, seems like the super user's token needs to be exposed in the public, if we intent to consume the API directly from a public app.

Well first of all the API endpoints for the application would need to be designed. Any user API should only be revealing the data that it expects to see (for example an app that recieves a category id of 1 for uncategorized because that site doesn't use the category system is pointless).

As a result core can only develop for administration functionality and the idea for the application to interact with itself. So the Authentication has been designed around that. For more information in the approach please read #27021

Given that this is a big NO, the alternative is to consume the Joomla API internally (e.g. from a node js app).
But this has it's own shortages since, no authentication mechanism exists in the Joomla API, forfeiting one of the most powerful features of the CMS, it's ACL functionality.

You would need to build some sort of API Authentication plugin using an appropriate oAuth mechanism.

Alternatively if your content is designed to just outright be public (e.g. blog posts in your app) you can just use the public flag in your webservice plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No Code Attached Yet RFC Request for Comment
Projects
None yet
Development

No branches or pull requests

4 participants