9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/authentic_jwt/grape/middleware.rb', line 9
def before
return unless scope
raise Unauthorized, "JWT public key not present" unless public_key
raise Unauthorized, "Authorization header not present" unless
raise Unauthorized, "Bearer token not present" unless bearer_token
raise Unauthorized, "JWT payload not present" unless jwt_payload
context.extend(AuthMethods)
context.jwt_payload = jwt_payload
return unless account_id
raise Forbidden, "Account has no role" unless account_roles.any?
raise Forbidden, "Account role is too low" unless (acceptable_roles & account_roles).any?
end
|