Sha256: ff74d4bf65adc73ab5a034502167f5f39cc178b3b37bbf7140ec26c0e89b813f
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
class Hadley::Middleware < Sinatra::Base include Hadley::Authz attr_reader :confg def initialize(app=nil, options={}) super(app) @config ||= Hadley::Config.new(options) yield @config if block_given? @tokens = @config.token_store self end # ------------------------------------------ # Routes # ------------------------------------------ put '/access/tokens/:token' do |token| warden.authenticate!(:afid_server) begin @tokens.put(token, Integer(params.fetch('expires_in')), identity: params.fetch('identity'), client: params.fetch('client') ) body 'Token Accepted' rescue => e status 400 body e.to_s end end delete '/access/tokens/:token' do |token| warden.authenticate!(:afid_server) begin @tokens.delete(token) body 'Token Deleted' rescue => e status 400 body e.to_s end end # ------------------------------------------ # Config # ------------------------------------------ disable :show_exceptions enable :raise_errors enable :logging end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hadley-0.0.2 | lib/hadley/middleware.rb |
hadley-0.0.1 | lib/hadley/middleware.rb |