class Doorkeeper::OAuth::Helpers::ScopeChecker::Validator

def initialize(scope_str, server_scopes, application_scopes)

def initialize(scope_str, server_scopes, application_scopes)
  @parsed_scopes = OAuth::Scopes.from_string(scope_str)
  @scope_str = scope_str
  @valid_scopes = valid_scopes(server_scopes, application_scopes)
end

def valid?

def valid?
  scope_str.present? &&
    scope_str !~ /[\n\r\t]/ &&
    @valid_scopes.has_scopes?(parsed_scopes)
end

def valid_scopes(server_scopes, application_scopes)

def valid_scopes(server_scopes, application_scopes)
  if application_scopes.present?
    application_scopes
  else
    server_scopes
  end
end