Sha256: 1067a752b289cedf93d42e415abaf1c858b522bbe733d0016437dca003203b9c
Contents?: true
Size: 1.67 KB
Versions: 2
Compression:
Stored size: 1.67 KB
Contents
module Rack module OAuth2 module Server class Authorization < Abstract::Handler def call(env) request = Request.new(env) request.profile.new(@realm, &@authenticator).call(env).finish rescue Error => e e.finish end class Request < Abstract::Request attr_accessor :response_type, :redirect_uri, :state def initialize(env) super @state = params['state'] @redirect_uri = Util.parse_uri(params['redirect_uri']) if params['redirect_uri'] end def required_params super + [:response_type] end def profile case params['response_type'] when 'code' Code when 'token' Token when 'code_and_token' CodeAndToken else raise BadRequest.new(:unsupported_response_type, "'#{params['response_type']}' isn't supported.", :state => state, :redirect_uri => redirect_uri) end end end class Response < Abstract::Response attr_accessor :redirect_uri, :state, :approved def initialize(request) @state = request.state @redirect_uri = Util.parse_uri(request.redirect_uri) if request.redirect_uri super end def approved? @approved end def approve! @approved = true end end end end end end require 'rack/oauth2/server/authorization/code' require 'rack/oauth2/server/authorization/token' require 'rack/oauth2/server/authorization/code_and_token'
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rack-oauth2-0.0.6 | lib/rack/oauth2/server/authorization.rb |
rack-oauth2-0.0.5 | lib/rack/oauth2/server/authorization.rb |