summaryrefslogtreecommitdiff
path: root/spec/services/access_token_validation_service_spec.rb
Commit message (Collapse)AuthorAgeFilesLines
* Convert AccessTokenValidationService into a class.Timothy Andrew2016-12-161-7/+7
| | | | | | | | | | - Previously, AccessTokenValidationService was a module, and all its public methods accepted a token. It makes sense to convert it to a class which accepts a token during initialization. - Also rename the `sufficient_scope?` method to `include_any_scope?` - Based on feedback from @rymai
* Implement minor changes from @dbalexandre's review.Timothy Andrew2016-12-161-1/+0
| | | | | | | | | | | - Mainly whitespace changes. - Require the migration adding the `scope` column to the `personal_access_tokens` table to have downtime, since API calls will fail if the new code is in place, but the migration hasn't run. - Minor refactoring - load `@scopes` in a `before_action`, since we're doing it in three different places.
* Calls to the API are checked for scope.Timothy Andrew2016-12-161-0/+42
- Move the `Oauth2::AccessTokenValidationService` class to `AccessTokenValidationService`, since it is now being used for personal access token validation as well. - Each API endpoint declares the scopes it accepts (if any). Currently, the top level API module declares the `api` scope, and the `Users` API module declares the `read_user` scope (for GET requests). - Move the `find_user_by_private_token` from the API `Helpers` module to the `APIGuard` module, to avoid littering `Helpers` with more auth-related methods to support `find_user_by_private_token`