Age | Commit message (Expand) | Author |
2023-07-03 | Enable deletion of OAuth2 clients. | Frederick Muriuki Muriithi |
2023-06-30 | List all OAuth2 clients. | Frederick Muriuki Muriithi |
2023-05-30 | auth: Change check for client secret...We are saving the client secret in an encrypted form, meaning we have to
verify that the CLIENT_SECRET that is provided is the same one as was
generated at registration in a different way.
Initially, I was doing a direct comparison, having saved the CLIENT_SECRET
value as unencrypted plain-text.
| Frederick Muriuki Muriithi |
2023-05-29 | auth: Enable registration of OAuth2 clients...Add UI and code to enable the administrative user to register new OAuth2
clients that can access the API server.
| Frederick Muriuki Muriithi |
2023-05-29 | Enable Administrator login on GN3...* gn3/auth/authentication/oauth2/views.py: Remove endpoint
* gn3/auth/authorisation/users/admin/__init__.py: New admin module
* gn3/auth/authorisation/users/admin/ui.py: New admin module
* gn3/auth/authorisation/users/admin/views.py: New admin module
* gn3/auth/views.py: Use new admin module
* gn3/errors.py: Fix linting errors
* gn3/templates/login.html: New html template
* main.py: Fix linting errors
| Frederick Muriuki Muriithi |
2023-05-27 | Document Use of OAuth2 Clients...* docs/authentication_and_authorisation/oauth2_clients.md: New documentation
* gn3/auth/authentication/oauth2/server.py: Raise appropriate error if no
client is found.
* gn3/auth/authentication/oauth2/views.py: Handle exception in the case where
a UI should be presented to the user, rather than presenting the raw JSON
response to the user.
* gn3/errors.py: Handle any authlib OAuth2Error at the application's top-level
* gn3/templates/oauth2/oauth2_error.html: Handle any authlib OAuth2Error at
the application's top-level
| Frederick Muriuki Muriithi |
2023-05-10 | auth: Only check deliverability of emails at registration....Check only that the email format is correct, but don't bother with the
deliverability check during authentication. The deliverability check is done
at registration.
| Frederick Muriuki Muriithi |
2023-05-09 | auth: Implement "Authorization Code Flow"...Implement the "Authorization Code Flow" for the authentication of users.
* gn3/auth/authentication/oauth2/grants/authorisation_code_grant.py: query and
save the authorisation code.
* gn3/auth/authentication/oauth2/models/authorization_code.py: Implement the
`AuthorisationCode` model
* gn3/auth/authentication/oauth2/models/oauth2client.py: Fix typo
* gn3/auth/authentication/oauth2/server.py: Register the
`AuthorisationCodeGrant` grant with the server.
* gn3/auth/authentication/oauth2/views.py: Implement `/authorise` endpoint
* gn3/templates/base.html: New HTML Templates of authorisation UI
* gn3/templates/common-macros.html: New HTML Templates of authorisation UI
* gn3/templates/oauth2/authorise-user.html: New HTML Templates of
authorisation UI
* main.py: Allow both "code" and "token" response types.
auth/implement-authorization-code-flow | Frederick Muriuki Muriithi |
2023-03-23 | auth: Don't try loading the user if no client is found...Fix the bug where the system was trying to load a user from a non-existing
OAuth2 client, leading to an exception.
| Frederick Muriuki Muriithi |
2023-03-13 | auth: separate user detail migration from data migration...Due to the fact that the data migration requires higher privileges than the
user details, separate the user details migration endpoint from the data
migrations endpoint.
| Frederick Muriuki Muriithi |
2023-03-09 | auth: introspection: Protect introspection endpoint...The introspection endpoint could contain privileged information, thus requires
that the endpoint be protected. This commit ensures that a user has
authenticated to the system and that the client they are using be one of the
allowed clients.
| Frederick Muriuki Muriithi |
2023-03-08 | auth: users: Use the same basic functions for password hashing...To avoid repeating the same thing in multiple places, leading to errors and
breakages, reuse the same basic functions for password hashing.
| Frederick Muriuki Muriithi |
2023-03-08 | Replace Bcrypt with Argon2 for better security....Bcrypt is now somewhat vulnerable to offline cracking, so we move our password
hashing over to Argon2.
| Frederick Muriuki Muriithi |
2023-03-07 | auth: user_by_id: Return a user or raise an exception...Fetching the user by id should return the user, or raise an exception. We get
rid of the Maybe monad here since it is leading to some weird code flows -
probably the wrong monad to use here.
| Frederick Muriuki Muriithi |
2023-03-06 | auth: resources: Enable assigning a user roles on resources | Frederick Muriuki Muriithi |
2023-02-08 | auth: groups: handle join requests. | Frederick Muriuki Muriithi |
2023-02-02 | auth: Reorganise modules/packages for easier dev and maintenance...Split the views/routes into separate modules each dealing with a narrower
scope of the application to aid in maintenance, and help with making the
development easier.
| Frederick Muriuki Muriithi |
2023-01-31 | auth: Remove the @authenticated_p decorator...The @authenticated_p decorator (and function), is an artifact of the original
development ideas and should be removed from use.
| Frederick Muriuki Muriithi |
2023-01-31 | auth: Set the token scope as a string, not a list...Setting the scope as a list of strings was leading to errors when attempting
to logout. This commit leaves the scope as a string to avoid the errors.
| Frederick Muriuki Muriithi |
2023-01-28 | auth: rework dictify...Define a Protocol type to use with the `dictify` function and implement the
`dictify` methods for the various classes.
| Frederick Muriuki Muriithi |
2023-01-21 | auth: Fix saving of scope values. Add scope items. | Frederick Muriuki Muriithi |
2023-01-20 | mypy: minor fixes to typing errors | Frederick Muriuki Muriithi |
2023-01-20 | auth: rename revocation endpoint | Frederick Muriuki Muriithi |
2023-01-20 | auth: Save token with update...If the token already exists, then update the details rather than trying to
insert.
| Frederick Muriuki Muriithi |
2023-01-20 | auth: Setup the user correctly...* gn3/auth/authentication/oauth2/grants/password_grant.py: Return user rather
than boolean
* gn3/auth/authentication/oauth2/models/oauth2client.py: provide optional
`user` argument to allow flexibility in setting up the client's user
* gn3/auth/authentication/oauth2/models/oauth2token.py: Set token and client
user correctly
* gn3/auth/authentication/oauth2/server.py: Set token user from the request
| Frederick Muriuki Muriithi |
2023-01-20 | auth: Add development utils/tools...To avoid having to manually rebuild some default data for exploration of
concepts while developing the system, add a way to build up the test users and
oauth2 clients to use for testing.
| Frederick Muriuki Muriithi |
2023-01-11 | auth: Add missing import | Frederick Muriuki Muriithi |
2023-01-05 | auth: Persist the user's registration details...If the registration details pass the validations steps, then persist the
details in the database and respond with details about the newly created user.
* gn3/auth/authentication/users.py: new functions
* `save_user`: create and persist a new user
* `set_user_password`: hash and persist the new password for the given user
* gn3/auth/authorisation/views.py: Persist the user details and respond with
the newly persisted user details.
| Frederick Muriuki Muriithi |
2023-01-04 | auth: Add `/register-user` endpoint...* gn3/app.py: register top-level error handlers. reorganise oauth2 blueprint.
* gn3/auth/__init__.py: reorganise oaut2 blueprint.
* gn3/auth/authentication/oauth2/views.py: reorganise oauth2 blueprint.
* gn3/auth/authorisation/exceptions.py -> gn3/auth/authorisation/errors.py
* gn3/auth/authorisation/groups.py: rename file/module
* gn3/auth/authorisation/resources.py: rename file/module
* gn3/auth/authorisation/views.py: Add `/register-user` endpoint
* gn3/auth/blueprint.py: reorganise oauth2 blueprint.
* gn3/errors.py: register top-level error handlers.
| Frederick Muriuki Muriithi |
2023-01-04 | auth: return group info as part of user details...* gn3/app.py: import blueprint from authorisation views inorder to get all
endpoints
* gn3/auth/authentication/oauth2/views.py: remove the `/user` endpoint
* gn3/auth/authorisation/views.py: add the `/user` endpoint and add the group
information to the user details.
| Frederick Muriuki Muriithi |
2023-01-03 | auth: Fetch all of a user's roles....* gn3/auth/authorisation/roles.py: Fetch roles from DB
* gn3/auth/authorisation/views.py: Provide API endpoint for user roles
* tests/unit/auth/test_roles.py: Tests to check fetching roles works correctly
Fix linting and typing issues in the following files:
* gn3/auth/authentication/oauth2/resource_server.py
* gn3/auth/authentication/oauth2/views.py
* tests/unit/auth/fixtures/oauth2_client_fixtures.py
| Frederick Muriuki Muriithi |
2022-12-28 | auth: Add resource server and /user endpoint...Add a resource server with the validator for the bearer token to protect the
resources endpoints.
Add a protected `/user` endpoint that returns the user details for valid
tokens.
* gn3/auth/authentication/oauth2/resource_server.py: new file
* gn3/auth/authentication/oauth2/views.py: add /user endpoint
| Frederick Muriuki Muriithi |
2022-12-22 | auth: implement OAuth2 flow....Add code to implement the OAuth2 flow.
* Add test fixtures for setting up users and OAuth2 clients
* Add tests for token generation with the "Password Grant" flow
* Fix some issues with test due to changes in the database connection's
row_factory
oauth2_auth_flow | Frederick Muriuki Muriithi |
2022-12-21 | auth: oauth2: users: Add expected property...* gn3/auth/authentication/users.py: authlib expects the user object to have a
`get_user_id` method.
| Frederick Muriuki Muriithi |
2022-12-21 | Enable authentication...* gn3/auth/authentication/routes.py: Add `/login` endpoint and a function to
validate the login credentials.
* gn3/auth/authentication/users.py: add function to fetch user details by
email
| Frederick Muriuki Muriithi |
2022-11-24 | auth: Implement `create_resource` function...* gn3/auth/authentication/checks.py: new `authenticated_p` decorator to apply
on any function that requires the user to be authenticated before it runs.
* gn3/auth/authorisation/checks.py: use a `auth.authentication.users.User`
object rather than a UUID object in the global `g`.
* gn3/auth/authorisation/groups.py: Implement the `authenticated_user_group`
function to get the group(s) in which the currently authenticated user
belongs.
* gn3/auth/authorisation/resources.py: Implement the `create_resource`
function correctly.
* tests/unit/auth/conftest.py: extract the User objects into a global variable
for reusability with the tests.
* tests/unit/auth/test_resources.py: Use global user objects from conftest in
the tests. Set a User object (rather than UUID) in the global `g` variable.
| Frederick Muriuki Muriithi |
2022-11-24 | auth: Define base exceptions...* gn3/auth/authentication/exceptions.py: define `AuthenticationError`
* gn3/auth/authorisation/exceptions.py: define `AuthorisationError`
| Frederick Muriuki Muriithi |
2022-11-17 | auth: Define the `User` type...* gn3/auth/authentication.py -> gn3/auth/authentication/__init__.py: Convert
module to package
* gn3/auth/authentication/users.py: Define the `User` type
| Frederick Muriuki Muriithi |
2022-11-03 | Add credentials checking...* gn3/auth/authentication.py: new function `credentials_in_database`
* gn3/auth/authentication/__init__.py: replace package with module
* gn3/settings.py: new `AUTH_MIGRATIONS` configuration variable
* migrations/auth/20221103_02_sGrIs-create-user-credentials-table.py: new
migration
* tests/unit/auth/test_credentials.py: test the `credentials_in_database`
function
* tests/unit/conftest.py: more test fixtures
| Frederick Muriuki Muriithi |
2022-11-03 | Initialise the Auth(entic|oris)ation packages...Initialise the authentication/authorisation system packages and set up the
initial database migrations to set up the system.
* README.md: Add documentation on migrations
* gn3/auth/__init__.py: init package
* gn3/auth/authentication/__init__.py: init package
* gn3/auth/authorisation/__init__.py: init package
* gn3/migrations.py: provide migration utilities
* migrations/auth/20221103_01_js9ub-initialise-the-auth-entic-oris-ation-database.py:
new migration
* tests/unit/auth/test_init_database.py: test new migration applies and rolls
back as expected
* tests/unit/conftest.py: fixtures for unit tests
* yoyo.auth.ini: basic configuration for yoyo-migration for auth system
migrations
| Frederick Muriuki Muriithi |