Sha256: 711ad79e5be4ac73c8cf7578cdfb846e960855aa3c292745c32f571775b96943

Contents?: true

Size: 909 Bytes

Versions: 13

Compression:

Stored size: 909 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

  # Class methods on models that include Authpwn::CredentialModel.
  module ClassMethods

  end  # module Authpwn::FacebookTokenModel::ClassMethods

end  # namespace Authpwn::FacebookTokenModel

end  # namespace Authpwn

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
authpwn_rails-0.23.0 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.22.1 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.22.0 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.21.1 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.21.0 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.20.0 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.19.0 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.18.2 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.18.1 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.18.0 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.17.2 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.17.1 lib/authpwn_rails/credential_model.rb
authpwn_rails-0.17.0 lib/authpwn_rails/credential_model.rb