Class: SimpleJwtAuth::Middleware::Grape::Authorisation

Inherits:
Grape::Middleware::Base
  • Object
show all
Defined in:
lib/simple_jwt_auth/middleware/grape/authorisation.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, options = nil) ⇒ Authorisation

Returns a new instance of Authorisation.



7
8
9
# File 'lib/simple_jwt_auth/middleware/grape/authorisation.rb', line 7

def initialize(app, options = nil)
  super(app, **(options || {}))
end

Instance Method Details

#beforeObject



11
12
13
14
15
16
# File 'lib/simple_jwt_auth/middleware/grape/authorisation.rb', line 11

def before
  return if test_env? || consumer_authorised?

  raise SimpleJwtAuth::Errors::Forbidden,
        "access to endpoint forbidden for issuer `#{current_issuer}`"
end