Sha256: 5f799331c4df7441ee13c776f53a0d4aa1462feb8395332fdaef482f034bcfa7

Contents?: true

Size: 761 Bytes

Versions: 1

Compression:

Stored size: 761 Bytes

Contents

module Doorkeeper
  class AccessGrant
    include Doorkeeper::OAuth::Helpers
    include Doorkeeper::Models::Scopes

    belongs_to :application, :class_name => "Doorkeeper::Application", :inverse_of => :access_grants

    validates :resource_owner_id, :application_id, :token, :expires_in, :redirect_uri, :presence => true

    before_create :generate_token

    def self.authenticate(token)
      where(:token => token).first
    end

    private

    def generate_token
      # This is wrong! Token should be the id of the AccessGrant class not independently added.... (same as AccessToken)
      # There should be a way to make it raise an error using the ruby model
      # self.add('token', UniqueToken.generate)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
couchkeeper-0.6.7 lib/doorkeeper/models/access_grant.rb