-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Feat/OSM login enforced for management, additional temp login option for mappers #1948
Feat/OSM login enforced for management, additional temp login option for mappers #1948
Conversation
β¦login option for mappers hotosm#1911
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't been able to test yet, but just reviewing the code this looks good!
@Anuj-Gupta4 this is causing an issue: when I refresh the page on the management frontend (i.e. call the /refresh endpoint), my cookies seem to be cleared and I am no longer logged in. The cookie needs to be refreshed correctly on the /refresh call, meaning the user is still logged in π |
Of course - the frontend also needs to be updated to match these new endpoints! |
Ignore the above - this works nicely for the management frontend π Need to test on the mapper frontend too, but I think this is all good! |
OK so this mostly works, but temp login seems to fail for some reason on the mapper frontend |
The project detail endpoint currently checks for mapper role in react frontend and same endpoint is used in the mapper frontend where it only checks for osm login in the login required. I think we might need a separate project endpoint in the mapper frontend with only the minimal required details of the project; I don't think we will require everything like in the project of the react frontend. The project details page of react frontend might require project mapper role not a global mapper, we can change this as per requirements. In the mapper frontend we will check only login and the token validation. Use login_required as dependency, handle both type of cookies in login required. To make it simpler, frontend needs to remove temporary cookie if i switch back to react frontend. Then we will get whatever cookies is stored in both frontend and test its validation. |
Great observations! There is already some commented out code for a simpler dbproject query here: https://github.com/hotosm/fmtm/blob/development/src%2Fbackend%2Fapp%2Fdb%2Fmodels.py#L1109 We could add a The temp login does has issues with our access model, as this new endpoint can be accessed by anyone, meaning anyone can contribute. But I think its fine for now - a problem to solve later! (We might have to reconsider temp login) |
The endpoint could be /projects/1/mapper-data and will use the |
I don't find any significance of temp login at all. Its purpose is to allow anyone to contribute to the project; for that, we don't even need a login just for field submissions. Task locking and updating status will all require osm login. This temp login does have an issue with our access model, so creating an endpoint with minimal details will not leak any sensitive data. We can consider it for now. And, about removing cookies when I redirect to the react frontend, it might create a requirement to login every time I go to mapper frontend. What do you think? @spwoodcock |
Good points! So in theory I'm hoping it might reduce bots / spamming / scraping endpoints as it requires a login of some sorts, before anything else can be accessed. It's not essential though! We considered it previous as we had everyone on one frontend, all using the same endpoints. We could actually remove it entirely with this scenario:
Would that work? |
This all said, for now we rely on endpoints to update task/entity statuses - it will be removed in the future, but is a requirement for now. If we had no login at all, it would mean we have to update the access on all those endpoints too, or create separate 'mapper' endpoints π€ |
The idea you proposed above could work well: Mapper:
Management:
|
Yeah that could work for now. π |
What type of PR is this? (check all applicable)
Related Issue
Describe this PR