Sha256: cc1bcf24a0e81442f16a919ba2f075c22c0c9396b479f91b86059eaa47d9731b

Contents?: true

Size: 955 Bytes

Versions: 3

Compression:

Stored size: 955 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 }
  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

3 entries across 3 versions & 1 rubygems

Version Path
authpwn_rails-0.13.0 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.12.1 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.12.0 lib/authpwn_rails/credential_model.rb