Class: Rack::Jwt::Auth::Authenticate
- Inherits:
-
Object
- Object
- Rack::Jwt::Auth::Authenticate
- Defined in:
- lib/rack/jwt/auth/authenticate.rb
Constant Summary collapse
- DECODE_OPTIONS =
Set.new([:algorithm, :verify_expiration, :verify_not_before, :verify_iss, :iss, :verify_iat, :verify_aud, :aud, :verify_sub, :sub, :verify_jti, :jti]).freeze
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, opts = {}) ⇒ Authenticate
constructor
A new instance of Authenticate.
Constructor Details
#initialize(app, opts = {}) ⇒ Authenticate
Returns a new instance of Authenticate.
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rack/jwt/auth/authenticate.rb', line 20 def initialize(app, opts = {}) @app = app @opts = opts raise 'Secret must be provided' if opts[:secret].nil? @secret = opts[:secret] @authenticated_routes = compile_paths(opts[:only]) @unauthenticated_routes = compile_paths(opts[:except]) end |
Instance Method Details
#call(env) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/rack/jwt/auth/authenticate.rb', line 32 def call(env) (env) do |payload| env['rack.jwt.session'] = payload @app.call(env) end end |