openid_couchdb_store 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +16 -0
- data/Gemfile.lock +99 -0
- data/README.rdoc +22 -0
- data/Rakefile +2 -54
- data/config.ru +15 -0
- data/lib/openid_couchdb_store/version.rb +3 -0
- data/lib/openid_couchdb_store.rb +9 -8
- data/openid_couchdb_store.gemspec +18 -49
- data/test/helper.rb +0 -1
- data/test/test_openid_couchdb_store.rb +1 -1
- metadata +33 -43
- data/.document +0 -5
- data/VERSION +0 -1
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in openid_couchdb_store.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
# Extra gems for use in the config.ru demo
|
7
|
+
group :demo do
|
8
|
+
gem "easy-rack-open-id"
|
9
|
+
gem 'shotgun'
|
10
|
+
|
11
|
+
if RUBY_VERSION =~ /^1\.9/
|
12
|
+
gem 'ruby-debug19', :require => 'ruby-debug'
|
13
|
+
else
|
14
|
+
gem 'ruby-debug'
|
15
|
+
end
|
16
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
openid_couchdb_store (0.0.4)
|
5
|
+
couchrest (~> 1.0)
|
6
|
+
couchrest_model (~> 1.0)
|
7
|
+
ruby-openid (~> 2.1)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
abstract (1.0.0)
|
13
|
+
actionpack (3.0.7)
|
14
|
+
activemodel (= 3.0.7)
|
15
|
+
activesupport (= 3.0.7)
|
16
|
+
builder (~> 2.1.2)
|
17
|
+
erubis (~> 2.6.6)
|
18
|
+
i18n (~> 0.5.0)
|
19
|
+
rack (~> 1.2.1)
|
20
|
+
rack-mount (~> 0.6.14)
|
21
|
+
rack-test (~> 0.5.7)
|
22
|
+
tzinfo (~> 0.3.23)
|
23
|
+
activemodel (3.0.7)
|
24
|
+
activesupport (= 3.0.7)
|
25
|
+
builder (~> 2.1.2)
|
26
|
+
i18n (~> 0.5.0)
|
27
|
+
activesupport (3.0.7)
|
28
|
+
archive-tar-minitar (0.5.2)
|
29
|
+
builder (2.1.2)
|
30
|
+
columnize (0.3.2)
|
31
|
+
couchrest (1.0.2)
|
32
|
+
json (~> 1.5.1)
|
33
|
+
mime-types (~> 1.15)
|
34
|
+
rest-client (~> 1.6.1)
|
35
|
+
couchrest_model (1.0.0)
|
36
|
+
activemodel (~> 3.0.0)
|
37
|
+
couchrest (~> 1.0.1)
|
38
|
+
mime-types (~> 1.15)
|
39
|
+
railties (~> 3.0.0)
|
40
|
+
rspec (>= 2.0.0)
|
41
|
+
tzinfo (~> 0.3.22)
|
42
|
+
diff-lcs (1.1.2)
|
43
|
+
easy-rack-open-id (0.3.1)
|
44
|
+
rack-openid (~> 1.3)
|
45
|
+
erubis (2.6.6)
|
46
|
+
abstract (>= 1.0.0)
|
47
|
+
i18n (0.5.0)
|
48
|
+
json (1.5.1)
|
49
|
+
linecache19 (0.5.12)
|
50
|
+
ruby_core_source (>= 0.1.4)
|
51
|
+
mime-types (1.16)
|
52
|
+
rack (1.2.3)
|
53
|
+
rack-mount (0.6.14)
|
54
|
+
rack (>= 1.0.0)
|
55
|
+
rack-openid (1.3.1)
|
56
|
+
rack (>= 1.1.0)
|
57
|
+
ruby-openid (>= 2.1.8)
|
58
|
+
rack-test (0.5.7)
|
59
|
+
rack (>= 1.0)
|
60
|
+
railties (3.0.7)
|
61
|
+
actionpack (= 3.0.7)
|
62
|
+
activesupport (= 3.0.7)
|
63
|
+
rake (>= 0.8.7)
|
64
|
+
thor (~> 0.14.4)
|
65
|
+
rake (0.9.1)
|
66
|
+
rest-client (1.6.1)
|
67
|
+
mime-types (>= 1.16)
|
68
|
+
rspec (2.6.0)
|
69
|
+
rspec-core (~> 2.6.0)
|
70
|
+
rspec-expectations (~> 2.6.0)
|
71
|
+
rspec-mocks (~> 2.6.0)
|
72
|
+
rspec-core (2.6.3)
|
73
|
+
rspec-expectations (2.6.0)
|
74
|
+
diff-lcs (~> 1.1.2)
|
75
|
+
rspec-mocks (2.6.0)
|
76
|
+
ruby-debug-base19 (0.11.25)
|
77
|
+
columnize (>= 0.3.1)
|
78
|
+
linecache19 (>= 0.5.11)
|
79
|
+
ruby_core_source (>= 0.1.4)
|
80
|
+
ruby-debug19 (0.11.6)
|
81
|
+
columnize (>= 0.3.1)
|
82
|
+
linecache19 (>= 0.5.11)
|
83
|
+
ruby-debug-base19 (>= 0.11.19)
|
84
|
+
ruby-openid (2.1.8)
|
85
|
+
ruby_core_source (0.1.5)
|
86
|
+
archive-tar-minitar (>= 0.5.2)
|
87
|
+
shotgun (0.9)
|
88
|
+
rack (>= 1.0)
|
89
|
+
thor (0.14.6)
|
90
|
+
tzinfo (0.3.27)
|
91
|
+
|
92
|
+
PLATFORMS
|
93
|
+
ruby
|
94
|
+
|
95
|
+
DEPENDENCIES
|
96
|
+
easy-rack-open-id
|
97
|
+
openid_couchdb_store!
|
98
|
+
ruby-debug19
|
99
|
+
shotgun
|
data/README.rdoc
CHANGED
@@ -2,6 +2,28 @@
|
|
2
2
|
|
3
3
|
A store for OpenID using CouchDB. Right now depends on CouchRest, will try to to kick that dependency later.
|
4
4
|
|
5
|
+
== Install
|
6
|
+
|
7
|
+
gem install openid_couchdb_store
|
8
|
+
|
9
|
+
db = Mongo::Connection.new('localhost').db('testorama')
|
10
|
+
db.authenticate('foo','bar')
|
11
|
+
OpenidCouchdbStore::Store.new(db)
|
12
|
+
|
13
|
+
== Demo
|
14
|
+
|
15
|
+
```
|
16
|
+
git clone git://github.com/samsm/openid_couchdb_store.git
|
17
|
+
cd openid_couchdb_store
|
18
|
+
bundle install
|
19
|
+
# have couchdb running
|
20
|
+
shotgun
|
21
|
+
open http://localhost:9292/
|
22
|
+
```
|
23
|
+
|
24
|
+
Shotgun reloads the application each request, providing a nice sanity check. OpenID library can normally do nonce/association storage in memory, so shotgun is a little extra proof that it's really working.
|
25
|
+
|
26
|
+
|
5
27
|
== Copyright
|
6
28
|
|
7
29
|
Copyright (c) 2010 Sam Schenkman-Moore. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -1,54 +1,2 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "openid_couchdb_store"
|
8
|
-
gem.summary = %Q{OpenID store using CouchDB}
|
9
|
-
gem.description = %Q{OpenID store using CouchDB. Right now using Couchrest, will make more flexible later, hopefully.}
|
10
|
-
gem.email = "samsm@samsm.com"
|
11
|
-
gem.homepage = "http://github.com/samsm/openid_couchdb_store"
|
12
|
-
gem.authors = ["Sam Schenkman-Moore"]
|
13
|
-
gem.add_development_dependency "couchrest", ">= 1.0.0"
|
14
|
-
gem.add_development_dependency "couchrest_extended_document", ">= 1.0.0"
|
15
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
-
end
|
17
|
-
Jeweler::GemcutterTasks.new
|
18
|
-
rescue LoadError
|
19
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
20
|
-
end
|
21
|
-
|
22
|
-
require 'rake/testtask'
|
23
|
-
Rake::TestTask.new(:test) do |test|
|
24
|
-
test.libs << 'lib' << 'test'
|
25
|
-
test.pattern = 'test/**/test_*.rb'
|
26
|
-
test.verbose = true
|
27
|
-
end
|
28
|
-
|
29
|
-
begin
|
30
|
-
require 'rcov/rcovtask'
|
31
|
-
Rcov::RcovTask.new do |test|
|
32
|
-
test.libs << 'test'
|
33
|
-
test.pattern = 'test/**/test_*.rb'
|
34
|
-
test.verbose = true
|
35
|
-
end
|
36
|
-
rescue LoadError
|
37
|
-
task :rcov do
|
38
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
task :test => :check_dependencies
|
43
|
-
|
44
|
-
task :default => :test
|
45
|
-
|
46
|
-
require 'rake/rdoctask'
|
47
|
-
Rake::RDocTask.new do |rdoc|
|
48
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
49
|
-
|
50
|
-
rdoc.rdoc_dir = 'rdoc'
|
51
|
-
rdoc.title = "openid_couchdb_store #{version}"
|
52
|
-
rdoc.rdoc_files.include('README*')
|
53
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
54
|
-
end
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
data/config.ru
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'easy-rack-open-id'
|
3
|
+
require "#{File.dirname(__FILE__)}/lib/openid_couchdb_store"
|
4
|
+
|
5
|
+
class HelloWorld
|
6
|
+
def call(env)
|
7
|
+
[200, {"Content-Type" => "text/plain"}, ["Made it through!"]]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
use Rack::Session::Cookie
|
12
|
+
use Rack::OpenID, OpenidCouchdbStore::Store.new(CouchRest.database!("http://127.0.0.1:5984/openid_store_demo"))
|
13
|
+
use EasyRackOpenId::Server, :allowed_identifiers => ['http://samsm.com/']
|
14
|
+
|
15
|
+
run HelloWorld.new
|
data/lib/openid_couchdb_store.rb
CHANGED
@@ -2,17 +2,18 @@
|
|
2
2
|
require 'openid'
|
3
3
|
require 'openid/store/interface'
|
4
4
|
require "couchrest"
|
5
|
-
require "
|
5
|
+
require "couchrest_model"
|
6
|
+
require "#{File.dirname(__FILE__)}/openid_couchdb_store/version"
|
6
7
|
|
7
8
|
module OpenidCouchdbStore
|
8
9
|
|
9
|
-
class Association < CouchRest::
|
10
|
+
class Association < CouchRest::Model::Base
|
10
11
|
|
11
|
-
|
12
|
+
before_save :generate_expires_at
|
12
13
|
|
13
|
-
view_by
|
14
|
-
view_by
|
15
|
-
view_by
|
14
|
+
view_by 'server_url'
|
15
|
+
view_by 'expires_at'
|
16
|
+
view_by 'server_url_plus_handle',
|
16
17
|
:map =>
|
17
18
|
"function(doc) {
|
18
19
|
if (doc['couchrest-type'] == 'OpenidCouchdbStore::Association' && doc['handle']) {
|
@@ -33,7 +34,7 @@ module OpenidCouchdbStore
|
|
33
34
|
|
34
35
|
end
|
35
36
|
|
36
|
-
class Nonce < CouchRest::
|
37
|
+
class Nonce < CouchRest::Model::Base
|
37
38
|
view_by :timestamp
|
38
39
|
view_by :server_url_salt_timestamp,
|
39
40
|
:map =>
|
@@ -91,7 +92,7 @@ module OpenidCouchdbStore
|
|
91
92
|
|
92
93
|
def get_association(server_url, handle=nil)
|
93
94
|
assoc_records = if (handle.nil? or handle.empty?)
|
94
|
-
Association.by_server_url(server_url)
|
95
|
+
Association.by_server_url(:key => server_url)
|
95
96
|
else
|
96
97
|
Association.by_server_url_and_handle(server_url,handle)
|
97
98
|
end
|
@@ -1,57 +1,26 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "openid_couchdb_store/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
9
|
-
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
s.
|
6
|
+
s.name = "openid_couchdb_store"
|
7
|
+
s.version = OpenidCouchdbStore::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Sam Schenkman-Moore"]
|
10
|
+
s.email = ["samsm@samsm.com"]
|
11
|
+
s.homepage = "http://github.com/samsm/openid_couchdb_store"
|
12
|
+
s.summary = %q{OpenID store using CouchDB}
|
13
13
|
s.description = %q{OpenID store using CouchDB. Right now using Couchrest, will make more flexible later, hopefully.}
|
14
|
-
|
15
|
-
s.
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
s.files
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
"LICENSE",
|
23
|
-
"README.rdoc",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION",
|
26
|
-
"lib/openid_couchdb_store.rb",
|
27
|
-
"openid_couchdb_store.gemspec",
|
28
|
-
"test/helper.rb",
|
29
|
-
"test/test_openid_couchdb_store.rb"
|
30
|
-
]
|
31
|
-
s.homepage = %q{http://github.com/samsm/openid_couchdb_store}
|
32
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
14
|
+
|
15
|
+
s.rubyforge_project = "openid_couchdb_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) }
|
33
20
|
s.require_paths = ["lib"]
|
34
|
-
s.rubygems_version = %q{1.3.7}
|
35
|
-
s.summary = %q{OpenID store using CouchDB}
|
36
|
-
s.test_files = [
|
37
|
-
"test/helper.rb",
|
38
|
-
"test/test_openid_couchdb_store.rb"
|
39
|
-
]
|
40
21
|
|
41
|
-
|
42
|
-
|
43
|
-
|
22
|
+
s.add_dependency 'couchrest', ['~> 1.0']
|
23
|
+
s.add_dependency 'couchrest_model', ['~> 1.0']
|
24
|
+
s.add_dependency 'ruby-openid', ['~> 2.1']
|
44
25
|
|
45
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
|
-
s.add_development_dependency(%q<couchrest>, [">= 1.0.0"])
|
47
|
-
s.add_development_dependency(%q<couchrest_extended_document>, [">= 1.0.0"])
|
48
|
-
else
|
49
|
-
s.add_dependency(%q<couchrest>, [">= 1.0.0"])
|
50
|
-
s.add_dependency(%q<couchrest_extended_document>, [">= 1.0.0"])
|
51
|
-
end
|
52
|
-
else
|
53
|
-
s.add_dependency(%q<couchrest>, [">= 1.0.0"])
|
54
|
-
s.add_dependency(%q<couchrest_extended_document>, [">= 1.0.0"])
|
55
|
-
end
|
56
26
|
end
|
57
|
-
|
data/test/helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openid_couchdb_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 3
|
10
|
-
version: 0.0.3
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.4
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Sam Schenkman-Moore
|
@@ -15,8 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date:
|
19
|
-
default_executable:
|
13
|
+
date: 2011-06-02 00:00:00 Z
|
20
14
|
dependencies:
|
21
15
|
- !ruby/object:Gem::Dependency
|
22
16
|
name: couchrest
|
@@ -24,59 +18,61 @@ dependencies:
|
|
24
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
19
|
none: false
|
26
20
|
requirements:
|
27
|
-
- -
|
21
|
+
- - ~>
|
28
22
|
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
|
31
|
-
- 1
|
32
|
-
- 0
|
33
|
-
- 0
|
34
|
-
version: 1.0.0
|
35
|
-
type: :development
|
23
|
+
version: "1.0"
|
24
|
+
type: :runtime
|
36
25
|
version_requirements: *id001
|
37
26
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
27
|
+
name: couchrest_model
|
39
28
|
prerelease: false
|
40
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
30
|
none: false
|
42
31
|
requirements:
|
43
|
-
- -
|
32
|
+
- - ~>
|
44
33
|
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
|
47
|
-
- 1
|
48
|
-
- 0
|
49
|
-
- 0
|
50
|
-
version: 1.0.0
|
51
|
-
type: :development
|
34
|
+
version: "1.0"
|
35
|
+
type: :runtime
|
52
36
|
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: ruby-openid
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "2.1"
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id003
|
53
48
|
description: OpenID store using CouchDB. Right now using Couchrest, will make more flexible later, hopefully.
|
54
|
-
email:
|
49
|
+
email:
|
50
|
+
- samsm@samsm.com
|
55
51
|
executables: []
|
56
52
|
|
57
53
|
extensions: []
|
58
54
|
|
59
|
-
extra_rdoc_files:
|
60
|
-
|
61
|
-
- README.rdoc
|
55
|
+
extra_rdoc_files: []
|
56
|
+
|
62
57
|
files:
|
63
|
-
- .document
|
64
58
|
- .gitignore
|
59
|
+
- Gemfile
|
60
|
+
- Gemfile.lock
|
65
61
|
- LICENSE
|
66
62
|
- README.rdoc
|
67
63
|
- Rakefile
|
68
|
-
-
|
64
|
+
- config.ru
|
69
65
|
- lib/openid_couchdb_store.rb
|
66
|
+
- lib/openid_couchdb_store/version.rb
|
70
67
|
- openid_couchdb_store.gemspec
|
71
68
|
- test/helper.rb
|
72
69
|
- test/test_openid_couchdb_store.rb
|
73
|
-
has_rdoc: true
|
74
70
|
homepage: http://github.com/samsm/openid_couchdb_store
|
75
71
|
licenses: []
|
76
72
|
|
77
73
|
post_install_message:
|
78
|
-
rdoc_options:
|
79
|
-
|
74
|
+
rdoc_options: []
|
75
|
+
|
80
76
|
require_paths:
|
81
77
|
- lib
|
82
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -84,23 +80,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
84
80
|
requirements:
|
85
81
|
- - ">="
|
86
82
|
- !ruby/object:Gem::Version
|
87
|
-
hash: 3
|
88
|
-
segments:
|
89
|
-
- 0
|
90
83
|
version: "0"
|
91
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
85
|
none: false
|
93
86
|
requirements:
|
94
87
|
- - ">="
|
95
88
|
- !ruby/object:Gem::Version
|
96
|
-
hash: 3
|
97
|
-
segments:
|
98
|
-
- 0
|
99
89
|
version: "0"
|
100
90
|
requirements: []
|
101
91
|
|
102
|
-
rubyforge_project:
|
103
|
-
rubygems_version: 1.
|
92
|
+
rubyforge_project: openid_couchdb_store
|
93
|
+
rubygems_version: 1.8.5
|
104
94
|
signing_key:
|
105
95
|
specification_version: 3
|
106
96
|
summary: OpenID store using CouchDB
|
data/.document
DELETED
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.0.3
|