simple_token_authentication 1.1.1 → 1.2.0
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.
- checksums.yaml +4 -4
- data/README.md +75 -13
- data/lib/simple_token_authentication.rb +2 -0
- data/lib/simple_token_authentication/acts_as_token_authentication_handler.rb +26 -3
- data/lib/simple_token_authentication/configuration.rb +15 -0
- data/lib/simple_token_authentication/version.rb +1 -1
- data/spec/dummy/app/assets/javascripts/private_posts.js +2 -0
- data/spec/dummy/app/assets/stylesheets/private_posts.css +4 -0
- data/spec/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/spec/dummy/app/controllers/private_posts_controller.rb +63 -0
- data/spec/dummy/app/helpers/private_posts_helper.rb +2 -0
- data/spec/dummy/app/models/private_post.rb +2 -0
- data/spec/dummy/app/models/user.rb +3 -1
- data/spec/dummy/app/views/layouts/application.html.erb +2 -2
- data/spec/dummy/app/views/private_posts/_form.html.erb +25 -0
- data/spec/dummy/app/views/private_posts/edit.html.erb +6 -0
- data/spec/dummy/app/views/private_posts/index.html.erb +29 -0
- data/spec/dummy/app/views/private_posts/new.html.erb +5 -0
- data/spec/dummy/app/views/private_posts/show.html.erb +14 -0
- data/spec/dummy/config/application.rb +4 -9
- data/spec/dummy/config/boot.rb +2 -1
- data/spec/dummy/config/initializers/devise.rb +2 -2
- data/spec/dummy/config/initializers/secret_token.rb +1 -1
- data/spec/dummy/config/initializers/simple_token_authentication.rb +23 -1
- data/spec/dummy/config/routes.rb +0 -1
- data/spec/dummy/db/migrate/{20140220091354_devise_create_users.rb → 20140223182309_devise_create_users.rb} +0 -0
- data/spec/dummy/db/migrate/{20140220091355_add_authentication_token_to_users.rb → 20140223182310_add_authentication_token_to_users.rb} +0 -0
- data/spec/dummy/db/migrate/20140223182312_create_private_posts.rb +10 -0
- data/spec/dummy/db/schema.rb +43 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +75 -0
- data/spec/dummy/spec/controllers/private_posts_controller_spec.rb +22 -0
- data/spec/dummy/spec/factories/users.rb +11 -0
- data/spec/dummy/spec/helpers/private_posts_helper_spec.rb +15 -0
- data/spec/dummy/spec/models/private_post_spec.rb +5 -0
- data/spec/dummy/spec/requests/private_posts_controller_spec.rb +47 -0
- data/spec/dummy/spec/routing/private_posts_routing_spec.rb +35 -0
- data/spec/dummy/spec/support/factory_girl.rb +1 -0
- data/spec/dummy/spec/views/private_posts/edit.html.erb_spec.rb +20 -0
- data/spec/dummy/spec/views/private_posts/index.html.erb_spec.rb +23 -0
- data/spec/dummy/spec/views/private_posts/new.html.erb_spec.rb +20 -0
- data/spec/dummy/spec/views/private_posts/show.html.erb_spec.rb +17 -0
- data/spec/dummy/test/factories/private_posts.rb +8 -0
- metadata +59 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b82f0df25b0b1c4f975fac6ff17ec8baf7bb0d56
|
4
|
+
data.tar.gz: 07648b40370631ec080940103c9e7632639f962b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abbb4abba13fbf7f9576462e4dc69f55ce516bb43c6c8e2760d009507c2bda35a4ca114172925c706a32aee4392be98104f765c399652048bbbd5755ae761d2d
|
7
|
+
data.tar.gz: 016afaa432bcde97ca425cd23e574f03369ec45dbf12cefa4f72352bb6b1ce401b17395a7925d234cdcb958bb96f04ffbd1e9ae88b121258b5c32d69372b49da
|
data/README.md
CHANGED
@@ -70,6 +70,47 @@ class ApplicationController < ActionController::Base
|
|
70
70
|
end
|
71
71
|
```
|
72
72
|
|
73
|
+
Configuration
|
74
|
+
-------------
|
75
|
+
|
76
|
+
Some aspects of the behavior of _Simple Token Authentication_ can be customized with an initializer.
|
77
|
+
Below is an example with reasonable defaults:
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
# config/initializers/simple_token_authentication.rb
|
81
|
+
|
82
|
+
SimpleTokenAuthentication.configure do |config|
|
83
|
+
|
84
|
+
# Configure the session persistence policy after a successful sign in,
|
85
|
+
# in other words, if the authentication token acts as a signin token.
|
86
|
+
# If true, user is stored in the session and the authentication token and
|
87
|
+
# email may be provided only once.
|
88
|
+
# If false, users must provide their authentication token and email at every request.
|
89
|
+
# config.sign_in_token = false
|
90
|
+
|
91
|
+
# Configure the name of the HTTP headers watched for authentication.
|
92
|
+
#
|
93
|
+
# Default header names for a given token authenticatable entity follow the pattern:
|
94
|
+
# { entity: { authentication_token: 'X-Entity-Token', email: 'X-Entity-Email'} }
|
95
|
+
#
|
96
|
+
# When several token authenticatable models are defined, custom header names
|
97
|
+
# can be specified for none, any, or all of them.
|
98
|
+
#
|
99
|
+
# Examples
|
100
|
+
#
|
101
|
+
# Given User and SuperAdmin are token authenticatable,
|
102
|
+
# When the following configuration is used:
|
103
|
+
# `config.header_names = { super_admin: { authentication_token: 'X-Admin-Auth-Token' } }`
|
104
|
+
# Then the token authentification handler for User watches the following headers:
|
105
|
+
# `X-User-Token, X-User-Email`
|
106
|
+
# And the token authentification handler for SuperAdmin watches the following headers:
|
107
|
+
# `X-Admin-Auth-Token, X-SuperAdmin-Email`
|
108
|
+
#
|
109
|
+
# config.header_names = { user: { authentication_token: 'X-User-Token', email: 'X-User-Email' } }
|
110
|
+
|
111
|
+
end
|
112
|
+
```
|
113
|
+
|
73
114
|
Usage
|
74
115
|
-----
|
75
116
|
|
@@ -102,6 +143,35 @@ In fact, you can mix both methods and provide the `user_email` with one and the
|
|
102
143
|
|
103
144
|
If sign-in is successful, no other authentication method will be run, but if it doesn't (the authentication params were missing, or incorrect) then Devise takes control and tries to `authenticate_user!` with its own modules.
|
104
145
|
|
146
|
+
Documentation
|
147
|
+
-------------
|
148
|
+
|
149
|
+
### Executable documentation
|
150
|
+
|
151
|
+
The Cucumber scenarii describe how to setup demonstration applications for different use cases. While you can read the `rake` output, you may prefer to read it in HTML format: see `doc/features.html`. The file is generated automatically by Cucumber, if necessary, you can update it by yourself:
|
152
|
+
|
153
|
+
```bash
|
154
|
+
cd simple_token_authentication
|
155
|
+
rake features_html # generate the features documentation
|
156
|
+
|
157
|
+
# Open doc/features.html in your preferred web browser.
|
158
|
+
```
|
159
|
+
|
160
|
+
I find that HTML output quite enjoyable, I hope you'll do so!
|
161
|
+
|
162
|
+
### Frequently Asked Questions
|
163
|
+
|
164
|
+
Any question? Please don't hesitate to open a new issue to get help. I keep questions tagged to make possible to [review the open questions][open-questions], while closed questions are organized as a sort of [FAQ][faq].
|
165
|
+
|
166
|
+
[open-questions]: https://github.com/gonzalo-bulnes/simple_token_authentication/issues?labels=question&page=1&state=open
|
167
|
+
[faq]: https://github.com/gonzalo-bulnes/simple_token_authentication/issues?direction=desc&labels=question&page=1&sort=comments&state=closed
|
168
|
+
|
169
|
+
### Changelog
|
170
|
+
|
171
|
+
Releases are commented to provide a brief [changelog][changelog].
|
172
|
+
|
173
|
+
[changelog]: https://github.com/gonzalo-bulnes/simple_token_authentication/releases
|
174
|
+
|
105
175
|
Development
|
106
176
|
-----------
|
107
177
|
|
@@ -109,28 +179,20 @@ Development
|
|
109
179
|
|
110
180
|
Since `v1.0.0`, this gem development is test-driven. Each use case should be described with [RSpec][rspec] within an example app. That app will be created and configured automatically by [Aruba][aruba] as a [Cucumber][cucumber] feature.
|
111
181
|
|
112
|
-
The resulting Cucumber features are a bit verbose, and their output when errors occur is not ideal, but their output when they are passing, on the contrary, provides an easy
|
182
|
+
The resulting Cucumber features are a bit verbose, and their output when errors occur is not ideal, but their output when they are passing, on the contrary, provides an easy-to-reproduce recipe to build the example app (see [Executable documentation][exec-doc]). I find that useful enough to be patient with red scenarii for now.
|
113
183
|
|
114
184
|
[aruba]: https://github.com/cucumber/aruba
|
115
185
|
[cucumber]: https://github.com/cucumber/cucumber-rails
|
116
186
|
[rspec]: https://www.relishapp.com/rspec/rspec-rails/docs
|
187
|
+
[exec-doc]: https://github.com/gonzalo-bulnes/simple_token_authentication#executable-documentation
|
117
188
|
|
118
189
|
You can run the full test suite with `cd simple_token_authentication && rake`.
|
119
190
|
|
120
|
-
### Executable documentation
|
121
|
-
|
122
|
-
The Cucumber scenarii describe how to setup demonstration applications for different use cases. While you can read the `rake` output, you may prefer to read it in HTML format:
|
123
|
-
|
124
|
-
```bash
|
125
|
-
cd simple_token_authentication
|
126
|
-
rake features_html # generate the features documentation
|
127
|
-
|
128
|
-
# Open doc/features.html in your preferred web browser.
|
129
|
-
```
|
130
|
-
|
131
191
|
### Contributions
|
132
192
|
|
133
|
-
Contributions are welcome! I'm not
|
193
|
+
Contributions are welcome! I'm not personally maintaining any [list of contributors][contributors] for now, but any PR which references us all will be welcome.
|
194
|
+
|
195
|
+
[contributors]: https://github.com/gonzalo-bulnes/simple_token_authentication/graphs/contributors
|
134
196
|
|
135
197
|
Credits
|
136
198
|
-------
|
@@ -7,10 +7,17 @@ module SimpleTokenAuthentication
|
|
7
7
|
|
8
8
|
included do
|
9
9
|
private :authenticate_entity_from_token!
|
10
|
+
private :header_token_name
|
11
|
+
private :header_email_name
|
10
12
|
# This is our new function that comes before Devise's one
|
11
13
|
before_filter :authenticate_entity_from_token!
|
12
14
|
# This is Devise's authentication
|
13
15
|
before_filter :authenticate_entity!
|
16
|
+
|
17
|
+
# This is necessary to test which arguments were passed to sign_in
|
18
|
+
# from authenticate_entity_from_token!
|
19
|
+
# See https://github.com/gonzalo-bulnes/simple_token_authentication/pull/32
|
20
|
+
ActionController::Base.send :include, Devise::Controllers::SignInOut if Rails.env.test?
|
14
21
|
end
|
15
22
|
|
16
23
|
def authenticate_entity!
|
@@ -27,8 +34,6 @@ module SimpleTokenAuthentication
|
|
27
34
|
# see http://stackoverflow.com/questions/11017348/rails-api-authentication-by-headers-token
|
28
35
|
params_token_name = "#{@@entity.name.singularize.underscore}_token".to_sym
|
29
36
|
params_email_name = "#{@@entity.name.singularize.underscore}_email".to_sym
|
30
|
-
header_token_name = "X-#{@@entity.name.singularize.camelize}-Token"
|
31
|
-
header_email_name = "X-#{@@entity.name.singularize.camelize}-Email"
|
32
37
|
if token = params[params_token_name].blank? && request.headers[header_token_name]
|
33
38
|
params[params_token_name] = token
|
34
39
|
end
|
@@ -53,7 +58,25 @@ module SimpleTokenAuthentication
|
|
53
58
|
# actually stored in the session and a token is needed
|
54
59
|
# for every request. If you want the token to work as a
|
55
60
|
# sign in token, you can simply remove store: false.
|
56
|
-
sign_in entity, store:
|
61
|
+
sign_in entity, store: SimpleTokenAuthentication.sign_in_token
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Private: Return the name of the header to watch for the token authentication param
|
66
|
+
def header_token_name
|
67
|
+
if SimpleTokenAuthentication.header_names["#{@@entity.name.singularize.underscore}".to_sym].presence
|
68
|
+
SimpleTokenAuthentication.header_names["#{@@entity.name.singularize.underscore}".to_sym][:authentication_token]
|
69
|
+
else
|
70
|
+
"X-#{@@entity.name.singularize.camelize}-Token"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# Private: Return the name of the header to watch for the email param
|
75
|
+
def header_email_name
|
76
|
+
if SimpleTokenAuthentication.header_names["#{@@entity.name.singularize.underscore}".to_sym].presence
|
77
|
+
SimpleTokenAuthentication.header_names["#{@@entity.name.singularize.underscore}".to_sym][:email]
|
78
|
+
else
|
79
|
+
"X-#{@@entity.name.singularize.camelize}-Email"
|
57
80
|
end
|
58
81
|
end
|
59
82
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module SimpleTokenAuthentication
|
2
|
+
module Configuration
|
3
|
+
|
4
|
+
mattr_accessor :header_names
|
5
|
+
mattr_accessor :sign_in_token
|
6
|
+
|
7
|
+
# Default configuration
|
8
|
+
@@header_names = {}
|
9
|
+
@@sign_in_token = false
|
10
|
+
|
11
|
+
def configure
|
12
|
+
yield self if block_given?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
body { background-color: #fff; color: #333; }
|
2
|
+
|
3
|
+
body, p, ol, ul, td {
|
4
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
5
|
+
font-size: 13px;
|
6
|
+
line-height: 18px;
|
7
|
+
}
|
8
|
+
|
9
|
+
pre {
|
10
|
+
background-color: #eee;
|
11
|
+
padding: 10px;
|
12
|
+
font-size: 11px;
|
13
|
+
}
|
14
|
+
|
15
|
+
a { color: #000; }
|
16
|
+
a:visited { color: #666; }
|
17
|
+
a:hover { color: #fff; background-color:#000; }
|
18
|
+
|
19
|
+
div.field, div.actions {
|
20
|
+
margin-bottom: 10px;
|
21
|
+
}
|
22
|
+
|
23
|
+
#notice {
|
24
|
+
color: green;
|
25
|
+
}
|
26
|
+
|
27
|
+
.field_with_errors {
|
28
|
+
padding: 2px;
|
29
|
+
background-color: red;
|
30
|
+
display: table;
|
31
|
+
}
|
32
|
+
|
33
|
+
#error_explanation {
|
34
|
+
width: 450px;
|
35
|
+
border: 2px solid red;
|
36
|
+
padding: 7px;
|
37
|
+
padding-bottom: 0;
|
38
|
+
margin-bottom: 20px;
|
39
|
+
background-color: #f0f0f0;
|
40
|
+
}
|
41
|
+
|
42
|
+
#error_explanation h2 {
|
43
|
+
text-align: left;
|
44
|
+
font-weight: bold;
|
45
|
+
padding: 5px 5px 5px 15px;
|
46
|
+
font-size: 12px;
|
47
|
+
margin: -7px;
|
48
|
+
margin-bottom: 0px;
|
49
|
+
background-color: #c00;
|
50
|
+
color: #fff;
|
51
|
+
}
|
52
|
+
|
53
|
+
#error_explanation ul li {
|
54
|
+
font-size: 12px;
|
55
|
+
list-style: square;
|
56
|
+
}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
class PrivatePostsController < ApplicationController
|
2
|
+
|
3
|
+
# Please do notice that this controller DOES call `acts_as_authentication_handler`.
|
4
|
+
# See test/dummy/spec/requests/posts_specs.rb
|
5
|
+
acts_as_token_authentication_handler_for User
|
6
|
+
|
7
|
+
before_action :set_private_post, only: [:show, :edit, :update, :destroy]
|
8
|
+
|
9
|
+
# GET /private_posts
|
10
|
+
def index
|
11
|
+
@private_posts = PrivatePost.all
|
12
|
+
end
|
13
|
+
|
14
|
+
# GET /private_posts/1
|
15
|
+
def show
|
16
|
+
end
|
17
|
+
|
18
|
+
# GET /private_posts/new
|
19
|
+
def new
|
20
|
+
@private_post = PrivatePost.new
|
21
|
+
end
|
22
|
+
|
23
|
+
# GET /private_posts/1/edit
|
24
|
+
def edit
|
25
|
+
end
|
26
|
+
|
27
|
+
# POST /private_posts
|
28
|
+
def create
|
29
|
+
@private_post = PrivatePost.new(private_post_params)
|
30
|
+
|
31
|
+
if @private_post.save
|
32
|
+
redirect_to @private_post, notice: 'Private post was successfully created.'
|
33
|
+
else
|
34
|
+
render action: 'new'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# PATCH/PUT /private_posts/1
|
39
|
+
def update
|
40
|
+
if @private_post.update(private_post_params)
|
41
|
+
redirect_to @private_post, notice: 'Private post was successfully updated.'
|
42
|
+
else
|
43
|
+
render action: 'edit'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# DELETE /private_posts/1
|
48
|
+
def destroy
|
49
|
+
@private_post.destroy
|
50
|
+
redirect_to private_posts_url, notice: 'Private post was successfully destroyed.'
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
# Use callbacks to share common setup or constraints between actions.
|
55
|
+
def set_private_post
|
56
|
+
@private_post = PrivatePost.find(params[:id])
|
57
|
+
end
|
58
|
+
|
59
|
+
# Only allow a trusted parameter "white list" through.
|
60
|
+
def private_post_params
|
61
|
+
params.require(:private_post).permit(:title, :body)
|
62
|
+
end
|
63
|
+
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<title>Dummy</title>
|
5
|
-
<%= stylesheet_link_tag "application", media: "all" %>
|
6
|
-
<%= javascript_include_tag "application" %>
|
5
|
+
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
6
|
+
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
7
7
|
<%= csrf_meta_tags %>
|
8
8
|
</head>
|
9
9
|
<body>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%= form_for(@private_post) do |f| %>
|
2
|
+
<% if @private_post.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@private_post.errors.count, "error") %> prohibited this private_post from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @private_post.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :title %><br>
|
16
|
+
<%= f.text_field :title %>
|
17
|
+
</div>
|
18
|
+
<div class="field">
|
19
|
+
<%= f.label :body %><br>
|
20
|
+
<%= f.text_area :body %>
|
21
|
+
</div>
|
22
|
+
<div class="actions">
|
23
|
+
<%= f.submit %>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<h1>Listing private_posts</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<th>Title</th>
|
7
|
+
<th>Body</th>
|
8
|
+
<th></th>
|
9
|
+
<th></th>
|
10
|
+
<th></th>
|
11
|
+
</tr>
|
12
|
+
</thead>
|
13
|
+
|
14
|
+
<tbody>
|
15
|
+
<% @private_posts.each do |private_post| %>
|
16
|
+
<tr>
|
17
|
+
<td><%= private_post.title %></td>
|
18
|
+
<td><%= private_post.body %></td>
|
19
|
+
<td><%= link_to 'Show', private_post %></td>
|
20
|
+
<td><%= link_to 'Edit', edit_private_post_path(private_post) %></td>
|
21
|
+
<td><%= link_to 'Destroy', private_post, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
</tbody>
|
25
|
+
</table>
|
26
|
+
|
27
|
+
<br>
|
28
|
+
|
29
|
+
<%= link_to 'New Private post', new_private_post_path %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<p id="notice"><%= notice %></p>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<strong>Title:</strong>
|
5
|
+
<%= @private_post.title %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<strong>Body:</strong>
|
10
|
+
<%= @private_post.body %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<%= link_to 'Edit', edit_private_post_path(@private_post) %> |
|
14
|
+
<%= link_to 'Back', private_posts_path %>
|
@@ -1,15 +1,9 @@
|
|
1
1
|
require File.expand_path('../boot', __FILE__)
|
2
2
|
|
3
|
-
|
4
|
-
require "active_record/railtie"
|
5
|
-
require "action_controller/railtie"
|
6
|
-
require "action_mailer/railtie"
|
7
|
-
require "sprockets/railtie"
|
8
|
-
# require "rails/test_unit/railtie"
|
3
|
+
require 'rails/all'
|
9
4
|
|
10
|
-
|
11
|
-
|
12
|
-
Bundler.require(:default, Rails.env)
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require "simple_token_authentication"
|
13
7
|
|
14
8
|
module Dummy
|
15
9
|
class Application < Rails::Application
|
@@ -26,3 +20,4 @@ module Dummy
|
|
26
20
|
# config.i18n.default_locale = :de
|
27
21
|
end
|
28
22
|
end
|
23
|
+
|
data/spec/dummy/config/boot.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# Set up gems listed in the Gemfile.
|
2
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('
|
2
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
|
3
3
|
|
4
4
|
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
|
5
|
+
$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
|
@@ -4,7 +4,7 @@ Devise.setup do |config|
|
|
4
4
|
# The secret key used by Devise. Devise uses this key to generate
|
5
5
|
# random tokens. Changing this key will render invalid all existing
|
6
6
|
# confirmation, reset password and unlock tokens in the database.
|
7
|
-
config.secret_key = '
|
7
|
+
config.secret_key = 'f4566668fa384a9f77aa48c780d2889849f31fccda7ec17e009f0bdb29d236727aa710290892c43457946a068bb1974879409493b97c8c2a08dc5a1243d0fdf8'
|
8
8
|
|
9
9
|
# ==> Mailer Configuration
|
10
10
|
# Configure the e-mail address which will be shown in Devise::Mailer,
|
@@ -95,7 +95,7 @@ Devise.setup do |config|
|
|
95
95
|
config.stretches = Rails.env.test? ? 1 : 10
|
96
96
|
|
97
97
|
# Setup a pepper to generate the encrypted password.
|
98
|
-
# config.pepper = '
|
98
|
+
# config.pepper = '4b8340c47cadf669bea0c43bb407c78d17fe599fc807427b00c08e55529022bfe33e8bfa3e1037de2d52a7f2b8d4f3b117564e6dbc200ea8ab9cb3f402516ba6'
|
99
99
|
|
100
100
|
# ==> Configuration for :confirmable
|
101
101
|
# A period that the user is allowed to access the website even without
|
@@ -9,4 +9,4 @@
|
|
9
9
|
|
10
10
|
# Make sure your secret_key_base is kept private
|
11
11
|
# if you're sharing your code publicly.
|
12
|
-
Dummy::Application.config.secret_key_base = '
|
12
|
+
Dummy::Application.config.secret_key_base = '5b33a3481820c1078cd7c24d57cf444c8826f12a36e1cabfafe516e2fb622f1f471c08e8f95e89bf24eb09b7060ef28f3387fbb3908485df2a282fd04731d35f'
|
@@ -1 +1,23 @@
|
|
1
|
-
|
1
|
+
SimpleTokenAuthentication.configure do |config|
|
2
|
+
|
3
|
+
# Configure the name of the HTTP headers watched for authentication.
|
4
|
+
#
|
5
|
+
# Default header names for a given token authenticatable entity follow the pattern:
|
6
|
+
# { entity: { authentication_token: 'X-Entity-Token', email: 'X-Entity-Email'} }
|
7
|
+
#
|
8
|
+
# When several token authenticatable models are defined, custom header names
|
9
|
+
# can be specified for none, any, or all of them.
|
10
|
+
#
|
11
|
+
# Examples
|
12
|
+
#
|
13
|
+
# Given User and SuperAdmin are token authenticatable,
|
14
|
+
# When the following configuration is used:
|
15
|
+
# `config.header_names = { super_admin: { authentication_token: 'X-Admin-Auth-Token' } }`
|
16
|
+
# Then the token authentification handler for User watches the following headers:
|
17
|
+
# `X-User-Token, X-User-Email`
|
18
|
+
# And the token authentification handler for SuperAdmin watches the following headers:
|
19
|
+
# `X-Admin-Auth-Token, X-SuperAdmin-Email`
|
20
|
+
#
|
21
|
+
config.header_names = { user: { authentication_token: 'X-User-Auth-Token', email: 'X-User-Email' } }
|
22
|
+
|
23
|
+
end
|
data/spec/dummy/config/routes.rb
CHANGED
File without changes
|
File without changes
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(version: 20140223182312) do
|
15
|
+
|
16
|
+
create_table "private_posts", force: true do |t|
|
17
|
+
t.string "title"
|
18
|
+
t.text "body"
|
19
|
+
t.datetime "created_at"
|
20
|
+
t.datetime "updated_at"
|
21
|
+
end
|
22
|
+
|
23
|
+
create_table "users", force: true do |t|
|
24
|
+
t.string "email", default: "", null: false
|
25
|
+
t.string "encrypted_password", default: "", null: false
|
26
|
+
t.string "reset_password_token"
|
27
|
+
t.datetime "reset_password_sent_at"
|
28
|
+
t.datetime "remember_created_at"
|
29
|
+
t.integer "sign_in_count", default: 0, null: false
|
30
|
+
t.datetime "current_sign_in_at"
|
31
|
+
t.datetime "last_sign_in_at"
|
32
|
+
t.string "current_sign_in_ip"
|
33
|
+
t.string "last_sign_in_ip"
|
34
|
+
t.datetime "created_at"
|
35
|
+
t.datetime "updated_at"
|
36
|
+
t.string "authentication_token"
|
37
|
+
end
|
38
|
+
|
39
|
+
add_index "users", ["authentication_token"], name: "index_users_on_authentication_token"
|
40
|
+
add_index "users", ["email"], name: "index_users_on_email", unique: true
|
41
|
+
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
42
|
+
|
43
|
+
end
|
Binary file
|
data/spec/dummy/log/test.log
CHANGED
@@ -0,0 +1,75 @@
|
|
1
|
+
[1m[36m (123.9ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
2
|
+
[1m[35m (120.5ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
3
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.5ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
4
|
+
Migrating to DeviseCreateUsers (20140223182309)
|
5
|
+
[1m[35m (0.1ms)[0m begin transaction
|
6
|
+
[1m[36m (0.5ms)[0m [1mCREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL, "encrypted_password" varchar(255) DEFAULT '' NOT NULL, "reset_password_token" varchar(255), "reset_password_sent_at" datetime, "remember_created_at" datetime, "sign_in_count" integer DEFAULT 0 NOT NULL, "current_sign_in_at" datetime, "last_sign_in_at" datetime, "current_sign_in_ip" varchar(255), "last_sign_in_ip" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
7
|
+
[1m[35m (0.2ms)[0m CREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")
|
8
|
+
[1m[36m (0.1ms)[0m [1mCREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")[0m
|
9
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140223182309"]]
|
10
|
+
[1m[36m (108.2ms)[0m [1mcommit transaction[0m
|
11
|
+
Migrating to AddAuthenticationTokenToUsers (20140223182310)
|
12
|
+
[1m[35m (0.3ms)[0m begin transaction
|
13
|
+
[1m[36m (0.6ms)[0m [1mALTER TABLE "users" ADD "authentication_token" varchar(255)[0m
|
14
|
+
[1m[35m (0.3ms)[0m CREATE INDEX "index_users_on_authentication_token" ON "users" ("authentication_token")
|
15
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140223182310"]]
|
16
|
+
[1m[35m (127.5ms)[0m commit transaction
|
17
|
+
Migrating to CreatePrivatePosts (20140223182312)
|
18
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
19
|
+
[1m[35m (0.6ms)[0m CREATE TABLE "private_posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" text, "created_at" datetime, "updated_at" datetime)
|
20
|
+
[1m[36mSQL (0.5ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20140223182312"]]
|
21
|
+
[1m[35m (84.8ms)[0m commit transaction
|
22
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
23
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
24
|
+
[1m[35m (0.1ms)[0m begin transaction
|
25
|
+
Processing by PrivatePostsController#index as HTML
|
26
|
+
Completed 500 Internal Server Error in 1ms
|
27
|
+
Processing by PrivatePostsController#new as HTML
|
28
|
+
Completed 500 Internal Server Error in 0ms
|
29
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
30
|
+
[1m[35m (0.1ms)[0m begin transaction
|
31
|
+
Rendered private_posts/_form.html.erb (39.6ms)
|
32
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
33
|
+
[1m[35m (0.1ms)[0m begin transaction
|
34
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
35
|
+
[1m[35mUser Exists (0.2ms)[0m SELECT 1 AS one FROM "users" WHERE "users"."email" = 'alice@example.com' LIMIT 1
|
36
|
+
Binary data inserted for `string` type on column `encrypted_password`
|
37
|
+
[1m[36mSQL (3.1ms)[0m [1mINSERT INTO "users" ("authentication_token", "created_at", "email", "encrypted_password", "updated_at") VALUES (?, ?, ?, ?, ?)[0m [["authentication_token", "ExaMpLeTokEn"], ["created_at", Sun, 23 Feb 2014 18:23:19 UTC +00:00], ["email", "alice@example.com"], ["encrypted_password", "$2a$04$tjMkNZ6xLjEZBvO8NFGVzOBCNhhW7xFEQYQmfoSuWnbF9aaibtdYW"], ["updated_at", Sun, 23 Feb 2014 18:23:19 UTC +00:00]]
|
38
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
39
|
+
Started GET "/private_posts" for 127.0.0.1 at 2014-02-23 15:23:19 -0300
|
40
|
+
Processing by PrivatePostsController#index as HTML
|
41
|
+
[1m[36mUser Load (0.2ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."email" = 'alice@example.com' LIMIT 1[0m
|
42
|
+
Completed 500 Internal Server Error in 3ms
|
43
|
+
[1m[35m (0.2ms)[0m rollback transaction
|
44
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
45
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
46
|
+
[1m[36mUser Exists (0.1ms)[0m [1mSELECT 1 AS one FROM "users" WHERE "users"."email" = 'alice@example.com' LIMIT 1[0m
|
47
|
+
Binary data inserted for `string` type on column `encrypted_password`
|
48
|
+
[1m[35mSQL (1.1ms)[0m INSERT INTO "users" ("authentication_token", "created_at", "email", "encrypted_password", "updated_at") VALUES (?, ?, ?, ?, ?) [["authentication_token", "ExaMpLeTokEn"], ["created_at", Sun, 23 Feb 2014 18:23:19 UTC +00:00], ["email", "alice@example.com"], ["encrypted_password", "$2a$04$AHYqxgr1.sE5iZF7dvLGLuDigz/DhW9DcHkCfE.Qhj.sae1kLsqWa"], ["updated_at", Sun, 23 Feb 2014 18:23:19 UTC +00:00]]
|
49
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
50
|
+
Started GET "/private_posts" for 127.0.0.1 at 2014-02-23 15:23:19 -0300
|
51
|
+
Processing by PrivatePostsController#index as HTML
|
52
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" WHERE "users"."email" = 'alice@example.com' LIMIT 1
|
53
|
+
Completed 500 Internal Server Error in 2ms
|
54
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
55
|
+
[1m[35m (0.1ms)[0m begin transaction
|
56
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
57
|
+
[1m[35m (0.1ms)[0m begin transaction
|
58
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
59
|
+
[1m[35m (0.1ms)[0m begin transaction
|
60
|
+
Rendered private_posts/_form.html.erb (2.4ms)
|
61
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
62
|
+
[1m[35m (0.1ms)[0m begin transaction
|
63
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
64
|
+
[1m[35m (0.1ms)[0m begin transaction
|
65
|
+
[1m[36m (0.6ms)[0m [1mrollback transaction[0m
|
66
|
+
[1m[35m (0.1ms)[0m begin transaction
|
67
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
68
|
+
[1m[35m (0.0ms)[0m begin transaction
|
69
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
70
|
+
[1m[35m (0.1ms)[0m begin transaction
|
71
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
72
|
+
[1m[35m (0.0ms)[0m begin transaction
|
73
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
74
|
+
[1m[35m (0.1ms)[0m begin transaction
|
75
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe PrivatePostsController do
|
4
|
+
|
5
|
+
# This should return the minimal set of attributes required to create a valid
|
6
|
+
# PrivatePost. As you add validations to PrivatePost, be sure to
|
7
|
+
# adjust the attributes here as well.
|
8
|
+
let(:valid_attributes) { { "title" => "MyString" } }
|
9
|
+
|
10
|
+
# This should return the minimal set of values that should be in the session
|
11
|
+
# in order to pass any filters (e.g. authentication) defined in
|
12
|
+
# PrivatePostsController. Be sure to keep this updated too.
|
13
|
+
let(:valid_session) { {} }
|
14
|
+
|
15
|
+
describe "actions" do
|
16
|
+
it "all require authentication" do
|
17
|
+
# That's true for all actions, yet I think there's no need to repeat them all here.
|
18
|
+
lambda { get :index, {}, valid_session }.should raise_exception(RuntimeError)
|
19
|
+
lambda { get :new, {}, valid_session }.should raise_exception(RuntimeError)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# Specs in this file have access to a helper object that includes
|
4
|
+
# the PrivatePostsHelper. For example:
|
5
|
+
#
|
6
|
+
# describe PrivatePostsHelper do
|
7
|
+
# describe "string concat" do
|
8
|
+
# it "concats two strings with spaces" do
|
9
|
+
# expect(helper.concat_strings("this","that")).to eq("this that")
|
10
|
+
# end
|
11
|
+
# end
|
12
|
+
# end
|
13
|
+
describe PrivatePostsHelper do
|
14
|
+
pending "add some examples to (or delete) #{__FILE__}"
|
15
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "PrivatePostsController" do
|
4
|
+
describe "GET /private_posts" do
|
5
|
+
|
6
|
+
context "when an initializer overrides the header_names default value" do
|
7
|
+
|
8
|
+
# See config/initializers/simple_token_authentication.rb
|
9
|
+
|
10
|
+
context "and the custom headers are set in the request" do
|
11
|
+
|
12
|
+
it "performs token authentication" do
|
13
|
+
user = FactoryGirl.create(:user \
|
14
|
+
,email: 'alice@example.com' \
|
15
|
+
,authentication_token: 'ExaMpLeTokEn' )
|
16
|
+
|
17
|
+
# `sign_in` is configured to raise an exception when called,
|
18
|
+
# see spec/dummy/app/controllers/application_controller.rb
|
19
|
+
lambda do
|
20
|
+
# see https://github.com/rspec/rspec-rails/issues/65
|
21
|
+
# and http://guides.rubyonrails.org/testing.html#helpers-available-for-integration-tests
|
22
|
+
request_via_redirect 'GET', private_posts_path, nil, { 'X-User-Email' => user.email, 'X-User-Auth-Token' => user.authentication_token }
|
23
|
+
end.should raise_exception(RuntimeError, "`sign_in` was called.")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
context "and the custom headers are missing in the request (and no query params are used)" do
|
27
|
+
context "even if the default headers are set in the request" do
|
28
|
+
|
29
|
+
it "does not perform token authentication" do
|
30
|
+
user = FactoryGirl.create(:user \
|
31
|
+
,email: 'alice@example.com' \
|
32
|
+
,authentication_token: 'ExaMpLeTokEn' )
|
33
|
+
|
34
|
+
# `authenticate_user!` is configured to raise an exception when called,
|
35
|
+
# see spec/dummy/app/controllers/application_controller.rb
|
36
|
+
lambda do
|
37
|
+
# see https://github.com/rspec/rspec-rails/issues/65
|
38
|
+
# and http://guides.rubyonrails.org/testing.html#helpers-available-for-integration-tests
|
39
|
+
request_via_redirect 'GET', private_posts_path, nil, { 'X-User-Email' => user.email, 'X-User-Token' => user.authentication_token }
|
40
|
+
end.should raise_exception(RuntimeError, "`authenticate_user!` was called.")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe PrivatePostsController do
|
4
|
+
describe "routing" do
|
5
|
+
|
6
|
+
it "routes to #index" do
|
7
|
+
get("/private_posts").should route_to("private_posts#index")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "routes to #new" do
|
11
|
+
get("/private_posts/new").should route_to("private_posts#new")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "routes to #show" do
|
15
|
+
get("/private_posts/1").should route_to("private_posts#show", :id => "1")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "routes to #edit" do
|
19
|
+
get("/private_posts/1/edit").should route_to("private_posts#edit", :id => "1")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "routes to #create" do
|
23
|
+
post("/private_posts").should route_to("private_posts#create")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "routes to #update" do
|
27
|
+
put("/private_posts/1").should route_to("private_posts#update", :id => "1")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "routes to #destroy" do
|
31
|
+
delete("/private_posts/1").should route_to("private_posts#destroy", :id => "1")
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'factory_girl_rails'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "private_posts/edit" do
|
4
|
+
before(:each) do
|
5
|
+
@private_post = assign(:private_post, stub_model(PrivatePost,
|
6
|
+
:title => "MyString",
|
7
|
+
:body => "MyText"
|
8
|
+
))
|
9
|
+
end
|
10
|
+
|
11
|
+
it "renders the edit private_post form" do
|
12
|
+
render
|
13
|
+
|
14
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
15
|
+
assert_select "form[action=?][method=?]", private_post_path(@private_post), "post" do
|
16
|
+
assert_select "input#private_post_title[name=?]", "private_post[title]"
|
17
|
+
assert_select "textarea#private_post_body[name=?]", "private_post[body]"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "private_posts/index" do
|
4
|
+
before(:each) do
|
5
|
+
assign(:private_posts, [
|
6
|
+
stub_model(PrivatePost,
|
7
|
+
:title => "Title",
|
8
|
+
:body => "MyText"
|
9
|
+
),
|
10
|
+
stub_model(PrivatePost,
|
11
|
+
:title => "Title",
|
12
|
+
:body => "MyText"
|
13
|
+
)
|
14
|
+
])
|
15
|
+
end
|
16
|
+
|
17
|
+
it "renders a list of private_posts" do
|
18
|
+
render
|
19
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
20
|
+
assert_select "tr>td", :text => "Title".to_s, :count => 2
|
21
|
+
assert_select "tr>td", :text => "MyText".to_s, :count => 2
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "private_posts/new" do
|
4
|
+
before(:each) do
|
5
|
+
assign(:private_post, stub_model(PrivatePost,
|
6
|
+
:title => "MyString",
|
7
|
+
:body => "MyText"
|
8
|
+
).as_new_record)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "renders new private_post form" do
|
12
|
+
render
|
13
|
+
|
14
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
15
|
+
assert_select "form[action=?][method=?]", private_posts_path, "post" do
|
16
|
+
assert_select "input#private_post_title[name=?]", "private_post[title]"
|
17
|
+
assert_select "textarea#private_post_body[name=?]", "private_post[body]"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "private_posts/show" do
|
4
|
+
before(:each) do
|
5
|
+
@private_post = assign(:private_post, stub_model(PrivatePost,
|
6
|
+
:title => "Title",
|
7
|
+
:body => "MyText"
|
8
|
+
))
|
9
|
+
end
|
10
|
+
|
11
|
+
it "renders attributes in <p>" do
|
12
|
+
render
|
13
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
14
|
+
rendered.should match(/Title/)
|
15
|
+
rendered.should match(/MyText/)
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_token_authentication
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gonzalo Bulnes Guilpain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -157,6 +157,7 @@ extra_rdoc_files: []
|
|
157
157
|
files:
|
158
158
|
- lib/tasks/cucumber.rake
|
159
159
|
- lib/tasks/simple_token_authentication_tasks.rake
|
160
|
+
- lib/simple_token_authentication/configuration.rb
|
160
161
|
- lib/simple_token_authentication/acts_as_token_authenticatable.rb
|
161
162
|
- lib/simple_token_authentication/acts_as_token_authentication_handler.rb
|
162
163
|
- lib/simple_token_authentication/version.rb
|
@@ -170,8 +171,11 @@ files:
|
|
170
171
|
- spec/dummy/bin/rails
|
171
172
|
- spec/dummy/bin/rake
|
172
173
|
- spec/dummy/db/seeds.rb
|
173
|
-
- spec/dummy/db/migrate/
|
174
|
-
- spec/dummy/db/migrate/
|
174
|
+
- spec/dummy/db/migrate/20140223182312_create_private_posts.rb
|
175
|
+
- spec/dummy/db/migrate/20140223182309_devise_create_users.rb
|
176
|
+
- spec/dummy/db/migrate/20140223182310_add_authentication_token_to_users.rb
|
177
|
+
- spec/dummy/db/test.sqlite3
|
178
|
+
- spec/dummy/db/schema.rb
|
175
179
|
- spec/dummy/log/test.log
|
176
180
|
- spec/dummy/README.rdoc
|
177
181
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
@@ -195,12 +199,35 @@ files:
|
|
195
199
|
- spec/dummy/config/locales/en.yml
|
196
200
|
- spec/dummy/Rakefile
|
197
201
|
- spec/dummy/spec/spec_helper.rb
|
202
|
+
- spec/dummy/spec/views/private_posts/edit.html.erb_spec.rb
|
203
|
+
- spec/dummy/spec/views/private_posts/new.html.erb_spec.rb
|
204
|
+
- spec/dummy/spec/views/private_posts/index.html.erb_spec.rb
|
205
|
+
- spec/dummy/spec/views/private_posts/show.html.erb_spec.rb
|
206
|
+
- spec/dummy/spec/support/factory_girl.rb
|
207
|
+
- spec/dummy/spec/factories/users.rb
|
208
|
+
- spec/dummy/spec/routing/private_posts_routing_spec.rb
|
209
|
+
- spec/dummy/spec/models/private_post_spec.rb
|
210
|
+
- spec/dummy/spec/controllers/private_posts_controller_spec.rb
|
211
|
+
- spec/dummy/spec/requests/private_posts_controller_spec.rb
|
212
|
+
- spec/dummy/spec/helpers/private_posts_helper_spec.rb
|
198
213
|
- spec/dummy/app/views/layouts/application.html.erb
|
214
|
+
- spec/dummy/app/views/private_posts/new.html.erb
|
215
|
+
- spec/dummy/app/views/private_posts/index.html.erb
|
216
|
+
- spec/dummy/app/views/private_posts/edit.html.erb
|
217
|
+
- spec/dummy/app/views/private_posts/_form.html.erb
|
218
|
+
- spec/dummy/app/views/private_posts/show.html.erb
|
219
|
+
- spec/dummy/app/assets/stylesheets/private_posts.css
|
199
220
|
- spec/dummy/app/assets/stylesheets/application.css
|
221
|
+
- spec/dummy/app/assets/stylesheets/scaffold.css
|
222
|
+
- spec/dummy/app/assets/javascripts/private_posts.js
|
200
223
|
- spec/dummy/app/assets/javascripts/application.js
|
224
|
+
- spec/dummy/app/models/private_post.rb
|
201
225
|
- spec/dummy/app/models/user.rb
|
226
|
+
- spec/dummy/app/controllers/private_posts_controller.rb
|
202
227
|
- spec/dummy/app/controllers/application_controller.rb
|
203
228
|
- spec/dummy/app/helpers/application_helper.rb
|
229
|
+
- spec/dummy/app/helpers/private_posts_helper.rb
|
230
|
+
- spec/dummy/test/factories/private_posts.rb
|
204
231
|
- spec/dummy/public/robots.txt
|
205
232
|
- spec/dummy/public/500.html
|
206
233
|
- spec/dummy/public/favicon.ico
|
@@ -237,8 +264,11 @@ test_files:
|
|
237
264
|
- spec/dummy/bin/rails
|
238
265
|
- spec/dummy/bin/rake
|
239
266
|
- spec/dummy/db/seeds.rb
|
240
|
-
- spec/dummy/db/migrate/
|
241
|
-
- spec/dummy/db/migrate/
|
267
|
+
- spec/dummy/db/migrate/20140223182312_create_private_posts.rb
|
268
|
+
- spec/dummy/db/migrate/20140223182309_devise_create_users.rb
|
269
|
+
- spec/dummy/db/migrate/20140223182310_add_authentication_token_to_users.rb
|
270
|
+
- spec/dummy/db/test.sqlite3
|
271
|
+
- spec/dummy/db/schema.rb
|
242
272
|
- spec/dummy/log/test.log
|
243
273
|
- spec/dummy/README.rdoc
|
244
274
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
@@ -262,12 +292,35 @@ test_files:
|
|
262
292
|
- spec/dummy/config/locales/en.yml
|
263
293
|
- spec/dummy/Rakefile
|
264
294
|
- spec/dummy/spec/spec_helper.rb
|
295
|
+
- spec/dummy/spec/views/private_posts/edit.html.erb_spec.rb
|
296
|
+
- spec/dummy/spec/views/private_posts/new.html.erb_spec.rb
|
297
|
+
- spec/dummy/spec/views/private_posts/index.html.erb_spec.rb
|
298
|
+
- spec/dummy/spec/views/private_posts/show.html.erb_spec.rb
|
299
|
+
- spec/dummy/spec/support/factory_girl.rb
|
300
|
+
- spec/dummy/spec/factories/users.rb
|
301
|
+
- spec/dummy/spec/routing/private_posts_routing_spec.rb
|
302
|
+
- spec/dummy/spec/models/private_post_spec.rb
|
303
|
+
- spec/dummy/spec/controllers/private_posts_controller_spec.rb
|
304
|
+
- spec/dummy/spec/requests/private_posts_controller_spec.rb
|
305
|
+
- spec/dummy/spec/helpers/private_posts_helper_spec.rb
|
265
306
|
- spec/dummy/app/views/layouts/application.html.erb
|
307
|
+
- spec/dummy/app/views/private_posts/new.html.erb
|
308
|
+
- spec/dummy/app/views/private_posts/index.html.erb
|
309
|
+
- spec/dummy/app/views/private_posts/edit.html.erb
|
310
|
+
- spec/dummy/app/views/private_posts/_form.html.erb
|
311
|
+
- spec/dummy/app/views/private_posts/show.html.erb
|
312
|
+
- spec/dummy/app/assets/stylesheets/private_posts.css
|
266
313
|
- spec/dummy/app/assets/stylesheets/application.css
|
314
|
+
- spec/dummy/app/assets/stylesheets/scaffold.css
|
315
|
+
- spec/dummy/app/assets/javascripts/private_posts.js
|
267
316
|
- spec/dummy/app/assets/javascripts/application.js
|
317
|
+
- spec/dummy/app/models/private_post.rb
|
268
318
|
- spec/dummy/app/models/user.rb
|
319
|
+
- spec/dummy/app/controllers/private_posts_controller.rb
|
269
320
|
- spec/dummy/app/controllers/application_controller.rb
|
270
321
|
- spec/dummy/app/helpers/application_helper.rb
|
322
|
+
- spec/dummy/app/helpers/private_posts_helper.rb
|
323
|
+
- spec/dummy/test/factories/private_posts.rb
|
271
324
|
- spec/dummy/public/robots.txt
|
272
325
|
- spec/dummy/public/500.html
|
273
326
|
- spec/dummy/public/favicon.ico
|