Add JWT support for FL workflow
As per the new authentication workflow in https://github.com/OpenMined/PyGrid/issues/445, we need to allow PyGrid's FL workflow to be extended via some sort of oAuth 2.0 token check.
In short, the following will need to happen:
Situation 1 - no auth required
- The worker sends a request to be assigned a
worker_id - PyGrid checks for the existence of an oAuth setup and finds nothing
- Continue to Condition - success
Situation 2 - auth required
- The worker sends a request to be assigned a
worker_idand also passes an authentication token (in the request payload:auth_token) - PyGrid checks for the existence of an oAuth setup and finds one
- PyGrid passes the value from
auth_tokento a method on the oAuth setup for validation of authentication tokens a. Assuming the token is valid, continue to Condition - success b. Assuming the token is invalid, continue to Condition - invalid
Situation 3 - auth required, no token
- The worker sends a request to be assigned a
worker_idand DOES NOT pass an authentication token - PyGrid checks for the existence of an oAuth setup and finds one
- Continue to Condition - not found
Condition - success
Create a worker_id and send it back to the worker that made the authentication request
Condition - invalid
Do not create a worker_id and inform the user of their mistake (see issue #445)
Condition - not found
Do not create a worker_id and inform the user of their mistake (see issue #445)
As for how this oAuth middleware should work is open to discussion. Quite frankly I don't have a ton of experience here, so I'll be relying on the wisdom of others. We simply need to extend PyGrid to have some way of validating authentication tokens that are passed by a worker and correspond to some specified third-party oAuth service.
I'll get this one! :)
@IonesioJunior I'm going to get @Prtfw to work on this one.
issue for tests: https://github.com/OpenMined/PyGrid/issues/541 (currently in progress)
I'm going to close this since we're only testing now.