openid_dalli_store 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in openid_dalli_store.gemspec
4
+ gemspec
data/README.rdoc ADDED
@@ -0,0 +1,11 @@
1
+ Monkey patch that allows the Dalli memcache client to be used as an OpenID store. This gem will be obsolete once {this pull request is merged}[https://github.com/openid/ruby-openid/pull/9].
2
+
3
+ = Usage
4
+
5
+ Add the gem to your Gemfile:
6
+
7
+ gem "openid_dalli_store"
8
+
9
+ Create the store:
10
+
11
+ OpenID::Store::Memcache.new(Dalli::Client.new)
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,32 @@
1
+ require 'openid/store/memcache'
2
+
3
+ module OpenID
4
+ module Store
5
+ class Memcache
6
+ undef use_nonce
7
+ def use_nonce(server_url, timestamp, salt)
8
+ return false if (timestamp - Time.now.to_i).abs > Nonce.skew
9
+ ts = timestamp.to_s # base 10 seconds since epoch
10
+ nonce_key = key_prefix + 'N' + server_url + '|' + ts + '|' + salt
11
+ result = @cache_client.add(nonce_key, '', expiry(Nonce.skew + 5))
12
+ if result.is_a? String
13
+ return !!(result =~ /^STORED/)
14
+ else
15
+ return result == true
16
+ end
17
+ end
18
+
19
+ protected
20
+
21
+ undef delete
22
+ def delete(key)
23
+ result = @cache_client.delete(key)
24
+ if result.is_a? String
25
+ return !!(result =~ /^DELETED/)
26
+ else
27
+ return result == true
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,3 @@
1
+ module OpenidDalliStore
2
+ VERSION = "1.0.1"
3
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "openid_dalli_store/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "openid_dalli_store"
7
+ s.version = OpenidDalliStore::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Brian Alexander"]
10
+ s.email = ["balexand@gmail.com"]
11
+ s.homepage = "https://github.com/balexand/openid_dalli_store"
12
+ s.summary = %q{Monkey patch that allows Dalli to be used as an OpenID store}
13
+ s.description = %q{Monkey patch that allows the Dalli memcache client to be used as an OpenID store}
14
+
15
+ s.rubyforge_project = "openid_dalli_store"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: openid_dalli_store
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 1
9
+ version: 1.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Brian Alexander
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-02-21 00:00:00 +07:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: Monkey patch that allows the Dalli memcache client to be used as an OpenID store
22
+ email:
23
+ - balexand@gmail.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - .gitignore
32
+ - Gemfile
33
+ - README.rdoc
34
+ - Rakefile
35
+ - lib/openid_dalli_store.rb
36
+ - lib/openid_dalli_store/version.rb
37
+ - openid_dalli_store.gemspec
38
+ has_rdoc: true
39
+ homepage: https://github.com/balexand/openid_dalli_store
40
+ licenses: []
41
+
42
+ post_install_message:
43
+ rdoc_options: []
44
+
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ segments:
53
+ - 0
54
+ version: "0"
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ requirements: []
64
+
65
+ rubyforge_project: openid_dalli_store
66
+ rubygems_version: 1.3.7
67
+ signing_key:
68
+ specification_version: 3
69
+ summary: Monkey patch that allows Dalli to be used as an OpenID store
70
+ test_files: []
71
+