easy-rack-open-id 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -2,7 +2,7 @@ EasyRackOpenID. Simplifies OpenID login for Rack apps.
2
2
 
3
3
  Get Rack::OpenID of http://github.com/josh/rack-openid
4
4
  gem install rack-openid
5
-
5
+ gem install easy-rack-open-id
6
6
 
7
7
  You:
8
8
  require 'rack/openid'
@@ -11,12 +11,20 @@ use Rack::OpenID
11
11
  use EasyRackOpenID, :allowed_identifiers => ['http://example.com/']
12
12
  run lambda {|env| [ 200, { 'Content-Type' => 'text/plain' }, [ 'Authenticated!' ] ] }
13
13
 
14
+ There's an example in config.ru
15
+
14
16
 
15
17
  Basically, slap EasyRackOpenID in front of the App you want to protect. Rack::OpenID needs to be above it.
16
18
  Rack:OpenID with noo arguments uses an in memory OpenID store. This is ok for trying out with rackup, but won't work in a variety of scenarios including using shotgun. You can pass it a different store like so:
17
19
  use Rack::OpenID, OpenID::Store::Memcache.new
18
20
 
19
- :allowed_identifiers is required for EasyRackOpenID to work. Give it an array of all the OpenIDs that you don't mind proceeding.
21
+ With no arguments, EasyRackOpenID will only allow users with a verified OpenID to proceed. It won't care what that identity is.
22
+
23
+ :allowed_identifiers - when used, only identities in the provided array will be allowed access.
24
+
25
+ :identity_match - when used, only identities matching this regex pattern will be allowed.
26
+
27
+ Right now allowed_identifiers and identity_match cannot both be used at once.
20
28
 
21
29
  :default_return_to (optional) is a path just in case the automatic return_to mysteriously vanishes. Unlikely.
22
30
 
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
3
3
  require 'rake'
4
4
  require 'echoe'
5
5
 
6
- Echoe.new('easy-rack-open-id', '0.0.1') do |p|
6
+ Echoe.new('easy-rack-open-id', '0.0.2') do |p|
7
7
  p.summary = "Super easy OpenID protection for Rack."
8
8
  p.description = "You supply OpenIDs, this keeps anyone but people with access to those ids from getting through."
9
9
  p.url = "http://samsm.com/"
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{easy-rack-open-id}
5
- s.version = "0.0.1"
5
+ s.version = "0.0.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Sam Schenkman-Moore"]
9
- s.date = %q{2009-11-16}
9
+ s.date = %q{2009-11-17}
10
10
  s.description = %q{You supply OpenIDs, this keeps anyone but people with access to those ids from getting through.}
11
11
  s.email = %q{samsm@samsm.com}
12
12
  s.extra_rdoc_files = ["README", "lib/easy_rack_open_id.rb", "lib/generic_openid_form.html.erb"]
@@ -62,7 +62,17 @@ class EasyRackOpenID
62
62
  end
63
63
 
64
64
  def allowed?
65
- allowed_identifiers.include? verified_identity
65
+ if allowed_identifiers
66
+ allowed_identifiers.include? verified_identity
67
+ elsif identity_match
68
+ identity_match === verified_identity
69
+ else
70
+ verified_identity
71
+ end
72
+ end
73
+
74
+ def identity_match
75
+ options[:identity_match]
66
76
  end
67
77
 
68
78
  def allowed_identifiers
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy-rack-open-id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Schenkman-Moore
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-16 00:00:00 -05:00
12
+ date: 2009-11-17 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency