Skip to content
  • Alex Kalderimis's avatar
    Require 'api' scope to execute mutations · 5abab245
    Alex Kalderimis authored
    Verify that read_api tokens cannot run mutations.
    
    Also: adds tests use of OAuth tokens for GraphQL
    
    We make some changes to the sessionless_authentication module
    in order to capture the request_authenticator, so that we can access
    the token scopes, without making any extra queries.
    
    We ensure we always authorize the mutation, which, like all resolvers,
    needs to opt in to the check.
    
    Unlike resolvers, mutations should always raise. So
    `BaseMutation.authorized?` raises on failure.
    
    Logic for handling scopes is pushed down to the `ObjectAuthorization`
    class, and encapsulated in the `ScopeValidator`, which limits the
    methods that can be called by resolvers.
    5abab245