class Doorkeeper::OAuth::PreAuthorization
Attributes
client[RW]
redirect_uri[RW]
response_type[RW]
scope[W]
server[RW]
state[RW]
Public Class Methods
new(server, client, attrs = {})
click to toggle source
# 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
Public Instance Methods
error_response()
click to toggle source
# File lib/doorkeeper/oauth/pre_authorization.rb, line 35 def error_response OAuth::ErrorResponse.from_request(self) end
scope()
click to toggle source
# File lib/doorkeeper/oauth/pre_authorization.rb, line 31 def scope @scope.presence || server.default_scopes.to_s end
scopes()
click to toggle source
# File lib/doorkeeper/oauth/pre_authorization.rb, line 27 def scopes Scopes.from_string scope end
Private Instance Methods
validate_client()
click to toggle source
# File lib/doorkeeper/oauth/pre_authorization.rb, line 45 def validate_client client.present? end
validate_redirect_uri()
click to toggle source
TODO: test uri should be matched against the client's one
# File lib/doorkeeper/oauth/pre_authorization.rb, line 59 def validate_redirect_uri return false unless redirect_uri.present? Helpers::URIChecker.native_uri?(redirect_uri) || Helpers::URIChecker.valid_for_authorization?(redirect_uri, client.redirect_uri) end
validate_response_type()
click to toggle source
# File lib/doorkeeper/oauth/pre_authorization.rb, line 41 def validate_response_type server.authorization_response_types.include? response_type end
validate_scopes()
click to toggle source
# File lib/doorkeeper/oauth/pre_authorization.rb, line 49 def validate_scopes return true unless scope.present? Helpers::ScopeChecker.valid?( scope, server.scopes, client.application.scopes ) end