Sha256: e2168a673de5bf6a2bd925797e4b583ad105ced033619d4149408a360f9f1379

Contents?: true

Size: 976 Bytes

Versions: 4

Compression:

Stored size: 976 Bytes

Contents

require 'active_support'

# :nodoc: namespace
module Authpwn

# Included by the model class that roots various credentials.
#
# Parts of the codebase assume the model will be named Credential.
module CredentialModel
  extend ActiveSupport::Concern

  included do
    # The user whose token this is.
    belongs_to :user, :inverse_of => :credentials
    validates :user, :presence => true

    # Name that can be used to find the token.
    validates :name, :length => { :in => 1..128, :allow_nil => true },
                     :uniqueness => { :scope => [:type], :allow_nil => true }

    # Secret information associated with the token.
    validates :key, :length => { :in => 1..2.kilobytes, :allow_nil => true }

    attr_accessible
  end

  # Included in the metaclass of models that call pwnauth_facebook_token_model.
  module ClassMethods

  end  # module Authpwn::FacebookTokenModel::ClassMethods

end  # namespace Authpwn::FacebookTokenModel

end  # namespace Authpwn

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
authpwn_rails-0.13.4 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.13.3 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.13.2 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.13.1 lib/authpwn_rails/credential_model.rb