Sha256: 2a1fab0293f61b73215711d66d0ae84fc84f4b7f16a17cf696110c0ca823edbc

Contents?: true

Size: 531 Bytes

Versions: 1

Compression:

Stored size: 531 Bytes

Contents

module Oauth2
  module Auth
    module Server
      module Models
        class Client < ActiveRecord::Base
          has_many :access_tokens

          before_validation :setup, :on => :create
          validates :name, :redirect_uri, :secret, :presence => true
          validates :identifier, :presence => true, :uniqueness => true

          private

          def setup
            self.identifier = SecureToken.generate(16)
            self.secret = SecureToken.generate
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
oauth2-auth-server-0.0.1 lib/oauth2-auth-server/models/client.rb