Class: Doorkeeper::OAuth::CodeResponse
- Inherits:
-
Object
- Object
- Doorkeeper::OAuth::CodeResponse
- Includes:
- Authorization::URIBuilder, Helpers
- Defined in:
- lib/doorkeeper/oauth/code_response.rb
Instance Attribute Summary collapse
-
#auth ⇒ Object
Returns the value of attribute auth.
-
#pre_auth ⇒ Object
Returns the value of attribute pre_auth.
-
#response_on_fragment ⇒ Object
Returns the value of attribute response_on_fragment.
Instance Method Summary collapse
-
#initialize(pre_auth, auth, options = {}) ⇒ CodeResponse
constructor
A new instance of CodeResponse.
-
#redirect_uri ⇒ Object
TODO: configure the test oauth path?.
- #redirectable? ⇒ Boolean
Methods included from Authorization::URIBuilder
#build_query, #uri_with_fragment, #uri_with_query
Constructor Details
#initialize(pre_auth, auth, options = {}) ⇒ CodeResponse
Returns a new instance of CodeResponse.
9 10 11 12 |
# File 'lib/doorkeeper/oauth/code_response.rb', line 9 def initialize(pre_auth, auth, = {}) @pre_auth, @auth = pre_auth, auth @response_on_fragment = [:response_on_fragment] end |
Instance Attribute Details
#auth ⇒ Object
Returns the value of attribute auth.
7 8 9 |
# File 'lib/doorkeeper/oauth/code_response.rb', line 7 def auth @auth end |
#pre_auth ⇒ Object
Returns the value of attribute pre_auth.
7 8 9 |
# File 'lib/doorkeeper/oauth/code_response.rb', line 7 def pre_auth @pre_auth end |
#response_on_fragment ⇒ Object
Returns the value of attribute response_on_fragment.
7 8 9 |
# File 'lib/doorkeeper/oauth/code_response.rb', line 7 def response_on_fragment @response_on_fragment end |
Instance Method Details
#redirect_uri ⇒ Object
TODO: configure the test oauth path?
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/doorkeeper/oauth/code_response.rb', line 19 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 |
#redirectable? ⇒ Boolean
14 15 16 |
# File 'lib/doorkeeper/oauth/code_response.rb', line 14 def redirectable? true end |