Class: Doorkeeper::OAuth::PreAuthorization

Inherits:
Object
  • Object
show all
Includes:
Validations
Defined in:
lib/doorkeeper/oauth/pre_authorization.rb

Instance Attribute Summary collapse

Attributes included from Validations

#error

Instance Method Summary collapse

Methods included from Validations

#valid?, #validate

Constructor Details

#initialize(server, client, attrs = {}) ⇒ PreAuthorization

Returns a new instance of PreAuthorization.



14
15
16
17
18
19
20
21
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 14

def initialize(server, client, attrs = {})
  @server        = server
  @client        = client
  @response_type = attrs[:response_type]
  @redirect_uri  = attrs[:redirect_uri]
  @scope         = attrs[:scope]
  @state         = attrs[:state]
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



11
12
13
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 11

def client
  @client
end

#redirect_uriObject

Returns the value of attribute redirect_uri.



11
12
13
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 11

def redirect_uri
  @redirect_uri
end

#response_typeObject

Returns the value of attribute response_type.



11
12
13
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 11

def response_type
  @response_type
end

#scopeObject



31
32
33
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 31

def scope
  @scope.presence || server.default_scopes.to_s
end

#serverObject

Returns the value of attribute server.



11
12
13
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 11

def server
  @server
end

#stateObject

Returns the value of attribute state.



11
12
13
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 11

def state
  @state
end

Instance Method Details

#authorizable?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 23

def authorizable?
  return true
end

#error_responseObject



35
36
37
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 35

def error_response
  Doorkeeper::OAuth::ErrorResponse.from_request(self)
end

#scopesObject



27
28
29
# File 'lib/doorkeeper/oauth/pre_authorization.rb', line 27

def scopes
  Scopes.from_string scope
end