Sha256: fb8c52d7be31f08938bee25e6a45da95d4fdcad3a3b36841b8e49617f472f686

Contents?: true

Size: 605 Bytes

Versions: 48

Compression:

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

48 entries across 48 versions & 6 rubygems

Version Path
filiptepper-oauth-plugin-0.3.11 generators/oauth_provider/templates/oauth_nonce.rb
pelle-oauth-plugin-0.3.10 generators/oauth_provider/templates/oauth_nonce.rb
pelle-oauth-plugin-0.3.11 generators/oauth_provider/templates/oauth_nonce.rb
pelle-oauth-plugin-0.3.5 generators/oauth_provider/templates/oauth_nonce.rb
pelle-oauth-plugin-0.3.6 generators/oauth_provider/templates/oauth_nonce.rb
pelle-oauth-plugin-0.3.7 generators/oauth_provider/templates/oauth_nonce.rb
pelle-oauth-plugin-0.3.8 generators/oauth_provider/templates/oauth_nonce.rb
pelle-oauth-plugin-0.3.9 generators/oauth_provider/templates/oauth_nonce.rb
oauth-plugin-0.4.0.rc2 generators/oauth_provider/templates/oauth_nonce.rb
oauth-plugin-0.4.0.rc1 generators/oauth_provider/templates/oauth_nonce.rb
oauth-plugin-0.4.0.pre7 generators/oauth_provider/templates/oauth_nonce.rb
oauth-plugin-0.4.0.pre6 generators/oauth_provider/templates/oauth_nonce.rb
oauth-plugin-0.4.0.pre5 generators/oauth_provider/templates/oauth_nonce.rb
insrc-oauth-plugin-0.4.0.pre6 generators/oauth_provider/templates/oauth_nonce.rb
insrc-oauth-plugin-0.4.0.pre5 generators/oauth_provider/templates/oauth_nonce.rb
le1t0-oauth-plugin-0.3.14.001 generators/oauth_provider/templates/oauth_nonce.rb
le1t0-oauth-plugin-0.4.0.pre4.001 generators/oauth_provider/templates/oauth_nonce.rb
oauth-plugin-0.4.0.pre4 generators/oauth_provider/templates/oauth_nonce.rb
oauth-plugin-0.4.0.pre3 generators/oauth_provider/templates/oauth_nonce.rb
oauth-plugin-0.4.0.pre2 generators/oauth_provider/templates/oauth_nonce.rb