canonical / testflinger

https://testflinger.readthedocs.io/en/latest/
GNU General Public License v3.0
11 stars 17 forks source link

Add logic to validate token and check priority permissions #361

Open val500 opened 1 week ago

val500 commented 1 week ago

Description

Requires #335. This PR updates the job schema include a new job_priority field. In order for a job to specify a job_priority, the client needs to include a signed JWT that gives them the permission to push a job to the specified queue at their specified priority level. This PR includes validation of the attached JWT with jobs that specify priority. After token validation, job priority is added to the job structure in the database.

Resolved issues

Resolves https://warthogs.atlassian.net/browse/CERTTF-371

Documentation

Job schema docs were updated to reflect addition of job_priority field.

Web service API changes

POST /v1/job endpoint updated to include token validation

Tests

Unit tests were added to test_v1.py.