stable
Clone or download
An expired access token cannot be used to access a resource. To test you need to create an access token with the required scope: mysql > INSERT INTO oauth2_access_token (user_id, verifier, expiration_date) VALUES(<user_id>, SHA2('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 256), <wanted_expiration_timestamp>); mysql > INSERT INTO oauth2_access_token_scope (access_token_id, scope_key) VALUES(<token_autogenerated_id>, 'demo'); shell > curl \ -H 'Authorization: Bearer tlp-oauth2-at1-<token_autogenerated_id>.6161616161616161616161616161616161616161616161616161616161616161' \ https://tuleap.example.com/plugins/oauth2_server/testendpoint The cleanup of the DB from those expired data will be dealt with in a independent contribution once the whole OAuth2 flow is in place as there are other values with an expiration date that will need also to removed at regular intervals. This is part of story #14542: have OAuth2 flow Change-Id: I9f28cd261051e71010fc27b11e175f5342c61c53
Modified Files
Name | ||||
---|---|---|---|---|
M | src/common/User/OAuth2/AccessToken/OAuth2AccessTokenDAO.php | +2 | −2 | Go to diff View file |
A | src/common/User/OAuth2/AccessToken/OAuth2AccessTokenExpiredException.php | +34 | −0 | Go to diff View file |
M | src/common/User/OAuth2/AccessToken/OAuth2AccessTokenVerifier.php | +15 | −2 | Go to diff View file |
M | src/common/User/OAuth2/ResourceServer/OAuth2ResourceServerMiddleware.php | +7 | −0 | Go to diff View file |
M | src/db/mysql/database_structure.sql | +3 | −2 | Go to diff View file |
A | src/db/mysql/updates/2020/202002191745_add_expiration_date_on_oauth2_access_token.php | +60 | −0 | Go to diff View file |
M | tests/phpunit/common/User/OAuth2/AccessToken/OAuth2AccessTokenVerifierTest.php | +36 | −3 | Go to diff View file |
M | tests/phpunit/common/User/OAuth2/ResourceServer/OAuth2ResourceServerMiddlewareTest.php | +28 | −0 | Go to diff View file |