-
Notifications
You must be signed in to change notification settings - Fork 20
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
Employment application requires Django login #2074
Comments
[#2074] Remove Django auth for requesting to join an organisation
This does not seem to work right. Looks like access is checked against anonymous user when not logged into Django; the API key is never checked. |
Interestingly, in project_update.py, for POST, there is a @permission_classes((IsAuthenticated, )) and that endpoint works from Up. Maybe some of the API key logic I just committed could be used there, too. |
…ent for Up Adding the @authentication_classes decorator sets request.user to the owner of the auth token, thus we can compare request.user with the user supplied by the PK.
I think we should review the @api_view(['POST']) endpoints, and add the @authentication_classes decorator to eliminate unauthenticated access. I think the enpoints used by Up should have If I understand correctly, valid authentication sets request.user to the authenticated user, as seen in the commit above, so it becomes very easy to know who's calling. But that brings me to wonder if the PK of the user is needed? |
How are the authentication classes combined? With OR or AND? |
I think they are tested against in order until you're either authenticated or out of methods. |
Add SessionAuthentication to the request_organisation() endpoint authentication_classes decorator.
…auth [#2074] User employment application auth
Adding a TODO that the response should be HTTP 201 Created, but I'm not adding the actual code since it seems to break the usage of the view in myRSR.
Test plan
GIVEN the
/rest/v1/user/../request_organisation/
endpointWHEN POSTing a request from outside of RSR
AND the correct authentication details are provided
THEN the request should be process accordingly, instead trying to authenticate through Django's auth system
Issue description
Just as for #2037, when posting a request for employment to the /rest/v1/user/request_organisation/ endpoint, a Django login is required, which is not the case for the rest of the API; an API key should be sufficient.
The text was updated successfully, but these errors were encountered: