Sha256: d6ae5d538460e9eac75c5a63ab18c7d498d8a1c4cabf59c44b42c3a04efc805d

Contents?: true

Size: 1.07 KB

Versions: 18

Compression:

Stored size: 1.07 KB

Contents

module Doorkeeper
  module OAuth
    class CodeResponse
      include Doorkeeper::OAuth::Authorization::URIBuilder
      include Doorkeeper::OAuth::Helpers

      attr_accessor :pre_auth, :auth, :response_on_fragment

      def initialize(pre_auth, auth, options = {})
        @pre_auth, @auth      = pre_auth, auth
        @response_on_fragment = options[:response_on_fragment]
      end

      def redirectable?
        true
      end

      # TODO: configure the test oauth path?
      def redirect_uri
        if URIChecker.test_uri? pre_auth.redirect_uri
          "/oauth/authorize/#{auth.token.token}"
        else
          if response_on_fragment
            uri_with_fragment(pre_auth.redirect_uri, {
              :access_token => auth.token.token,
              :token_type   => auth.token.token_type,
              :expires_in   => auth.token.expires_in,
              :state        => pre_auth.state
            })
          else
            uri_with_query pre_auth.redirect_uri, :code => auth.token.token, :state => pre_auth.state
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
doorkeeper-1.1.0 lib/doorkeeper/oauth/code_response.rb
doorkeeper-1.0.0 lib/doorkeeper/oauth/code_response.rb
doorkeeper-1.0.0.rc2 lib/doorkeeper/oauth/code_response.rb
doorkeeper-1.0.0.rc1 lib/doorkeeper/oauth/code_response.rb
doorkeeper-0.7.4 lib/doorkeeper/oauth/code_response.rb
doorkeeper-0.7.3 lib/doorkeeper/oauth/code_response.rb
doorkeeper-0.7.2 lib/doorkeeper/oauth/code_response.rb
doorkeeper-0.7.1 lib/doorkeeper/oauth/code_response.rb
doorkeeper-0.7.0 lib/doorkeeper/oauth/code_response.rb
doorkeeper-0.6.7 lib/doorkeeper/oauth/code_response.rb
doorkeeper-0.6.6 lib/doorkeeper/oauth/code_response.rb
doorkeeper-0.6.5 lib/doorkeeper/oauth/code_response.rb
doorkeeper-0.6.4 lib/doorkeeper/oauth/code_response.rb
doorkeeper-0.6.3 lib/doorkeeper/oauth/code_response.rb
doorkeeper-0.6.2 lib/doorkeeper/oauth/code_response.rb
doorkeeper-0.6.1 lib/doorkeeper/oauth/code_response.rb
doorkeeper-0.6.0 lib/doorkeeper/oauth/code_response.rb
doorkeeper-0.6.0.rc1 lib/doorkeeper/oauth/code_response.rb