Commit Graph

25 Commits

Author SHA1 Message Date
Leo Hemsted
adbe02783d refactor authentication code
moved api_key secret manipulation (generating and getting) into
authentiation/utils, and added a property on the model, to facilitate
easier matching of authenticated requests and the api keys they used
2016-06-30 10:44:21 +01:00
Leo Hemsted
e9482c7fe1 add new key_type table
* single-column static data table that currently contains two types: 'normal' and 'team'
* key_type foreign-keyed from api_keys
  - must be not null
  - existing rows set to 'normal'
* key_type foreign-keyed from notifications
  - nullable
  - existing rows set to null
* api_key foreign-keyed from notifications
  - nullable
  - existing rows set to null
2016-06-24 15:56:54 +01:00
Rebecca Law
acee87fc63 Refactor the api_key_dao.
The only update we should be doing to an api key is to expire/revoke the api key.
Removed the update_dict from the the save method.
Added an expire_api_key method that only updates the api key with an expiry date.
2016-06-22 15:27:28 +01:00
Rebecca Law
40fa394226 Update auth module to return consistently formed error messages.
We are trying to get all the error messages to return in the following format:
{result: error,
 message: ['what caused error': 'reason for error']
}
2016-06-17 14:22:58 +01:00
Nicholas Staples
03f15d6af9 Update now to utcnow. All tests passing. 2016-05-11 10:56:24 +01:00
Rebecca Law
b53fdf1f3f Update python client to version 1.0.0.
This version of the client removed the request method, path and body from the encode and decode methods.
The biggest changes here is to the unit tests.
2016-05-04 16:08:23 +01:00
Rebecca Law
11c4696775 Update to test as per review comments.
However, I am curious if there is evidence that using fake_uuid over creating one in the test is actually faster.
2016-04-29 14:36:10 +01:00
Rebecca Law
8c14b5a8ab This pull request fixes a bug in authentication.
If the service does not have any api keys, there would be an error but it was not formed well.
2016-04-29 10:24:02 +01:00
Nicholas Staples
b56e324a4c Working tests and provider stats table.
Fix for tests and import error.

Added tests and updated for code review comments.
2016-04-25 12:20:06 +01:00
Adam Shimali
74ac5b5f30 Added version history to api keys. This needed a bit of change
to create history to handle foreign keys better. There may yet
be a better way of doing this that I have not found yet in sqlalchemy
docs.
2016-04-21 14:47:58 +01:00
Rebecca Law
c9761cd58a remove unused import 2016-04-15 10:59:00 +01:00
Rebecca Law
282a62e636 Use the new version of the notifications-python-client. This version no longer adds the req and pay to the claims of the jwt.
The change is backward compatible so an older client that sends a jwt with the extra claims will pass authentication.
Once all the clients have been updated to not include the extra claims some updates to exclude them from the method signatures will happen as well.
2016-04-14 18:12:33 +01:00
Nicholas Staples
90f0505a3d Update limit to message_limit.
Further db changes and updates.

Remove traceback print out.

Fix bug in passing template id to a task.
2016-04-11 16:53:40 +01:00
Rebecca Law
fe9bf13064 Format authentication error messages for the client. 2016-03-14 15:51:04 +00:00
Martyn Inglis
dc294c32ae Fix all other dependant classes that are affected by the DAO / Service / Model changes 2016-02-19 15:54:11 +00:00
Martyn Inglis
d38ba0d36a bumped client version 2016-02-09 18:48:02 +00:00
Rebecca Law
416dd00ac8 Added a test for the case when there is no secret for the api client.
Fix codestyle
2016-02-08 11:33:24 +00:00
Rebecca Law
b5c662eca8 Change services.id to a UUID
Ideally all the primary keys in the db would be UUID in order to guarantee unique ids across distributed dbs.
This updates the services.id to a UUID. All the tables with a foreign key to the services.id are also updated.
The endpoints no longer state a data type of the <service_id> path param.
All the tests are updated to reflect this update.

The thing to pay attention to is the 0011_uuid_service_id.py migration script.
This commit must go with a commit on the notifications_admin app to keep things working.
There will be a small outage until both deploys have happened.
2016-02-02 14:22:22 +00:00
Rebecca Law
8fa1cac1c6 Fix the user url.
Add test for authentication to test paths with path params
2016-01-22 09:59:02 +00:00
Rebecca Law
27a381c3e9 Allow services to have multiple api keys.
/service/<service_id>/api-key/renew has been renamed to /service/<service_id>/api-key
/service/<service_id>/api-key now creates a token and no longer expires the existing api key.
Moved test for this endpoint to it's own file.
2016-01-20 10:57:46 +00:00
Rebecca Law
1db57dca8c Allow for multiple api keys for a service. 2016-01-19 18:25:21 +00:00
Martyn Inglis
fa30782d70 Removed Status endpoints from requiring Auth tokens
- auth tests now use service endpoints

- one test commented out and needs reworked
2016-01-19 15:32:33 +00:00
Rebecca Law
4fc5c34320 Change Tokens to ApiKey
Added name to ApiKey model
2016-01-19 12:13:47 +00:00
Rebecca Law
0ad292300d Added authorization headers for all requests 2016-01-15 17:02:29 +00:00
Rebecca Law
5f59b631e1 Added the before_request so that all calls must have a valid token.
Next is to get all the rest tests to pass again.
2016-01-15 17:01:26 +00:00