Sha256: 2a1741ab2b571172a482e0da489a1b867f0db385f4de6c2cb530f29fdd22681a
Contents?: true
Size: 629 Bytes
Versions: 13
Compression:
Stored size: 629 Bytes
Contents
module Conjur module WebServer # Verifies that the request contains the authorization token, and then strips it. class Authorize attr_reader :app, :sessionid def initialize(app, sessionid) @app = app @sessionid = sessionid end def call(env) if token_valid?(env) @app.call env else [403, {}, ["Authorization is missing or invalid"]] end end protected def token_valid?(env) request = Rack::Request.new(env) request.session[:sessionid] == sessionid end end end end
Version data entries
13 entries across 13 versions & 3 rubygems