auther 10.2.2 → 11.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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/{LICENSE.md → LICENSE.adoc} +29 -30
- data/README.adoc +287 -0
- data/app/controllers/auther/base_controller.rb +4 -4
- data/lib/auther/authenticator.rb +1 -1
- data/lib/auther/gatekeeper.rb +2 -2
- data/lib/auther/identity.rb +4 -15
- data/lib/auther/settings.rb +9 -17
- data/lib/generators/auther/templates/config/initializers/auther.rb +6 -4
- metadata +62 -103
- metadata.gz.sig +0 -0
- data/README.md +0 -265
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dbd0ee00b8f8fab0f81b2ac0457c43330a5b4816d5ed12bae73d63fd0a58479f
|
|
4
|
+
data.tar.gz: bc6f67e62676d69904ed282508c6b54fe9eeec82ed040639ab5a8eec03a305f7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 01bc552384bc51754c651231ddc6913cce5b12783f09556fa2a1080b3ef2339501ee362c9d1e83567165b349ee6840e11e7d2c107926f2aea325224b36d8f00e
|
|
7
|
+
data.tar.gz: c71b34c77ed24855bc04da513bd0fcc4af224c6afba9437075e058032180a1a882437e402afcb404b32bdb90ee12d6239e699d60227b220c056bb43ff991fb9b
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
data/{LICENSE.md → LICENSE.adoc}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
= Apache License
|
|
2
2
|
|
|
3
3
|
Version 2.0, January 2004
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ http://www.apache.org/licenses
|
|
|
6
6
|
|
|
7
7
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
== 1. Definitions
|
|
10
10
|
|
|
11
11
|
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by
|
|
12
12
|
Sections 1 through 9 of this document.
|
|
@@ -54,14 +54,14 @@ Contribution."
|
|
|
54
54
|
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a
|
|
55
55
|
Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
== 2. Grant of Copyright License
|
|
58
58
|
|
|
59
59
|
Subject to the terms and conditions of this License, each Contributor hereby grants to You a
|
|
60
60
|
perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to
|
|
61
61
|
reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and
|
|
62
62
|
distribute the Work and such Derivative Works in Source or Object form.
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
== 3. Grant of Patent License
|
|
65
65
|
|
|
66
66
|
Subject to the terms and conditions of this License, each Contributor hereby grants to You a
|
|
67
67
|
perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
|
|
@@ -74,39 +74,38 @@ a Contribution incorporated within the Work constitutes direct or contributory p
|
|
|
74
74
|
then any patent licenses granted to You under this License for that Work shall terminate as of the
|
|
75
75
|
date such litigation is filed.
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
== 4. Redistribution
|
|
78
78
|
|
|
79
79
|
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with
|
|
80
80
|
or without modifications, and in Source or Object form, provided that You meet the following
|
|
81
81
|
conditions:
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
. You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
. You must cause any modified files to carry prominent notices stating that You changed the files;
|
|
86
|
+
and
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
. You must retain, in the Source form of any Derivative Works that You distribute, all copyright,
|
|
89
|
+
patent, trademark, and attribution notices from the Source form of the Work, excluding those
|
|
90
|
+
notices that do not pertain to any part of the Derivative Works; and
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
construed as modifying the License.
|
|
92
|
+
. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works
|
|
93
|
+
that You distribute must include a readable copy of the attribution notices contained within such
|
|
94
|
+
NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in
|
|
95
|
+
at least one of the following places: within a NOTICE text file distributed as part of the
|
|
96
|
+
Derivative Works; within the Source form or documentation, if provided along with the Derivative
|
|
97
|
+
Works; or, within a display generated by the Derivative Works, if and wherever such third-party
|
|
98
|
+
notices normally appear. The contents of the NOTICE file are for informational purposes only and
|
|
99
|
+
do not modify the License. You may add Your own attribution notices within Derivative Works that
|
|
100
|
+
You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such
|
|
101
|
+
additional attribution notices cannot be construed as modifying the License.
|
|
103
102
|
|
|
104
103
|
You may add Your own copyright statement to Your modifications and may provide additional or
|
|
105
104
|
different license terms and conditions for use, reproduction, or distribution of Your modifications,
|
|
106
105
|
or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of
|
|
107
106
|
the Work otherwise complies with the conditions stated in this License.
|
|
108
107
|
|
|
109
|
-
|
|
108
|
+
== 5. Submission of Contributions
|
|
110
109
|
|
|
111
110
|
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the
|
|
112
111
|
Work by You to the Licensor shall be under the terms and conditions of this License, without any
|
|
@@ -114,13 +113,13 @@ additional terms or conditions. Notwithstanding the above, nothing herein shall
|
|
|
114
113
|
the terms of any separate license agreement you may have executed with Licensor regarding such
|
|
115
114
|
Contributions.
|
|
116
115
|
|
|
117
|
-
|
|
116
|
+
== 6. Trademarks
|
|
118
117
|
|
|
119
118
|
This License does not grant permission to use the trade names, trademarks, service marks, or product
|
|
120
119
|
names of the Licensor, except as required for reasonable and customary use in describing the origin
|
|
121
120
|
of the Work and reproducing the content of the NOTICE file.
|
|
122
121
|
|
|
123
|
-
|
|
122
|
+
== 7. Disclaimer of Warranty
|
|
124
123
|
|
|
125
124
|
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each
|
|
126
125
|
Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
@@ -129,7 +128,7 @@ TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. Y
|
|
|
129
128
|
responsible for determining the appropriateness of using or redistributing the Work and assume any
|
|
130
129
|
risks associated with Your exercise of permissions under this License.
|
|
131
130
|
|
|
132
|
-
|
|
131
|
+
== 8. Limitation of Liability
|
|
133
132
|
|
|
134
133
|
In no event and under no legal theory, whether in tort (including negligence), contract, or
|
|
135
134
|
otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or
|
|
@@ -139,7 +138,7 @@ License or out of the use or inability to use the Work (including but not limite
|
|
|
139
138
|
loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial
|
|
140
139
|
damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
141
140
|
|
|
142
|
-
|
|
141
|
+
== 9. Accepting Warranty or Additional Liability
|
|
143
142
|
|
|
144
143
|
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee
|
|
145
144
|
for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights
|
|
@@ -151,11 +150,11 @@ additional liability.
|
|
|
151
150
|
|
|
152
151
|
END OF TERMS AND CONDITIONS
|
|
153
152
|
|
|
154
|
-
Copyright
|
|
153
|
+
Copyright link:https://www.alchemists.io[Alchemists].
|
|
155
154
|
|
|
156
155
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
|
|
157
|
-
compliance with the License. You may obtain a
|
|
158
|
-
the License.
|
|
156
|
+
compliance with the License. You may obtain a link:https://www.apache.org/licenses/LICENSE-2.0[copy]
|
|
157
|
+
of the License.
|
|
159
158
|
|
|
160
159
|
Unless required by applicable law or agreed to in writing, software distributed under the License is
|
|
161
160
|
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
data/README.adoc
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
:toc: macro
|
|
2
|
+
:toclevels: 5
|
|
3
|
+
:figure-caption!:
|
|
4
|
+
|
|
5
|
+
= Auther
|
|
6
|
+
|
|
7
|
+
[link=http://badge.fury.io/rb/auther]
|
|
8
|
+
image::https://badge.fury.io/rb/auther.svg[Gem Version]
|
|
9
|
+
[link=https://circleci.com/gh/bkuhlmann/auther]
|
|
10
|
+
image::https://circleci.com/gh/bkuhlmann/auther.svg?style=svg[Circle CI Status]
|
|
11
|
+
|
|
12
|
+
Provides simple, form-based authentication for apps that need security but don't want to deal with
|
|
13
|
+
the clunky UI of HTTP Basic Authentication or something as heavyweight as
|
|
14
|
+
link:https://github.com/plataformatec/devise[Devise]. It doesn't require a database and is
|
|
15
|
+
compatible with password managers like link:https://agilebits.com/onepassword[1Password] making for
|
|
16
|
+
a pleasant user experience.
|
|
17
|
+
|
|
18
|
+
toc::[]
|
|
19
|
+
|
|
20
|
+
== Features
|
|
21
|
+
|
|
22
|
+
* Supports form-based authentication compatible with password managers like
|
|
23
|
+
link:https://agilebits.com/onepassword[1Password].
|
|
24
|
+
|
|
25
|
+
image::https://www.alchemists.io/images/projects/auther/screenshots/form-without_errors.png[Form Without Errors Screenshot]
|
|
26
|
+
image::https://www.alchemists.io/images/projects/auther/screenshots/form-with_errors.png[Form With Errors Screenshot]
|
|
27
|
+
|
|
28
|
+
* Uses CSS Flexbox for lightweight styling.
|
|
29
|
+
* Uses encrypted account credentials to keep sensitive information secure.
|
|
30
|
+
* Supports multiple accounts with optional path exclude lists.
|
|
31
|
+
* Supports customizable routes, models, presenters, views, controllers, and loggers.
|
|
32
|
+
* Provides a generator for easy install and setup within an existing project.
|
|
33
|
+
* Provides auto-redirection to requested path for verified credentials.
|
|
34
|
+
|
|
35
|
+
== Requirements
|
|
36
|
+
|
|
37
|
+
. link:https://www.ruby-lang.org[Ruby]
|
|
38
|
+
. link:https://rubyonrails.org[Ruby on Rails]
|
|
39
|
+
|
|
40
|
+
== Setup
|
|
41
|
+
|
|
42
|
+
=== Production
|
|
43
|
+
|
|
44
|
+
To install, run:
|
|
45
|
+
|
|
46
|
+
[source,bash]
|
|
47
|
+
----
|
|
48
|
+
gem install auther
|
|
49
|
+
----
|
|
50
|
+
|
|
51
|
+
Add the following to your Gemfile:
|
|
52
|
+
|
|
53
|
+
[source,ruby]
|
|
54
|
+
----
|
|
55
|
+
gem "auther"
|
|
56
|
+
----
|
|
57
|
+
|
|
58
|
+
Run the install generator to configure and initialize your application:
|
|
59
|
+
|
|
60
|
+
[source,bash]
|
|
61
|
+
----
|
|
62
|
+
rails generate auther:install
|
|
63
|
+
----
|
|
64
|
+
|
|
65
|
+
Run the credentials generator to generate credentials for your application:
|
|
66
|
+
|
|
67
|
+
[source,bash]
|
|
68
|
+
----
|
|
69
|
+
rails generate auther:credentials
|
|
70
|
+
----
|
|
71
|
+
|
|
72
|
+
If using link:https://direnv.net[direnv], for example, you can copy and paste the generated
|
|
73
|
+
credentials into your `.envrc` file. Example:
|
|
74
|
+
|
|
75
|
+
image::https://www.alchemists.io/images/projects/auther/screenshots/credentials_generator.jpg[Credentials Generator Screenshot]
|
|
76
|
+
|
|
77
|
+
=== Development
|
|
78
|
+
|
|
79
|
+
To contribute, run:
|
|
80
|
+
|
|
81
|
+
[source,bash]
|
|
82
|
+
----
|
|
83
|
+
git clone https://github.com/bkuhlmann/auther.git
|
|
84
|
+
cd auther
|
|
85
|
+
bin/setup
|
|
86
|
+
----
|
|
87
|
+
|
|
88
|
+
You can also use the IRB console for direct access to all objects:
|
|
89
|
+
|
|
90
|
+
[source,bash]
|
|
91
|
+
----
|
|
92
|
+
bin/console
|
|
93
|
+
----
|
|
94
|
+
|
|
95
|
+
== Usage
|
|
96
|
+
|
|
97
|
+
Launch your Rails application and visit the following: `http://localhost:3000/login`. Enter your
|
|
98
|
+
login and password as used for the `rails generate auther:credentials` generator and you'll be
|
|
99
|
+
logged in.
|
|
100
|
+
|
|
101
|
+
=== Initializer
|
|
102
|
+
|
|
103
|
+
The initializer (installed during setup) can be found here: `config/initializers/auther.rb`. The
|
|
104
|
+
initializer comes installed with the following settings:
|
|
105
|
+
|
|
106
|
+
[source,ruby]
|
|
107
|
+
----
|
|
108
|
+
Rails.application.config.auther_settings = {
|
|
109
|
+
accounts: [
|
|
110
|
+
{
|
|
111
|
+
name: "admin",
|
|
112
|
+
encrypted_login: ENV["AUTHER_ADMIN_LOGIN"],
|
|
113
|
+
encrypted_password: ENV["AUTHER_ADMIN_PASSWORD"],
|
|
114
|
+
paths: ["/admin"]
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
secret: ENV["AUTHER_SECRET"]
|
|
118
|
+
}
|
|
119
|
+
----
|
|
120
|
+
|
|
121
|
+
To encrypt/decrypt account credentials, launch a rails console and run the following:
|
|
122
|
+
|
|
123
|
+
[source,ruby]
|
|
124
|
+
----
|
|
125
|
+
# The secret as defined in `auther_settings` and/or produced by the credentials generator.
|
|
126
|
+
secret = SecureRandom.hex 16 # "426a7f46548a1a4518676a8e246517d8"
|
|
127
|
+
|
|
128
|
+
# The cipher for encrypting/decrypting values.
|
|
129
|
+
cipher = Auther::Cipher.new secret
|
|
130
|
+
|
|
131
|
+
# Use the following to encrypt an unecrypted value.
|
|
132
|
+
cipher.encrypt "test@test.com"
|
|
133
|
+
|
|
134
|
+
# Use the following to decrypt an encrypted value.
|
|
135
|
+
cipher.decrypt "hWToltdpl+uZJBPELKNC7Ij++jPkTuo=--nEdbOYL9fIRh14hY--fU+VSCd4+DDOhOmG1gzRfQ=="
|
|
136
|
+
----
|
|
137
|
+
|
|
138
|
+
The initializer can be customized as follows:
|
|
139
|
+
|
|
140
|
+
* `title` - Optional. The HTML page title (as rendered within a browser tab). Default:
|
|
141
|
+
`"Authorization"`.
|
|
142
|
+
* `label` - Optional. The page label (what would appear above the form). Default: `"Authorization"`.
|
|
143
|
+
* `secret` - Required. The secret passphrase used to encrypt/decrypt account credentials.
|
|
144
|
+
* `accounts` - Required. The array of accounts with different or similar access to the application.
|
|
145
|
+
** `name` - Required. The account name that uniquely identifies the account.
|
|
146
|
+
** `encrypted_login` - Required. The encrypted account login.
|
|
147
|
+
** `encrypted_password` - Required. The encrypted account password.
|
|
148
|
+
** `paths` - Required. The array of excluded paths for which only this account has access to.
|
|
149
|
+
** `authorized_url` - Optional. The URL to redirect to upon successful authorization. Authorized
|
|
150
|
+
redirection works in the order defined:
|
|
151
|
+
*** The excluded path (if requested prior to authorization but now authorized).
|
|
152
|
+
*** The authorized URL (if defined and the excluded path wasn't requested).
|
|
153
|
+
*** The root path (if none of the above).
|
|
154
|
+
** `deauthorized_url` - Optional. The URL to redirect to upon successful deauthorization (i.e.
|
|
155
|
+
logout). Deauthorized redirections works as follows (in the order defined):
|
|
156
|
+
*** The deauthorized URL (if defined).
|
|
157
|
+
*** The auth URL.
|
|
158
|
+
* `url` - Optional. The URL to redirect to when enforcing authentication. Default: `"/login"`.
|
|
159
|
+
* `logger` - Optional. The logger used to log path/account authorization messages. Default:
|
|
160
|
+
`Auther::NullLogger`.
|
|
161
|
+
|
|
162
|
+
=== Routes
|
|
163
|
+
|
|
164
|
+
The routes can be customized as follows (installed, by default, via the install generator):
|
|
165
|
+
|
|
166
|
+
[source,ruby]
|
|
167
|
+
----
|
|
168
|
+
Rails.application.routes.draw do
|
|
169
|
+
mount Auther::Engine => "/auther"
|
|
170
|
+
get "/login", to: "auther/session#new", as: "login"
|
|
171
|
+
delete "/logout", to: "auther/session#destroy", as: "logout"
|
|
172
|
+
end
|
|
173
|
+
----
|
|
174
|
+
|
|
175
|
+
=== Model
|
|
176
|
+
|
|
177
|
+
The `Auther::Account` is a struct that uses ActiveModel validations to aid in attribute validation.
|
|
178
|
+
This model could potentially be replaced with a database-backed object (would require controller
|
|
179
|
+
customization)...but you should question if you have outgrown the use of this gem and need a
|
|
180
|
+
different solution altogether if it comes to that.
|
|
181
|
+
|
|
182
|
+
=== Presenter
|
|
183
|
+
|
|
184
|
+
The `Auther::Presenter::Account` is a plain old Ruby object that uses ActiveModel validations to aid
|
|
185
|
+
in form validation. This presenter makes it easy to construct form data for input and validation.
|
|
186
|
+
|
|
187
|
+
=== View
|
|
188
|
+
|
|
189
|
+
The view can be customized by creating the following file within your Rails application (assumes
|
|
190
|
+
that the default `Auther::SessionController` implementation is sufficient):
|
|
191
|
+
`app/views/auther/session/new.html`.
|
|
192
|
+
|
|
193
|
+
The form uses the `@account` instance variable which is an instance of the
|
|
194
|
+
`Auther::Presenter::Account` presenter (as mentioned above). The form can be stylized by modifying
|
|
195
|
+
the styles found in the `auther.scss` stylesheet.
|
|
196
|
+
|
|
197
|
+
=== Controller
|
|
198
|
+
|
|
199
|
+
The `Auther::SessionController` inherits from the `Auther::BaseController`. To customize, it is
|
|
200
|
+
recommended that you add a controller to your app that inherits from the `Auther::BaseController`.
|
|
201
|
+
Example:
|
|
202
|
+
|
|
203
|
+
[source,ruby]
|
|
204
|
+
----
|
|
205
|
+
# Example Path: app/controllers/session_controller.rb
|
|
206
|
+
class SessionController < Auther::BaseController
|
|
207
|
+
layout "example"
|
|
208
|
+
end
|
|
209
|
+
----
|
|
210
|
+
|
|
211
|
+
This allows customization of session controller behavior to serve any special business needs. See
|
|
212
|
+
the `Auther::BaseController` for additional details or the `Auther::SessionController` for default
|
|
213
|
+
implementation.
|
|
214
|
+
|
|
215
|
+
=== Logging
|
|
216
|
+
|
|
217
|
+
As mentioned in the setup above, the logger can be customized as follows:
|
|
218
|
+
|
|
219
|
+
[source,ruby]
|
|
220
|
+
----
|
|
221
|
+
# This is the default logger silences all logging attempts.
|
|
222
|
+
Auther::NullLogger.new
|
|
223
|
+
|
|
224
|
+
# Can be used to log to the environment log.
|
|
225
|
+
ActiveSupport::Logger.new "log/#{Rails.env}.log"
|
|
226
|
+
|
|
227
|
+
# Can be used to log to standard output.
|
|
228
|
+
Logger.new STDOUT
|
|
229
|
+
----
|
|
230
|
+
|
|
231
|
+
When logging is enabled, you'll be able to see the following information in the server logs to help
|
|
232
|
+
debug custom Auther settings:
|
|
233
|
+
|
|
234
|
+
* Requested path and excluded path detection.
|
|
235
|
+
* Finding (or not finding) of account.
|
|
236
|
+
* Account authentication pass/fail.
|
|
237
|
+
* Account and path authorization pass/fail.
|
|
238
|
+
|
|
239
|
+
=== Troubleshooting
|
|
240
|
+
|
|
241
|
+
* If upgrading Rails, changing the cookie/session settings, generating a new secret base key, etc.
|
|
242
|
+
this might cause Auther authentication to fail. Make sure to clear your browser cookies in this
|
|
243
|
+
situation or use Google Chrome (incognito mode) to verify.
|
|
244
|
+
* If the authentication view/form looks broken (stylewise) this could be due to custom
|
|
245
|
+
`ActionView::Base.field_error_proc` settings defined by your app (usually via an initializer).
|
|
246
|
+
Auther uses this configuration `ActionView::Base.field_error_proc = proc { |html_tag, _|
|
|
247
|
+
html_tag.html_safe }` so that no additional markup is added to the DOM when errors are raised. If
|
|
248
|
+
you have customized this to something else, you might want to read the usage documentation
|
|
249
|
+
(mentioned above) to rebuild the authentication view/form for your specific business needs.
|
|
250
|
+
|
|
251
|
+
== Tests
|
|
252
|
+
|
|
253
|
+
To test, run:
|
|
254
|
+
|
|
255
|
+
[source,bash]
|
|
256
|
+
----
|
|
257
|
+
bundle exec rake
|
|
258
|
+
----
|
|
259
|
+
|
|
260
|
+
== Versioning
|
|
261
|
+
|
|
262
|
+
Read link:https://semver.org[Semantic Versioning] for details. Briefly, it means:
|
|
263
|
+
|
|
264
|
+
* Major (X.y.z) - Incremented for any backwards incompatible public API changes.
|
|
265
|
+
* Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
|
|
266
|
+
* Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
|
|
267
|
+
|
|
268
|
+
== Code of Conduct
|
|
269
|
+
|
|
270
|
+
Please note that this project is released with a link:CODE_OF_CONDUCT.adoc[CODE OF CONDUCT]. By
|
|
271
|
+
participating in this project you agree to abide by its terms.
|
|
272
|
+
|
|
273
|
+
== Contributions
|
|
274
|
+
|
|
275
|
+
Read link:CONTRIBUTING.adoc[CONTRIBUTING] for details.
|
|
276
|
+
|
|
277
|
+
== License
|
|
278
|
+
|
|
279
|
+
Read link:LICENSE.adoc[LICENSE] for details.
|
|
280
|
+
|
|
281
|
+
== History
|
|
282
|
+
|
|
283
|
+
Read link:CHANGES.adoc[CHANGES] for details.
|
|
284
|
+
|
|
285
|
+
== Credits
|
|
286
|
+
|
|
287
|
+
Engineered by link:https://www.alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
|
|
@@ -6,7 +6,7 @@ module Auther
|
|
|
6
6
|
protect_from_forgery with: :exception
|
|
7
7
|
|
|
8
8
|
def show
|
|
9
|
-
redirect_to settings.
|
|
9
|
+
redirect_to settings.url
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def new
|
|
@@ -15,7 +15,7 @@ module Auther
|
|
|
15
15
|
|
|
16
16
|
# rubocop:disable Metrics/AbcSize
|
|
17
17
|
def create
|
|
18
|
-
@account = Auther::Presenter::Account.new
|
|
18
|
+
@account = Auther::Presenter::Account.new(**account_params.to_h.symbolize_keys)
|
|
19
19
|
account = Auther::Account[settings.find_account(@account.name)]
|
|
20
20
|
authenticator = Auther::Authenticator.new settings.secret, account, @account
|
|
21
21
|
|
|
@@ -30,7 +30,7 @@ module Auther
|
|
|
30
30
|
# rubocop:enable Metrics/AbcSize
|
|
31
31
|
|
|
32
32
|
def destroy
|
|
33
|
-
account = Auther::Account[settings.find_account(params[:name])]
|
|
33
|
+
account = Auther::Account[**settings.find_account(params[:name])]
|
|
34
34
|
remove_credentials account
|
|
35
35
|
redirect_to deauthorized_url(account)
|
|
36
36
|
end
|
|
@@ -69,7 +69,7 @@ module Auther
|
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
def deauthorized_url account
|
|
72
|
-
account.deauthorized_url || settings.
|
|
72
|
+
account.deauthorized_url || settings.url
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
def store_credentials account
|
data/lib/auther/authenticator.rb
CHANGED
|
@@ -36,7 +36,7 @@ module Auther
|
|
|
36
36
|
account_presenter.errors.add error_name, "is invalid"
|
|
37
37
|
false
|
|
38
38
|
end
|
|
39
|
-
rescue ActiveSupport::
|
|
39
|
+
rescue ActiveSupport::MessageEncryptor::InvalidMessage
|
|
40
40
|
log_info %(Authentication failed! Invalid credential(s) for "#{account_model.name}" account.)
|
|
41
41
|
false
|
|
42
42
|
end
|
data/lib/auther/gatekeeper.rb
CHANGED
|
@@ -21,7 +21,7 @@ module Auther
|
|
|
21
21
|
else
|
|
22
22
|
session[Auther::Keymaster.redirect_url_key] = request.path
|
|
23
23
|
denied_response = response
|
|
24
|
-
denied_response.redirect settings.
|
|
24
|
+
denied_response.redirect settings.url
|
|
25
25
|
denied_response.finish
|
|
26
26
|
end
|
|
27
27
|
end
|
|
@@ -108,7 +108,7 @@ module Auther
|
|
|
108
108
|
authenticated = account_authenticated? account
|
|
109
109
|
log_authentication authenticated, account.fetch(:name)
|
|
110
110
|
authenticated
|
|
111
|
-
rescue ActiveSupport::
|
|
111
|
+
rescue ActiveSupport::MessageEncryptor::InvalidMessage
|
|
112
112
|
log_info %(Authentication failed! Invalid credential(s) for "#{account.fetch :name}" account.)
|
|
113
113
|
false
|
|
114
114
|
end
|
data/lib/auther/identity.rb
CHANGED
|
@@ -3,20 +3,9 @@
|
|
|
3
3
|
module Auther
|
|
4
4
|
# Gem identity information.
|
|
5
5
|
module Identity
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def self.label
|
|
11
|
-
"Auther"
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def self.version
|
|
15
|
-
"10.2.2"
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def self.version_label
|
|
19
|
-
"#{label} #{version}"
|
|
20
|
-
end
|
|
6
|
+
NAME = "auther"
|
|
7
|
+
LABEL = "Auther"
|
|
8
|
+
VERSION = "11.2.0"
|
|
9
|
+
VERSION_LABEL = "#{LABEL} #{VERSION}"
|
|
21
10
|
end
|
|
22
11
|
end
|
data/lib/auther/settings.rb
CHANGED
|
@@ -2,25 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
module Auther
|
|
4
4
|
# Represents Auther settings.
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Settings = Struct.new :title, :label, :secret, :accounts, :url, :logger, keyword_init: true do
|
|
6
|
+
def initialize *arguments
|
|
7
|
+
super
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
logger: Auther::NullLogger.new(STDOUT)
|
|
15
|
-
|
|
16
|
-
@title = title
|
|
17
|
-
@label = label
|
|
18
|
-
@secret = secret
|
|
19
|
-
@accounts = accounts
|
|
20
|
-
@auth_url = auth_url
|
|
21
|
-
@logger = logger
|
|
9
|
+
self[:title] ||= "Authorization"
|
|
10
|
+
self[:label] ||= "Authorization"
|
|
11
|
+
self[:secret] ||= ""
|
|
12
|
+
self[:accounts] ||= []
|
|
13
|
+
self[:url] ||= "/login"
|
|
14
|
+
self[:logger] ||= Auther::NullLogger.new STDOUT
|
|
22
15
|
end
|
|
23
|
-
# rubocop:enable Metrics/ParameterLists
|
|
24
16
|
|
|
25
17
|
def find_account name
|
|
26
18
|
accounts.find { |account| account.fetch(:name) == name }
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Rails.application.config.auther_settings = {
|
|
4
4
|
accounts: [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
{
|
|
6
|
+
name: "admin",
|
|
7
|
+
encrypted_login: ENV["AUTHER_ADMIN_LOGIN"],
|
|
8
|
+
encrypted_password: ENV["AUTHER_ADMIN_PASSWORD"],
|
|
9
|
+
paths: ["/admin"]
|
|
10
|
+
}
|
|
9
11
|
],
|
|
10
12
|
secret: ENV["AUTHER_SECRET"]
|
|
11
13
|
}
|
metadata
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: auther
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 11.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brooke Kuhlmann
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain:
|
|
11
11
|
- |
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
|
13
|
-
MIIC/
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
MIIC/jCCAeagAwIBAgIBAzANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
|
|
14
|
+
a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0yMDAzMTUxNDQ1MzJaFw0yMTAzMTUx
|
|
15
|
+
NDQ1MzJaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
|
|
16
16
|
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6l1qpXTiomH1RfMRloyw7MiE
|
|
17
17
|
xyVx/x8Yc3EupdH7uhNaTXQGyORN6aOY//1QXXMHIZ9tW74nZLhesWMSUMYy0XhB
|
|
18
18
|
brs+KkurHnc9FnEJAbG7ebGvl/ncqZt72nQvaxpDxvuCBHgJAz+8i5wl6FhLw+oT
|
|
@@ -20,15 +20,15 @@ cert_chain:
|
|
|
20
20
|
D5vkU0YlAm1r98BymuJlcQ1qdkVEI1d48ph4kcS0S0nv1RiuyVb6TCAR3Nu3VaVq
|
|
21
21
|
3fPzZKJLZBx67UvXdbdicWPiUR75elI4PXpLIic3xytaF52ZJYyKZCNZJhNwfQID
|
|
22
22
|
AQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU0nzow9vc
|
|
23
|
-
2CdikiiE3fJhP/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
2CdikiiE3fJhP/gY4ggwDQYJKoZIhvcNAQELBQADggEBAIHhAlD3po4sTYqacXaQ
|
|
24
|
+
XI9jIhrfMy//2PgbHWcETtlJPBeNUbbSNBABcllUHKqYsVDlSvSmss034KSWNR8F
|
|
25
|
+
bF1GcloicyvcCC4y6IoW4it0COAcdeaaxkxiBSgKdQFpff9REnDlIKK4uQ9lLxIo
|
|
26
|
+
Y2G5xubiziKZkyfWFuSr67PIjW3Bu673D1JVBArhA1qbgQmYQcy1CkGOjo+iO8Nf
|
|
27
|
+
7u/QSfBHb+r/bXhKscDgPpnKwbUmvgO2+94zJG9KsrmIydlzYfsD09aXKx0t6Xy4
|
|
28
|
+
2XV8FRa7/JimI07sPLC13eLY3xd/aYTi85Z782KIA4j0G8XEEWAX0ouBhlXPocZv
|
|
29
|
+
QWc=
|
|
30
30
|
-----END CERTIFICATE-----
|
|
31
|
-
date:
|
|
31
|
+
date: 2020-07-23 00:00:00.000000000 Z
|
|
32
32
|
dependencies:
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
34
|
name: rails
|
|
@@ -36,42 +36,42 @@ dependencies:
|
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '
|
|
39
|
+
version: '6.0'
|
|
40
40
|
type: :runtime
|
|
41
41
|
prerelease: false
|
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - "~>"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '
|
|
46
|
+
version: '6.0'
|
|
47
47
|
- !ruby/object:Gem::Dependency
|
|
48
48
|
name: sass-rails
|
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - "~>"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '
|
|
53
|
+
version: '6.0'
|
|
54
54
|
type: :runtime
|
|
55
55
|
prerelease: false
|
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
58
|
- - "~>"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '
|
|
60
|
+
version: '6.0'
|
|
61
61
|
- !ruby/object:Gem::Dependency
|
|
62
62
|
name: slim-rails
|
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
65
|
- - "~>"
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '3.
|
|
67
|
+
version: '3.2'
|
|
68
68
|
type: :runtime
|
|
69
69
|
prerelease: false
|
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
|
71
71
|
requirements:
|
|
72
72
|
- - "~>"
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: '3.
|
|
74
|
+
version: '3.2'
|
|
75
75
|
- !ruby/object:Gem::Dependency
|
|
76
76
|
name: ammeter
|
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -86,34 +86,6 @@ dependencies:
|
|
|
86
86
|
- - "~>"
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
88
|
version: '1.1'
|
|
89
|
-
- !ruby/object:Gem::Dependency
|
|
90
|
-
name: awesome_print
|
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
|
92
|
-
requirements:
|
|
93
|
-
- - "~>"
|
|
94
|
-
- !ruby/object:Gem::Version
|
|
95
|
-
version: '1.8'
|
|
96
|
-
type: :development
|
|
97
|
-
prerelease: false
|
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
99
|
-
requirements:
|
|
100
|
-
- - "~>"
|
|
101
|
-
- !ruby/object:Gem::Version
|
|
102
|
-
version: '1.8'
|
|
103
|
-
- !ruby/object:Gem::Dependency
|
|
104
|
-
name: bond
|
|
105
|
-
requirement: !ruby/object:Gem::Requirement
|
|
106
|
-
requirements:
|
|
107
|
-
- - "~>"
|
|
108
|
-
- !ruby/object:Gem::Version
|
|
109
|
-
version: '0.5'
|
|
110
|
-
type: :development
|
|
111
|
-
prerelease: false
|
|
112
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
113
|
-
requirements:
|
|
114
|
-
- - "~>"
|
|
115
|
-
- !ruby/object:Gem::Version
|
|
116
|
-
version: '0.5'
|
|
117
89
|
- !ruby/object:Gem::Dependency
|
|
118
90
|
name: bundler-audit
|
|
119
91
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -134,28 +106,28 @@ dependencies:
|
|
|
134
106
|
requirements:
|
|
135
107
|
- - "~>"
|
|
136
108
|
- !ruby/object:Gem::Version
|
|
137
|
-
version: '
|
|
109
|
+
version: '14.2'
|
|
138
110
|
type: :development
|
|
139
111
|
prerelease: false
|
|
140
112
|
version_requirements: !ruby/object:Gem::Requirement
|
|
141
113
|
requirements:
|
|
142
114
|
- - "~>"
|
|
143
115
|
- !ruby/object:Gem::Version
|
|
144
|
-
version: '
|
|
116
|
+
version: '14.2'
|
|
145
117
|
- !ruby/object:Gem::Dependency
|
|
146
|
-
name: git-
|
|
118
|
+
name: git-lint
|
|
147
119
|
requirement: !ruby/object:Gem::Requirement
|
|
148
120
|
requirements:
|
|
149
121
|
- - "~>"
|
|
150
122
|
- !ruby/object:Gem::Version
|
|
151
|
-
version: '
|
|
123
|
+
version: '1.0'
|
|
152
124
|
type: :development
|
|
153
125
|
prerelease: false
|
|
154
126
|
version_requirements: !ruby/object:Gem::Requirement
|
|
155
127
|
requirements:
|
|
156
128
|
- - "~>"
|
|
157
129
|
- !ruby/object:Gem::Version
|
|
158
|
-
version: '
|
|
130
|
+
version: '1.0'
|
|
159
131
|
- !ruby/object:Gem::Dependency
|
|
160
132
|
name: guard-rspec
|
|
161
133
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -170,185 +142,171 @@ dependencies:
|
|
|
170
142
|
- - "~>"
|
|
171
143
|
- !ruby/object:Gem::Version
|
|
172
144
|
version: '4.7'
|
|
173
|
-
- !ruby/object:Gem::Dependency
|
|
174
|
-
name: hirb
|
|
175
|
-
requirement: !ruby/object:Gem::Requirement
|
|
176
|
-
requirements:
|
|
177
|
-
- - "~>"
|
|
178
|
-
- !ruby/object:Gem::Version
|
|
179
|
-
version: '0.7'
|
|
180
|
-
type: :development
|
|
181
|
-
prerelease: false
|
|
182
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
183
|
-
requirements:
|
|
184
|
-
- - "~>"
|
|
185
|
-
- !ruby/object:Gem::Version
|
|
186
|
-
version: '0.7'
|
|
187
145
|
- !ruby/object:Gem::Dependency
|
|
188
146
|
name: pg
|
|
189
147
|
requirement: !ruby/object:Gem::Requirement
|
|
190
148
|
requirements:
|
|
191
149
|
- - "~>"
|
|
192
150
|
- !ruby/object:Gem::Version
|
|
193
|
-
version: '1.
|
|
151
|
+
version: '1.2'
|
|
194
152
|
type: :development
|
|
195
153
|
prerelease: false
|
|
196
154
|
version_requirements: !ruby/object:Gem::Requirement
|
|
197
155
|
requirements:
|
|
198
156
|
- - "~>"
|
|
199
157
|
- !ruby/object:Gem::Version
|
|
200
|
-
version: '1.
|
|
158
|
+
version: '1.2'
|
|
201
159
|
- !ruby/object:Gem::Dependency
|
|
202
160
|
name: pry
|
|
203
161
|
requirement: !ruby/object:Gem::Requirement
|
|
204
162
|
requirements:
|
|
205
163
|
- - "~>"
|
|
206
164
|
- !ruby/object:Gem::Version
|
|
207
|
-
version: '0.
|
|
165
|
+
version: '0.13'
|
|
208
166
|
type: :development
|
|
209
167
|
prerelease: false
|
|
210
168
|
version_requirements: !ruby/object:Gem::Requirement
|
|
211
169
|
requirements:
|
|
212
170
|
- - "~>"
|
|
213
171
|
- !ruby/object:Gem::Version
|
|
214
|
-
version: '0.
|
|
172
|
+
version: '0.13'
|
|
215
173
|
- !ruby/object:Gem::Dependency
|
|
216
174
|
name: pry-byebug
|
|
217
175
|
requirement: !ruby/object:Gem::Requirement
|
|
218
176
|
requirements:
|
|
219
177
|
- - "~>"
|
|
220
178
|
- !ruby/object:Gem::Version
|
|
221
|
-
version: '3.
|
|
179
|
+
version: '3.9'
|
|
222
180
|
type: :development
|
|
223
181
|
prerelease: false
|
|
224
182
|
version_requirements: !ruby/object:Gem::Requirement
|
|
225
183
|
requirements:
|
|
226
184
|
- - "~>"
|
|
227
185
|
- !ruby/object:Gem::Version
|
|
228
|
-
version: '3.
|
|
186
|
+
version: '3.9'
|
|
229
187
|
- !ruby/object:Gem::Dependency
|
|
230
188
|
name: rake
|
|
231
189
|
requirement: !ruby/object:Gem::Requirement
|
|
232
190
|
requirements:
|
|
233
191
|
- - "~>"
|
|
234
192
|
- !ruby/object:Gem::Version
|
|
235
|
-
version: '
|
|
193
|
+
version: '13.0'
|
|
236
194
|
type: :development
|
|
237
195
|
prerelease: false
|
|
238
196
|
version_requirements: !ruby/object:Gem::Requirement
|
|
239
197
|
requirements:
|
|
240
198
|
- - "~>"
|
|
241
199
|
- !ruby/object:Gem::Version
|
|
242
|
-
version: '
|
|
200
|
+
version: '13.0'
|
|
243
201
|
- !ruby/object:Gem::Dependency
|
|
244
202
|
name: reek
|
|
245
203
|
requirement: !ruby/object:Gem::Requirement
|
|
246
204
|
requirements:
|
|
247
205
|
- - "~>"
|
|
248
206
|
- !ruby/object:Gem::Version
|
|
249
|
-
version: '
|
|
207
|
+
version: '6.0'
|
|
250
208
|
type: :development
|
|
251
209
|
prerelease: false
|
|
252
210
|
version_requirements: !ruby/object:Gem::Requirement
|
|
253
211
|
requirements:
|
|
254
212
|
- - "~>"
|
|
255
213
|
- !ruby/object:Gem::Version
|
|
256
|
-
version: '
|
|
214
|
+
version: '6.0'
|
|
257
215
|
- !ruby/object:Gem::Dependency
|
|
258
216
|
name: rspec-rails
|
|
259
217
|
requirement: !ruby/object:Gem::Requirement
|
|
260
218
|
requirements:
|
|
261
219
|
- - "~>"
|
|
262
220
|
- !ruby/object:Gem::Version
|
|
263
|
-
version: '
|
|
221
|
+
version: '4.0'
|
|
264
222
|
type: :development
|
|
265
223
|
prerelease: false
|
|
266
224
|
version_requirements: !ruby/object:Gem::Requirement
|
|
267
225
|
requirements:
|
|
268
226
|
- - "~>"
|
|
269
227
|
- !ruby/object:Gem::Version
|
|
270
|
-
version: '
|
|
228
|
+
version: '4.0'
|
|
271
229
|
- !ruby/object:Gem::Dependency
|
|
272
230
|
name: rubocop
|
|
273
231
|
requirement: !ruby/object:Gem::Requirement
|
|
274
232
|
requirements:
|
|
275
233
|
- - "~>"
|
|
276
234
|
- !ruby/object:Gem::Version
|
|
277
|
-
version: '0.
|
|
235
|
+
version: '0.83'
|
|
278
236
|
type: :development
|
|
279
237
|
prerelease: false
|
|
280
238
|
version_requirements: !ruby/object:Gem::Requirement
|
|
281
239
|
requirements:
|
|
282
240
|
- - "~>"
|
|
283
241
|
- !ruby/object:Gem::Version
|
|
284
|
-
version: '0.
|
|
242
|
+
version: '0.83'
|
|
285
243
|
- !ruby/object:Gem::Dependency
|
|
286
244
|
name: rubocop-performance
|
|
287
245
|
requirement: !ruby/object:Gem::Requirement
|
|
288
246
|
requirements:
|
|
289
247
|
- - "~>"
|
|
290
248
|
- !ruby/object:Gem::Version
|
|
291
|
-
version: '1.
|
|
249
|
+
version: '1.5'
|
|
292
250
|
type: :development
|
|
293
251
|
prerelease: false
|
|
294
252
|
version_requirements: !ruby/object:Gem::Requirement
|
|
295
253
|
requirements:
|
|
296
254
|
- - "~>"
|
|
297
255
|
- !ruby/object:Gem::Version
|
|
298
|
-
version: '1.
|
|
256
|
+
version: '1.5'
|
|
299
257
|
- !ruby/object:Gem::Dependency
|
|
300
|
-
name: rubocop-
|
|
258
|
+
name: rubocop-rake
|
|
301
259
|
requirement: !ruby/object:Gem::Requirement
|
|
302
260
|
requirements:
|
|
303
261
|
- - "~>"
|
|
304
262
|
- !ruby/object:Gem::Version
|
|
305
|
-
version: '
|
|
263
|
+
version: '0.5'
|
|
306
264
|
type: :development
|
|
307
265
|
prerelease: false
|
|
308
266
|
version_requirements: !ruby/object:Gem::Requirement
|
|
309
267
|
requirements:
|
|
310
268
|
- - "~>"
|
|
311
269
|
- !ruby/object:Gem::Version
|
|
312
|
-
version: '
|
|
270
|
+
version: '0.5'
|
|
313
271
|
- !ruby/object:Gem::Dependency
|
|
314
|
-
name:
|
|
272
|
+
name: rubocop-rspec
|
|
315
273
|
requirement: !ruby/object:Gem::Requirement
|
|
316
274
|
requirements:
|
|
317
275
|
- - "~>"
|
|
318
276
|
- !ruby/object:Gem::Version
|
|
319
|
-
version: '
|
|
277
|
+
version: '1.39'
|
|
320
278
|
type: :development
|
|
321
279
|
prerelease: false
|
|
322
280
|
version_requirements: !ruby/object:Gem::Requirement
|
|
323
281
|
requirements:
|
|
324
282
|
- - "~>"
|
|
325
283
|
- !ruby/object:Gem::Version
|
|
326
|
-
version: '
|
|
284
|
+
version: '1.39'
|
|
327
285
|
- !ruby/object:Gem::Dependency
|
|
328
|
-
name:
|
|
286
|
+
name: simplecov
|
|
329
287
|
requirement: !ruby/object:Gem::Requirement
|
|
330
288
|
requirements:
|
|
331
289
|
- - "~>"
|
|
332
290
|
- !ruby/object:Gem::Version
|
|
333
|
-
version: '
|
|
291
|
+
version: '0.18'
|
|
334
292
|
type: :development
|
|
335
293
|
prerelease: false
|
|
336
294
|
version_requirements: !ruby/object:Gem::Requirement
|
|
337
295
|
requirements:
|
|
338
296
|
- - "~>"
|
|
339
297
|
- !ruby/object:Gem::Version
|
|
340
|
-
version: '
|
|
341
|
-
description:
|
|
298
|
+
version: '0.18'
|
|
299
|
+
description:
|
|
342
300
|
email:
|
|
343
301
|
- brooke@alchemists.io
|
|
344
302
|
executables: []
|
|
345
303
|
extensions: []
|
|
346
304
|
extra_rdoc_files:
|
|
347
|
-
- README.
|
|
348
|
-
- LICENSE.
|
|
305
|
+
- README.adoc
|
|
306
|
+
- LICENSE.adoc
|
|
349
307
|
files:
|
|
350
|
-
- LICENSE.
|
|
351
|
-
- README.
|
|
308
|
+
- LICENSE.adoc
|
|
309
|
+
- README.adoc
|
|
352
310
|
- app/assets/stylesheets/auther/application.scss
|
|
353
311
|
- app/assets/stylesheets/auther/auther.scss
|
|
354
312
|
- app/controllers/auther/base_controller.rb
|
|
@@ -370,14 +328,15 @@ files:
|
|
|
370
328
|
- lib/generators/auther/credentials/credentials_generator.rb
|
|
371
329
|
- lib/generators/auther/install/install_generator.rb
|
|
372
330
|
- lib/generators/auther/templates/config/initializers/auther.rb
|
|
373
|
-
homepage: https://
|
|
331
|
+
homepage: https://www.alchemists.io/projects/auther
|
|
374
332
|
licenses:
|
|
375
333
|
- Apache-2.0
|
|
376
334
|
metadata:
|
|
377
|
-
source_code_uri: https://github.com/bkuhlmann/auther
|
|
378
|
-
changelog_uri: https://github.com/bkuhlmann/auther/blob/master/CHANGES.md
|
|
379
335
|
bug_tracker_uri: https://github.com/bkuhlmann/auther/issues
|
|
380
|
-
|
|
336
|
+
changelog_uri: https://www.alchemists.io/projects/auther/changes.html
|
|
337
|
+
documentation_uri: https://www.alchemists.io/projects/auther
|
|
338
|
+
source_code_uri: https://github.com/bkuhlmann/auther
|
|
339
|
+
post_install_message:
|
|
381
340
|
rdoc_options: []
|
|
382
341
|
require_paths:
|
|
383
342
|
- lib
|
|
@@ -385,15 +344,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
385
344
|
requirements:
|
|
386
345
|
- - "~>"
|
|
387
346
|
- !ruby/object:Gem::Version
|
|
388
|
-
version: '2.
|
|
347
|
+
version: '2.7'
|
|
389
348
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
390
349
|
requirements:
|
|
391
350
|
- - ">="
|
|
392
351
|
- !ruby/object:Gem::Version
|
|
393
352
|
version: '0'
|
|
394
353
|
requirements: []
|
|
395
|
-
rubygems_version: 3.
|
|
396
|
-
signing_key:
|
|
354
|
+
rubygems_version: 3.1.4
|
|
355
|
+
signing_key:
|
|
397
356
|
specification_version: 4
|
|
398
357
|
summary: Enhances Rails with multi-account, form-based, database-less, application-wide
|
|
399
358
|
authentication.
|
metadata.gz.sig
CHANGED
|
Binary file
|
data/README.md
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img src="auther.png" alt="Auther Icon"/>
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
# Auther
|
|
6
|
-
|
|
7
|
-
[](http://badge.fury.io/rb/auther)
|
|
8
|
-
[](https://codeclimate.com/github/bkuhlmann/auther/maintainability)
|
|
9
|
-
[](https://codeclimate.com/github/bkuhlmann/auther/test_coverage)
|
|
10
|
-
[](https://circleci.com/gh/bkuhlmann/auther)
|
|
11
|
-
|
|
12
|
-
Provides simple, form-based authentication for apps that need security but don't want to deal with
|
|
13
|
-
the clunky UI of HTTP Basic Authentication or something as heavyweight as
|
|
14
|
-
[Devise](https://github.com/plataformatec/devise). It doesn't require a database and is compatible
|
|
15
|
-
with password managers like [1Password](https://agilebits.com/onepassword) making for a pleasant
|
|
16
|
-
user experience.
|
|
17
|
-
|
|
18
|
-
<!-- Tocer[start]: Auto-generated, don't remove. -->
|
|
19
|
-
|
|
20
|
-
## Table of Contents
|
|
21
|
-
|
|
22
|
-
- [Features](#features)
|
|
23
|
-
- [Requirements](#requirements)
|
|
24
|
-
- [Setup](#setup)
|
|
25
|
-
- [Usage](#usage)
|
|
26
|
-
- [Initializer](#initializer)
|
|
27
|
-
- [Routes](#routes)
|
|
28
|
-
- [Model](#model)
|
|
29
|
-
- [Presenter](#presenter)
|
|
30
|
-
- [View](#view)
|
|
31
|
-
- [Controller](#controller)
|
|
32
|
-
- [Logging](#logging)
|
|
33
|
-
- [Troubleshooting](#troubleshooting)
|
|
34
|
-
- [Tests](#tests)
|
|
35
|
-
- [Versioning](#versioning)
|
|
36
|
-
- [Code of Conduct](#code-of-conduct)
|
|
37
|
-
- [Contributions](#contributions)
|
|
38
|
-
- [License](#license)
|
|
39
|
-
- [History](#history)
|
|
40
|
-
- [Credits](#credits)
|
|
41
|
-
|
|
42
|
-
<!-- Tocer[finish]: Auto-generated, don't remove. -->
|
|
43
|
-
|
|
44
|
-
## Features
|
|
45
|
-
|
|
46
|
-
- Supports form-based authentication compatible with password managers like
|
|
47
|
-
[1Password](https://agilebits.com/onepassword).
|
|
48
|
-
|
|
49
|
-

|
|
50
|
-

|
|
51
|
-
|
|
52
|
-
- Uses CSS Flexbox for lightweight styling.
|
|
53
|
-
- Uses encrypted account credentials to keep sensitive information secure.
|
|
54
|
-
- Supports multiple accounts with optional path exclude lists.
|
|
55
|
-
- Supports customizable routes, models, presenters, views, controllers, and loggers.
|
|
56
|
-
- Provides a generator for easy install and setup within an existing project.
|
|
57
|
-
- Provides auto-redirection to requested path for verified credentials.
|
|
58
|
-
|
|
59
|
-
## Requirements
|
|
60
|
-
|
|
61
|
-
1. [Ruby 2.6.x](https://www.ruby-lang.org).
|
|
62
|
-
1. [Ruby on Rails 5.x.x](http://rubyonrails.org).
|
|
63
|
-
|
|
64
|
-
## Setup
|
|
65
|
-
|
|
66
|
-
Type the following to install:
|
|
67
|
-
|
|
68
|
-
gem install auther
|
|
69
|
-
|
|
70
|
-
Add the following to your Gemfile:
|
|
71
|
-
|
|
72
|
-
gem "auther"
|
|
73
|
-
|
|
74
|
-
Run the install generator to configure and initialize your application:
|
|
75
|
-
|
|
76
|
-
rails generate auther:install
|
|
77
|
-
|
|
78
|
-
Run the credentials generator to generate credentials for your application:
|
|
79
|
-
|
|
80
|
-
rails generate auther:credentials
|
|
81
|
-
|
|
82
|
-
If using [direnv](https://direnv.net), for example, you can copy and paste the generated credentials
|
|
83
|
-
into your `.envrc` file. Example:
|
|
84
|
-
|
|
85
|
-

|
|
86
|
-
|
|
87
|
-
## Usage
|
|
88
|
-
|
|
89
|
-
Launch your Rails application and visit the following:
|
|
90
|
-
|
|
91
|
-
http://localhost:3000/login
|
|
92
|
-
|
|
93
|
-
Enter your login and password as used for the `rails generate auther:credentials` generator and
|
|
94
|
-
you'll be logged in.
|
|
95
|
-
|
|
96
|
-
### Initializer
|
|
97
|
-
|
|
98
|
-
The initializer (installed during setup) can be found here:
|
|
99
|
-
|
|
100
|
-
config/initializers/auther.rb
|
|
101
|
-
|
|
102
|
-
The initializer comes installed with the following settings:
|
|
103
|
-
|
|
104
|
-
Rails.application.config.auther_settings = {
|
|
105
|
-
accounts: [
|
|
106
|
-
name: "admin",
|
|
107
|
-
encrypted_login: ENV["AUTHER_ADMIN_LOGIN"],
|
|
108
|
-
encrypted_password: ENV["AUTHER_ADMIN_PASSWORD"],
|
|
109
|
-
paths: ["/admin"]
|
|
110
|
-
],
|
|
111
|
-
secret: ENV["AUTHER_SECRET"]
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
To encrypt/decrypt account credentials, launch a rails console and run the following:
|
|
115
|
-
|
|
116
|
-
# The secret as defined in `auther_settings` and/or produced by the credentials generator.
|
|
117
|
-
secret = SecureRandom.hex 16 # "426a7f46548a1a4518676a8e246517d8"
|
|
118
|
-
|
|
119
|
-
# The cipher for encrypting/decrypting values.
|
|
120
|
-
cipher = Auther::Cipher.new secret
|
|
121
|
-
|
|
122
|
-
# Use the following to encrypt an unecrypted value.
|
|
123
|
-
cipher.encrypt "test@test.com"
|
|
124
|
-
|
|
125
|
-
# Use the following to decrypt an encrypted value.
|
|
126
|
-
cipher.decrypt "hWToltdpl+uZJBPELKNC7Ij++jPkTuo=--nEdbOYL9fIRh14hY--fU+VSCd4+DDOhOmG1gzRfQ=="
|
|
127
|
-
|
|
128
|
-
The initializer can be customized as follows:
|
|
129
|
-
|
|
130
|
-
- *title* - Optional. The HTML page title (as rendered within a browser tab). Default:
|
|
131
|
-
"Authorization".
|
|
132
|
-
- *label* - Optional. The page label (what would appear above the form). Default: "Authorization".
|
|
133
|
-
- *secret* - Required. The secret passphrase used to encrypt/decrypt account credentials.
|
|
134
|
-
- *accounts* - Required. The array of accounts with different or similar access to the application.
|
|
135
|
-
- *name* - Required. The account name that uniquely identifies the account.
|
|
136
|
-
- *encrypted_login* - Required. The encrypted account login.
|
|
137
|
-
- *encrypted_password* - Required. The encrypted account password.
|
|
138
|
-
- *paths* - Required. The array of excluded paths for which only this account has access to.
|
|
139
|
-
- *authorized_url* - Optional. The URL to redirect to upon successful authorization. Authorized
|
|
140
|
-
redirection works in the order defined:
|
|
141
|
-
- The excluded path (if requested prior to authorization but now authorized).
|
|
142
|
-
- The authorized URL (if defined and the excluded path wasn't requested).
|
|
143
|
-
- The root path (if none of the above).
|
|
144
|
-
- *deauthorized_url* - Optional. The URL to redirect to upon successful deauthorization (i.e.
|
|
145
|
-
logout). Deauthorized redirections works as follows (in the order defined):
|
|
146
|
-
- The deauthorized URL (if defined).
|
|
147
|
-
- The auth URL.
|
|
148
|
-
- *auth_url* - Optional. The URL to redirect to when enforcing authentication. Default: “/login”.
|
|
149
|
-
- *logger* - Optional. The logger used to log path/account authorization messages. Default:
|
|
150
|
-
`Auther::NullLogger`.
|
|
151
|
-
|
|
152
|
-
### Routes
|
|
153
|
-
|
|
154
|
-
The routes can be customized as follows (installed, by default, via the install generator):
|
|
155
|
-
|
|
156
|
-
Rails.application.routes.draw do
|
|
157
|
-
mount Auther::Engine => "/auther"
|
|
158
|
-
get "/login", to: "auther/session#new", as: "login"
|
|
159
|
-
delete "/logout", to: "auther/session#destroy", as: "logout"
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
### Model
|
|
163
|
-
|
|
164
|
-
The [Auther::Account](app/models/auther/account.rb) is a struct that uses ActiveModel validations to
|
|
165
|
-
aid in attribute validation. This model could potentially be replaced with a database-backed object
|
|
166
|
-
(would require controller customization)...but you should question if you have outgrown the use of
|
|
167
|
-
this gem and need a different solution altogether if it comes to that.
|
|
168
|
-
|
|
169
|
-
### Presenter
|
|
170
|
-
|
|
171
|
-
The [Auther::Presenter::Account](app/presenters/auther/account.rb) is a plain old Ruby object that
|
|
172
|
-
uses ActiveModel validations to aid in form validation. This presenter makes it easy to construct
|
|
173
|
-
form data for input and validation.
|
|
174
|
-
|
|
175
|
-
### View
|
|
176
|
-
|
|
177
|
-
The view can be customized by creating the following file within your Rails application (assumes
|
|
178
|
-
that the default Auther::SessionController implementation is sufficient):
|
|
179
|
-
|
|
180
|
-
app/views/auther/session/new.html
|
|
181
|
-
|
|
182
|
-
The form uses the `@account` instance variable which is an instance of the
|
|
183
|
-
Auther::Presenter::Account presenter (as mentioned above). The form can be stylized by modifying the
|
|
184
|
-
styles found in the [auther.scss](app/assets/stylesheets/auther/auther.scss) stylesheet.
|
|
185
|
-
|
|
186
|
-
### Controller
|
|
187
|
-
|
|
188
|
-
The [Auther::SessionController](app/controllers/auther/session_controller.rb) inherits from the
|
|
189
|
-
[Auther::BaseController](app/controllers/auther/base_controller.rb). To customize, it is recommended
|
|
190
|
-
that you add a controller to your app that inherits from the Auther::BaseController. Example:
|
|
191
|
-
|
|
192
|
-
# Example Path: app/controllers/session_controller.rb
|
|
193
|
-
class SessionController < Auther::BaseController
|
|
194
|
-
layout "example"
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
This allows customization of session controller behavior to serve any special business needs. See
|
|
198
|
-
the `Auther::BaseController` for additional details or the `Auther::SessionController` for default
|
|
199
|
-
implementation.
|
|
200
|
-
|
|
201
|
-
### Logging
|
|
202
|
-
|
|
203
|
-
As mentioned in the setup above, the logger can be customized as follows:
|
|
204
|
-
|
|
205
|
-
Auther::NullLogger.new # This is the default logger (which is no logging at all).
|
|
206
|
-
ActiveSupport::Logger.new("log/#{Rails.env}.log") # Can be used to log to the environment log.
|
|
207
|
-
Logger.new(STDOUT) # Can be used to log to standard output.
|
|
208
|
-
|
|
209
|
-
When logging is enabled, you'll be able to see the following information in the server logs to help
|
|
210
|
-
debug custom Auther settings:
|
|
211
|
-
|
|
212
|
-
- Requested path and excluded path detection.
|
|
213
|
-
- Finding (or not finding) of account.
|
|
214
|
-
- Account authentication pass/fail.
|
|
215
|
-
- Account and path authorization pass/fail.
|
|
216
|
-
|
|
217
|
-
### Troubleshooting
|
|
218
|
-
|
|
219
|
-
- If upgrading Rails, changing the cookie/session settings, generating a new secret base key, etc.
|
|
220
|
-
this might cause Auther authentication to fail. Make sure to clear your browser cookies in this
|
|
221
|
-
situation or use Google Chrome (incognito mode) to verify.
|
|
222
|
-
- If the authentication view/form looks broken (stylewise) this could be due to custom
|
|
223
|
-
`ActionView::Base.field_error_proc` settings defined by your app (usually via an initializer).
|
|
224
|
-
Auther uses this configuration `ActionView::Base.field_error_proc = proc { |html_tag, _|
|
|
225
|
-
html_tag.html_safe }` so that no additional markup is added to the DOM when errors are raised. If
|
|
226
|
-
you have customized this to something else, you might want to read the usage documentation
|
|
227
|
-
(mentioned above) to rebuild the authentication view/form for your specific business needs.
|
|
228
|
-
|
|
229
|
-
## Tests
|
|
230
|
-
|
|
231
|
-
To test, run:
|
|
232
|
-
|
|
233
|
-
bundle exec rake
|
|
234
|
-
|
|
235
|
-
## Versioning
|
|
236
|
-
|
|
237
|
-
Read [Semantic Versioning](https://semver.org) for details. Briefly, it means:
|
|
238
|
-
|
|
239
|
-
- Major (X.y.z) - Incremented for any backwards incompatible public API changes.
|
|
240
|
-
- Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
|
|
241
|
-
- Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
|
|
242
|
-
|
|
243
|
-
## Code of Conduct
|
|
244
|
-
|
|
245
|
-
Please note that this project is released with a [CODE OF CONDUCT](CODE_OF_CONDUCT.md). By
|
|
246
|
-
participating in this project you agree to abide by its terms.
|
|
247
|
-
|
|
248
|
-
## Contributions
|
|
249
|
-
|
|
250
|
-
Read [CONTRIBUTING](CONTRIBUTING.md) for details.
|
|
251
|
-
|
|
252
|
-
## License
|
|
253
|
-
|
|
254
|
-
Copyright 2014 [Alchemists](https://www.alchemists.io).
|
|
255
|
-
Read [LICENSE](LICENSE.md) for details.
|
|
256
|
-
|
|
257
|
-
## History
|
|
258
|
-
|
|
259
|
-
Read [CHANGES](CHANGES.md) for details.
|
|
260
|
-
Built with [Gemsmith](https://github.com/bkuhlmann/gemsmith).
|
|
261
|
-
|
|
262
|
-
## Credits
|
|
263
|
-
|
|
264
|
-
Developed by [Brooke Kuhlmann](https://www.alchemists.io) at
|
|
265
|
-
[Alchemists](https://www.alchemists.io).
|