Sha256: 0def3e690877b61b0683244367cfb8427a05d6070ce247e3fe8609d12ce3d55d

Contents?: true

Size: 603 Bytes

Versions: 26

Compression:

Stored size: 603 Bytes

Contents

# Simple store of nonces. The OAuth Spec requires that any given pair of nonce and timestamps are unique.
# Thus you can use the same nonce with a different timestamp and viceversa.
class OauthNonce < ActiveRecord::Base
  validates_presence_of :nonce, :timestamp
  validates_uniqueness_of :nonce, :scope => :timestamp

  # Remembers a nonce and it's associated timestamp. It returns false if it has already been used
  def self.remember(nonce, timestamp)
    oauth_nonce = OauthNonce.create(:nonce => nonce, :timestamp => timestamp)
    return false if oauth_nonce.new_record?
    oauth_nonce
  end
end

Version data entries

26 entries across 19 versions & 6 rubygems

Version Path
houston-oauth-plugin-0.5.1 lib/generators/active_record/oauth_provider_templates/oauth_nonce.rb
houston-oauth-plugin-0.5.1 generators/oauth_provider/templates/oauth_nonce.rb
panjiva-oauth-plugin-0.4.1 lib/generators/active_record/oauth_provider_templates/oauth_nonce.rb
panjiva-oauth-plugin-0.4.1 generators/oauth_provider/templates/oauth_nonce.rb
oauth-plugin-0.5.1 generators/oauth_provider/templates/oauth_nonce.rb
oauth-plugin-0.5.1 lib/generators/active_record/oauth_provider_templates/oauth_nonce.rb
oauth-plugin-0.5.0 generators/oauth_provider/templates/oauth_nonce.rb
oauth-plugin-0.5.0 lib/generators/active_record/oauth_provider_templates/oauth_nonce.rb
oauth-provider-0.5.0rc1 generators/oauth_provider/templates/oauth_nonce.rb
oauth-provider-0.5.0rc1 lib/generators/active_record/oauth_provider_templates/oauth_nonce.rb
oauth-plugin-0.4.1 lib/generators/active_record/oauth_provider_templates/oauth_nonce.rb
oauth-plugin-0.4.1 generators/oauth_provider/templates/oauth_nonce.rb
oauth-plugin-0.4.0 generators/oauth_provider/templates/oauth_nonce.rb
oauth-plugin-0.4.0 lib/generators/active_record/oauth_provider_templates/oauth_nonce.rb
oauth-plugin-0.4.0.rc2 lib/generators/active_record/oauth_provider_templates/oauth_nonce.rb
oauth-plugin-0.4.0.rc1 lib/generators/active_record/oauth_provider_templates/oauth_nonce.rb
oauth-plugin-0.4.0.pre7 lib/generators/active_record/oauth_provider_templates/oauth_nonce.rb
oauth-plugin-0.4.0.pre6 lib/generators/active_record/oauth_provider_templates/oauth_nonce.rb
oauth-plugin-0.4.0.pre5 lib/generators/active_record/oauth_provider_templates/oauth_nonce.rb
insrc-oauth-plugin-0.4.0.pre6 lib/generators/active_record/oauth_provider_templates/oauth_nonce.rb