warden-ocra 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.rvmrc +48 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +69 -0
- data/Rakefile +8 -0
- data/lib/warden-ocra/configuration.rb +30 -0
- data/lib/warden-ocra/strategies/base_strategy.rb +36 -0
- data/lib/warden-ocra/strategies/ocra_challenge.rb +19 -0
- data/lib/warden-ocra/strategies/ocra_verify.rb +27 -0
- data/lib/warden-ocra/version.rb +5 -0
- data/lib/warden-ocra.rb +17 -0
- data/spec/lib/warden_ocra_spec.rb +166 -0
- data/spec/spec_helper.rb +91 -0
- data/warden-ocra.gemspec +25 -0
- metadata +166 -0
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
4
|
+
# development environment upon cd'ing into the directory
|
5
|
+
|
6
|
+
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
|
7
|
+
# Only full ruby name is supported here, for short names use:
|
8
|
+
# echo "rvm use 1.9.3" > .rvmrc
|
9
|
+
environment_id="ruby-1.9.3-p392@warden-ocra"
|
10
|
+
|
11
|
+
# Uncomment the following lines if you want to verify rvm version per project
|
12
|
+
# rvmrc_rvm_version="1.18.14 (stable)" # 1.10.1 seams as a safe start
|
13
|
+
# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
|
14
|
+
# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
|
15
|
+
# return 1
|
16
|
+
# }
|
17
|
+
|
18
|
+
# First we attempt to load the desired environment directly from the environment
|
19
|
+
# file. This is very fast and efficient compared to running through the entire
|
20
|
+
# CLI and selector. If you want feedback on which environment was used then
|
21
|
+
# insert the word 'use' after --create as this triggers verbose mode.
|
22
|
+
if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
|
23
|
+
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
24
|
+
then
|
25
|
+
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
26
|
+
[[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
|
27
|
+
\. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
|
28
|
+
else
|
29
|
+
# If the environment file has not yet been created, use the RVM CLI to select.
|
30
|
+
rvm --create "$environment_id" || {
|
31
|
+
echo "Failed to create RVM environment '${environment_id}'."
|
32
|
+
return 1
|
33
|
+
}
|
34
|
+
fi
|
35
|
+
|
36
|
+
# If you use bundler, this might be useful to you:
|
37
|
+
# if [[ -s Gemfile ]] && {
|
38
|
+
# ! builtin command -v bundle >/dev/null ||
|
39
|
+
# builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
|
40
|
+
# }
|
41
|
+
# then
|
42
|
+
# printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
|
43
|
+
# gem install bundler
|
44
|
+
# fi
|
45
|
+
# if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
|
46
|
+
# then
|
47
|
+
# bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
|
48
|
+
# fi
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Alexis Reigel
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# Warden::Ocra
|
2
|
+
|
3
|
+
Warden strategy for [OCRA: OATH Challenge-Response Algorithm (rfc 6287)](http://tools.ietf.org/html/rfc6287)
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'warden-ocra'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install warden-ocra
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
The authentication requires two steps:
|
22
|
+
|
23
|
+
1. post a user identifier (e.g. email address)
|
24
|
+
this generates the challenge for that user, no authentication is performed
|
25
|
+
2. post the user and the answer to the challenge
|
26
|
+
this actually authenticates the user
|
27
|
+
|
28
|
+
### Sinatra sample setup
|
29
|
+
|
30
|
+
See [the spec sample sinatra app](https://github.com/koffeinfrei/warden-ocra/blob/master/spec/lib/warden_ocra_spec.rb) for more details.
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
use Rack::Session::Cookie
|
34
|
+
use Warden::Manager do |config|
|
35
|
+
config.default_strategies :ocra_verify, :ocra_challenge
|
36
|
+
config.failure_app = YourApp
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
# step 1
|
42
|
+
post '/generate_challenge' do
|
43
|
+
env["warden"].authenticate!
|
44
|
+
# generates env["warden"].user.challenge
|
45
|
+
end
|
46
|
+
|
47
|
+
# step 2
|
48
|
+
post '/login' do
|
49
|
+
env["warden"].authenticate!
|
50
|
+
# performs the actual authentication
|
51
|
+
end
|
52
|
+
```
|
53
|
+
|
54
|
+
A ``User`` class is assumed to have the following methods.
|
55
|
+
The user class and its method names can be configured if your model has different methods.
|
56
|
+
|
57
|
+
* ``User.find_by_email!(email)``
|
58
|
+
* ``User.has_challenge?(email)``
|
59
|
+
* ``User.generate_challenge!(email)``
|
60
|
+
* ``User#shared_secret``
|
61
|
+
* ``User#challenge``
|
62
|
+
|
63
|
+
## Contributing
|
64
|
+
|
65
|
+
1. Fork it
|
66
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
67
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
68
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
69
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
module Warden
|
2
|
+
module Ocra
|
3
|
+
class Configuration
|
4
|
+
attr_accessor :suite, :param_user_identifier, :param_response,
|
5
|
+
:generate_challenge_method, :has_challenge_method,
|
6
|
+
:user_finder_method, :user_shared_secret_method,
|
7
|
+
:user_challenge_method, :user_class
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
self.suite = 'OCRA-1:HOTP-SHA1-6:QN08'
|
11
|
+
self.param_user_identifier = 'email'
|
12
|
+
self.param_response = 'response'
|
13
|
+
self.generate_challenge_method = 'generate_challenge!'
|
14
|
+
self.has_challenge_method = 'has_challenge?'
|
15
|
+
self.user_finder_method = 'find_by_email!'
|
16
|
+
self.user_shared_secret_method = 'shared_secret'
|
17
|
+
self.user_challenge_method = 'challenge'
|
18
|
+
self.user_class = 'User'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.config
|
23
|
+
@@config ||= Configuration.new
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.configure
|
27
|
+
yield config
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Warden
|
2
|
+
module Ocra
|
3
|
+
module Strategies
|
4
|
+
class BaseStrategy < Warden::Strategies::Base
|
5
|
+
def user_param
|
6
|
+
params[Warden::Ocra::config.param_user_identifier]
|
7
|
+
end
|
8
|
+
|
9
|
+
def user_class
|
10
|
+
Kernel.const_get(Warden::Ocra::config.user_class)
|
11
|
+
end
|
12
|
+
|
13
|
+
def generate_challenge
|
14
|
+
user_class.send(
|
15
|
+
Warden::Ocra::config.generate_challenge_method,
|
16
|
+
user_param
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
def has_challenge?
|
21
|
+
user_param && user_class.send(
|
22
|
+
Warden::Ocra::config.has_challenge_method,
|
23
|
+
user_param
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
def find_user
|
28
|
+
user_class.send(
|
29
|
+
Warden::Ocra::config.user_finder_method,
|
30
|
+
user_param
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_relative 'base_strategy'
|
2
|
+
|
3
|
+
module Warden
|
4
|
+
module Ocra
|
5
|
+
module Strategies
|
6
|
+
class OcraChallenge < BaseStrategy
|
7
|
+
def valid?
|
8
|
+
!has_challenge?
|
9
|
+
end
|
10
|
+
|
11
|
+
def authenticate!
|
12
|
+
user = generate_challenge
|
13
|
+
env['warden'].set_user(user)
|
14
|
+
pass
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative 'base_strategy'
|
2
|
+
|
3
|
+
module Warden
|
4
|
+
module Ocra
|
5
|
+
module Strategies
|
6
|
+
class OcraVerify < BaseStrategy
|
7
|
+
def valid?
|
8
|
+
has_challenge?
|
9
|
+
end
|
10
|
+
|
11
|
+
def authenticate!
|
12
|
+
user = find_user
|
13
|
+
response = Rocra.generate(
|
14
|
+
Warden::Ocra::config.suite,
|
15
|
+
user.send(Warden::Ocra::config.user_shared_secret_method),
|
16
|
+
'',
|
17
|
+
user.send(Warden::Ocra::config.user_challenge_method).to_i.to_s(16),
|
18
|
+
'','', ''
|
19
|
+
)
|
20
|
+
response == params[Warden::Ocra::config.param_response] ?
|
21
|
+
success!(user) :
|
22
|
+
fail!
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/warden-ocra.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'warden'
|
2
|
+
require 'rocra'
|
3
|
+
|
4
|
+
require 'warden-ocra/version'
|
5
|
+
require 'warden-ocra/strategies/ocra_verify'
|
6
|
+
require 'warden-ocra/strategies/ocra_challenge'
|
7
|
+
require 'warden-ocra/configuration'
|
8
|
+
|
9
|
+
module Warden
|
10
|
+
module Ocra
|
11
|
+
Warden::Manager.serialize_into_session { |user| user.id }
|
12
|
+
Warden::Manager.serialize_from_session { |id| User.get(id) }
|
13
|
+
|
14
|
+
Warden::Strategies.add :ocra_verify, Strategies::OcraVerify
|
15
|
+
Warden::Strategies.add :ocra_challenge, Strategies::OcraChallenge
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,166 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Warden::Ocra do
|
4
|
+
context "#configure" do
|
5
|
+
context "should override default value" do
|
6
|
+
context "all strategies" do
|
7
|
+
it "user_class" do
|
8
|
+
Warden::Ocra.config.user_class = 'Profile'
|
9
|
+
|
10
|
+
user = User.new
|
11
|
+
user.stub(:shared_secret).and_return('0000')
|
12
|
+
user.stub(:challenge).and_return('1111')
|
13
|
+
User.stub(:has_challenge?)
|
14
|
+
|
15
|
+
Profile.should_receive(:find_by_email!).and_return(user)
|
16
|
+
User.should_not_receive(:find_by_email!)
|
17
|
+
|
18
|
+
strategy = strategy_instance('OcraVerify')
|
19
|
+
strategy.authenticate!
|
20
|
+
strategy.valid?
|
21
|
+
|
22
|
+
Warden::Ocra.config.user_class = 'User'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "OcraChallenge" do
|
27
|
+
it "generate_challenge_method" do
|
28
|
+
Warden::Ocra.config.generate_challenge_method = 'create_challenge'
|
29
|
+
|
30
|
+
User.should_receive(:has_challenge?)
|
31
|
+
User.should_receive(:create_challenge)
|
32
|
+
User.should_not_receive(:generate_challenge!)
|
33
|
+
|
34
|
+
strategy = strategy_instance('OcraChallenge')
|
35
|
+
strategy.authenticate!
|
36
|
+
strategy.valid?
|
37
|
+
|
38
|
+
Warden::Ocra.config.generate_challenge_method = 'generate_challenge!'
|
39
|
+
end
|
40
|
+
|
41
|
+
it "has_challenge_method" do
|
42
|
+
Warden::Ocra.config.has_challenge_method = 'challenge_exists?'
|
43
|
+
|
44
|
+
User.should_receive(:challenge_exists?)
|
45
|
+
User.should_receive(:generate_challenge!)
|
46
|
+
|
47
|
+
strategy = strategy_instance('OcraChallenge')
|
48
|
+
strategy.authenticate!
|
49
|
+
strategy.valid?
|
50
|
+
|
51
|
+
Warden::Ocra.config.has_challenge_method = 'has_challenge?'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context "OcraVerify" do
|
56
|
+
it "user_finder_method" do
|
57
|
+
Warden::Ocra.config.user_finder_method = 'find_by_username'
|
58
|
+
|
59
|
+
user = User.new
|
60
|
+
user.stub(:shared_secret).and_return('0000')
|
61
|
+
user.stub(:challenge).and_return('1111')
|
62
|
+
User.stub(:has_challenge?)
|
63
|
+
|
64
|
+
User.should_receive(:find_by_username).and_return(user)
|
65
|
+
User.should_not_receive(:find_by_email!)
|
66
|
+
|
67
|
+
strategy = strategy_instance('OcraVerify')
|
68
|
+
strategy.authenticate!
|
69
|
+
strategy.valid?
|
70
|
+
|
71
|
+
Warden::Ocra.config.user_finder_method = 'find_by_email!'
|
72
|
+
end
|
73
|
+
|
74
|
+
it "user_shared_secret_method" do
|
75
|
+
Warden::Ocra.config.user_shared_secret_method = 'secret'
|
76
|
+
|
77
|
+
user = User.new
|
78
|
+
user.stub(:challenge).and_return('1111')
|
79
|
+
User.stub(:has_challenge?)
|
80
|
+
User.stub(:find_by_email!).and_return(user)
|
81
|
+
|
82
|
+
user.should_receive(:secret).and_return('0000')
|
83
|
+
user.should_not_receive(:shared_secret)
|
84
|
+
|
85
|
+
strategy = strategy_instance('OcraVerify')
|
86
|
+
strategy.authenticate!
|
87
|
+
strategy.valid?
|
88
|
+
|
89
|
+
Warden::Ocra.config.user_shared_secret_method = 'shared_secret'
|
90
|
+
end
|
91
|
+
|
92
|
+
it "user_challenge_method" do
|
93
|
+
Warden::Ocra.config.user_challenge_method = 'question'
|
94
|
+
|
95
|
+
user = User.new
|
96
|
+
user.stub(:shared_secret).and_return('0000')
|
97
|
+
User.stub(:find_by_email!).and_return(user)
|
98
|
+
User.stub(:has_challenge?)
|
99
|
+
|
100
|
+
user.should_receive(:question).and_return('1111')
|
101
|
+
user.should_not_receive(:challenge)
|
102
|
+
|
103
|
+
strategy = strategy_instance('OcraVerify')
|
104
|
+
strategy.authenticate!
|
105
|
+
strategy.valid?
|
106
|
+
|
107
|
+
Warden::Ocra.config.user_challenge_method = 'challenge'
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
context "valid user" do
|
114
|
+
before(:each) do
|
115
|
+
post '/generate_challenge', :email => 'bla@blub.com'
|
116
|
+
end
|
117
|
+
|
118
|
+
context "first step" do
|
119
|
+
it "should generate the challenge" do
|
120
|
+
warden.user.challenge.should_not be_nil
|
121
|
+
end
|
122
|
+
|
123
|
+
it "should not authenticate user" do
|
124
|
+
warden.should_not be_authenticated
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
context "second step" do
|
129
|
+
context "valid response" do
|
130
|
+
before(:each) do
|
131
|
+
post '/login', :email => 'bla@blub.com', :response => '239172'
|
132
|
+
end
|
133
|
+
|
134
|
+
it "should authenticate the user" do
|
135
|
+
warden.should be_authenticated
|
136
|
+
end
|
137
|
+
|
138
|
+
context "invalid response" do
|
139
|
+
before(:each) do
|
140
|
+
post '/login', :email => 'bla@blub.com', :response => 'blablub'
|
141
|
+
end
|
142
|
+
|
143
|
+
it "should not authenticate the user" do
|
144
|
+
warden.should_not be_authenticated
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
context "invalid user" do
|
152
|
+
before(:each) do
|
153
|
+
post '/generate_challenge', :email => 'invalid@blub.com'
|
154
|
+
end
|
155
|
+
|
156
|
+
context "first step" do
|
157
|
+
it "should not generate the challenge" do
|
158
|
+
warden.user.should be_nil
|
159
|
+
end
|
160
|
+
|
161
|
+
it "should not authenticate user" do
|
162
|
+
warden.should_not be_authenticated
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'warden-ocra'
|
2
|
+
|
3
|
+
require 'rack/test'
|
4
|
+
require 'sinatra'
|
5
|
+
require 'warden'
|
6
|
+
include Warden::Test::Helpers
|
7
|
+
|
8
|
+
RSpec.configure do |config|
|
9
|
+
config.include Rack::Test::Methods
|
10
|
+
config.after(:each){ Warden.test_reset! }
|
11
|
+
end
|
12
|
+
|
13
|
+
class User
|
14
|
+
class << self
|
15
|
+
attr_accessor :users
|
16
|
+
|
17
|
+
def create(attrs={})
|
18
|
+
self.users ||= []
|
19
|
+
self.users << new(attrs)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
attr_accessor :id, :email, :challenge, :shared_secret
|
24
|
+
|
25
|
+
def initialize(attrs={})
|
26
|
+
attrs.each { |key, value| send("#{key}=", value) }
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.find_by_email!(email)
|
30
|
+
users.find { |u| u.email == email }
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.generate_challenge!(email)
|
34
|
+
u = User.find_by_email!(email)
|
35
|
+
u.challenge = rand.to_s[-8,8]
|
36
|
+
u.challenge = '41538504' # -> reponse 239172
|
37
|
+
u
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.has_challenge?(email)
|
41
|
+
!User.find_by_email!(email).challenge.nil?
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class Profile < User ; end
|
46
|
+
|
47
|
+
class TestApp < Sinatra::Base
|
48
|
+
configure do
|
49
|
+
User.create :email => 'bla@blub.com', :shared_secret => 'c0b93c552e593c4a'
|
50
|
+
end
|
51
|
+
|
52
|
+
get '/' do
|
53
|
+
"hello"
|
54
|
+
end
|
55
|
+
|
56
|
+
post '/generate_challenge' do
|
57
|
+
env["warden"].authenticate!
|
58
|
+
end
|
59
|
+
|
60
|
+
post '/login' do
|
61
|
+
env["warden"].authenticate!
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def app
|
66
|
+
Rack::Builder.new do
|
67
|
+
use Rack::Session::Cookie
|
68
|
+
use Warden::Manager do |config|
|
69
|
+
config.default_strategies :ocra_verify, :ocra_challenge
|
70
|
+
config.failure_app = TestApp
|
71
|
+
end
|
72
|
+
|
73
|
+
run TestApp
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def warden
|
78
|
+
last_request.env["warden"]
|
79
|
+
end
|
80
|
+
|
81
|
+
def strategy_instance(klass)
|
82
|
+
strategy = Warden::Ocra::Strategies.const_get(klass).send(:new, {'rack.input' => {}})
|
83
|
+
strategy.stub(:env).and_return('warden' => stub.as_null_object)
|
84
|
+
strategy.stub(:user_param).and_return('user')
|
85
|
+
strategy
|
86
|
+
end
|
87
|
+
|
88
|
+
def open_browser
|
89
|
+
File.open("/tmp/ocra-spec-out", 'w') { |file| file.write(last_response.body) }
|
90
|
+
`firefox /tmp/ocra-spec-out`
|
91
|
+
end
|
data/warden-ocra.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/warden-ocra/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Alexis Reigel", "Philipp Hoffmann"]
|
6
|
+
gem.email = ["mail@koffeinfrei.org", "phil@branch14.org"]
|
7
|
+
gem.description = %q{Warden strategy for OCRA (rfc6287)}
|
8
|
+
gem.summary = %q{Warden strategy for OCRA (rfc6287)}
|
9
|
+
gem.homepage = "https://github.com/koffeinfrei/warden-ocra"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "warden-ocra"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Warden::Ocra::VERSION
|
17
|
+
|
18
|
+
gem.add_development_dependency 'rake'
|
19
|
+
gem.add_development_dependency 'rspec'
|
20
|
+
gem.add_development_dependency 'sinatra'
|
21
|
+
gem.add_development_dependency 'rack-test'
|
22
|
+
|
23
|
+
gem.add_runtime_dependency 'warden'
|
24
|
+
gem.add_runtime_dependency 'rocra'
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: warden-ocra
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Alexis Reigel
|
9
|
+
- Philipp Hoffmann
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2013-05-29 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rake
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: rspec
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
type: :development
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: sinatra
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: rack-test
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
type: :development
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: warden
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
type: :runtime
|
88
|
+
prerelease: false
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: rocra
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
type: :runtime
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Warden strategy for OCRA (rfc6287)
|
112
|
+
email:
|
113
|
+
- mail@koffeinfrei.org
|
114
|
+
- phil@branch14.org
|
115
|
+
executables: []
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- .gitignore
|
120
|
+
- .rvmrc
|
121
|
+
- Gemfile
|
122
|
+
- LICENSE
|
123
|
+
- README.md
|
124
|
+
- Rakefile
|
125
|
+
- lib/warden-ocra.rb
|
126
|
+
- lib/warden-ocra/configuration.rb
|
127
|
+
- lib/warden-ocra/strategies/base_strategy.rb
|
128
|
+
- lib/warden-ocra/strategies/ocra_challenge.rb
|
129
|
+
- lib/warden-ocra/strategies/ocra_verify.rb
|
130
|
+
- lib/warden-ocra/version.rb
|
131
|
+
- spec/lib/warden_ocra_spec.rb
|
132
|
+
- spec/spec_helper.rb
|
133
|
+
- warden-ocra.gemspec
|
134
|
+
homepage: https://github.com/koffeinfrei/warden-ocra
|
135
|
+
licenses: []
|
136
|
+
post_install_message:
|
137
|
+
rdoc_options: []
|
138
|
+
require_paths:
|
139
|
+
- lib
|
140
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
141
|
+
none: false
|
142
|
+
requirements:
|
143
|
+
- - ! '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
segments:
|
147
|
+
- 0
|
148
|
+
hash: 586295458760637074
|
149
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
|
+
none: false
|
151
|
+
requirements:
|
152
|
+
- - ! '>='
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
segments:
|
156
|
+
- 0
|
157
|
+
hash: 586295458760637074
|
158
|
+
requirements: []
|
159
|
+
rubyforge_project:
|
160
|
+
rubygems_version: 1.8.25
|
161
|
+
signing_key:
|
162
|
+
specification_version: 3
|
163
|
+
summary: Warden strategy for OCRA (rfc6287)
|
164
|
+
test_files:
|
165
|
+
- spec/lib/warden_ocra_spec.rb
|
166
|
+
- spec/spec_helper.rb
|