class Doorkeeper::OAuth::PasswordAccessTokenRequest

def before_successful_response

def before_successful_response
  find_or_create_access_token(client, resource_owner.id, scopes, server)
end

def initialize(server, credentials, resource_owner, parameters = {})

def initialize(server, credentials, resource_owner, parameters = {})
  @server          = server
  @resource_owner  = resource_owner
  @credentials     = credentials
  @original_scopes = parameters[:scope]
  if credentials
    @client = Application.by_uid_and_secret credentials.uid,
                                            credentials.secret
  end
end

def validate_client

def validate_client
  !credentials || !!client
end

def validate_resource_owner

def validate_resource_owner
  !!resource_owner
end

def validate_scopes

def validate_scopes
  return true unless @original_scopes.present?
  ScopeChecker.valid? @original_scopes, server.scopes, client.try(:scopes)
end