Sha256: 1f2c41717047d7d825ef4ba43b857d5858af6eb5f29230c8495c5ce828e6f12a
Contents?: true
Size: 709 Bytes
Versions: 3
Compression:
Stored size: 709 Bytes
Contents
# frozen_string_literal: true require 'securerandom' module Osso module Models class OauthClient < ActiveRecord::Base has_many :access_tokens has_many :refresh_tokens has_many :identity_providers has_many :redirect_uris before_validation :setup, on: :create validates :name, :secret, presence: true validates :identifier, presence: true, uniqueness: true def default_redirect_uri redirect_uris.find(&:primary) end def redirect_uri_values redirect_uris.map(&:uri) end private def setup self.identifier = SecureRandom.hex(16) self.secret = SecureRandom.hex(64) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
osso-0.0.3.8 | lib/osso/models/oauth_client.rb |
osso-0.0.3.7 | lib/osso/models/oauth_client.rb |
osso-0.0.3.6 | lib/osso/models/oauth_client.rb |