Sha256: 029e9e3f39beba2ea8675d5bf280846cd1a07bd67585b923d0c0c5d04968a82e
Contents?: true
Size: 659 Bytes
Versions: 3
Compression:
Stored size: 659 Bytes
Contents
module Oa2c class Client include Mongoid::Document field :identifier field :secret field :redirect_uri field :name has_many :access_tokens, class_name: "Oa2c::AccessToken" has_many :refresh_tokens, class_name: "Oa2c::RefreshToken" before_validation :setup, on: :create validates :secret, presence: true validates :identifier, presence: true, uniqueness: true private def setup self.identifier = SecureRandom.hex(16) generate_secret end def generate_secret self.secret = SecureRandom.hex(32) end def generate_secret! generate_secret save! end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
oa2c-0.1.2 | app/models/oa2c/client.rb |
oa2c-0.1.1 | app/models/oa2c/client.rb |
oa2c-0.1.0 | app/models/oa2c/client.rb |