auther 11.0.1 → 11.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7465491ecbcea7a91ce7670f52fc2abbb5c8cb47bfe66c86a1f568b9333e41f4
4
- data.tar.gz: bad239f1615f03ec23af7e8c51963ea04a42ca5760052e8bf87a42a10c8a66d4
3
+ metadata.gz: 5d675a74326ca453647cf7f9c791d16ad62b2f7d8f764cd5850b1c9c5182c36a
4
+ data.tar.gz: 2a3eef31d9f103853747a33deb01c27aceb6a23705504bdad90c5add45eae589
5
5
  SHA512:
6
- metadata.gz: 6d45bbd866ccd276ac9deca6d60b8500608fe7367e762c067907be435c47e3261c95688227a856e3224f15726d5aecaf9ea2f9e893c88402503547d8a3c7d32a
7
- data.tar.gz: 5f72e05387d185792949cb812bfe2d53bdb404a1718271620ae9549eccf6eb4f4194408289353d4393f053fb2f994d6b5f67f76fcfee71fbf7f676d9602033aa
6
+ metadata.gz: 00c8369b62305e58a2e5fd1ff68d8411968ca12f4141e822243eb6558f89b513dda68ad15a704b789a55b603a3bfdb7301a783e40d5ec1458f5766c99bfd18db
7
+ data.tar.gz: 76b2db02b4480be5aca85f2340e0294602974ecbac5be1ce271806089dbdad04d3c6947948a0d03d32294bf335905019a582600d22e8c802bb2087ad08e36737
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,4 +1,4 @@
1
- # Apache License
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
- ## 1. Definitions
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
- ## 2. Grant of Copyright License
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
- ## 3. Grant of Patent License
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
- ## 4. Redistribution
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
- 1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
83
+ . You must give any other recipients of the Work or Derivative Works a copy of this License; and
84
84
 
85
- 2. You must cause any modified files to carry prominent notices stating that You changed the
86
- files; and
85
+ . You must cause any modified files to carry prominent notices stating that You changed the files;
86
+ and
87
87
 
88
- 3. 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
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
- 4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative
93
- Works that You distribute must include a readable copy of the attribution notices contained
94
- within such NOTICE file, excluding those notices that do not pertain to any part of the
95
- Derivative Works, in at least one of the following places: within a NOTICE text file
96
- distributed as part of the Derivative Works; within the Source form or documentation, if
97
- provided along with the Derivative Works; or, within a display generated by the Derivative
98
- Works, if and wherever such third-party notices normally appear. The contents of the NOTICE
99
- file are for informational purposes only and do not modify the License. You may add Your own
100
- attribution notices within Derivative Works that You distribute, alongside or as an addendum to
101
- the NOTICE text from the Work, provided that such additional attribution notices cannot be
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
- ## 5. Submission of Contributions
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
- ## 6. Trademarks
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
- ## 7. Disclaimer of Warranty
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
- ## 8. Limitation of Liability
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
- ## 9. Accepting Warranty or Additional Liability
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 2014 [Alchemists](https://www.alchemists.io).
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 [copy](http://www.apache.org/licenses/LICENSE-2.0) of
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
@@ -0,0 +1,285 @@
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 2.7.x].
38
+ . link:http://rubyonrails.org[Ruby on Rails 6.0.x].
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
+ name: "admin",
111
+ encrypted_login: ENV["AUTHER_ADMIN_LOGIN"],
112
+ encrypted_password: ENV["AUTHER_ADMIN_PASSWORD"],
113
+ paths: ["/admin"]
114
+ ],
115
+ secret: ENV["AUTHER_SECRET"]
116
+ }
117
+ ----
118
+
119
+ To encrypt/decrypt account credentials, launch a rails console and run the following:
120
+
121
+ [source,ruby]
122
+ ----
123
+ # The secret as defined in `auther_settings` and/or produced by the credentials generator.
124
+ secret = SecureRandom.hex 16 # "426a7f46548a1a4518676a8e246517d8"
125
+
126
+ # The cipher for encrypting/decrypting values.
127
+ cipher = Auther::Cipher.new secret
128
+
129
+ # Use the following to encrypt an unecrypted value.
130
+ cipher.encrypt "test@test.com"
131
+
132
+ # Use the following to decrypt an encrypted value.
133
+ cipher.decrypt "hWToltdpl+uZJBPELKNC7Ij++jPkTuo=--nEdbOYL9fIRh14hY--fU+VSCd4+DDOhOmG1gzRfQ=="
134
+ ----
135
+
136
+ The initializer can be customized as follows:
137
+
138
+ * `title` - Optional. The HTML page title (as rendered within a browser tab). Default:
139
+ `"Authorization"`.
140
+ * `label` - Optional. The page label (what would appear above the form). Default: `"Authorization"`.
141
+ * `secret` - Required. The secret passphrase used to encrypt/decrypt account credentials.
142
+ * `accounts` - Required. The array of accounts with different or similar access to the application.
143
+ ** `name` - Required. The account name that uniquely identifies the account.
144
+ ** `encrypted_login` - Required. The encrypted account login.
145
+ ** `encrypted_password` - Required. The encrypted account password.
146
+ ** `paths` - Required. The array of excluded paths for which only this account has access to.
147
+ ** `authorized_url` - Optional. The URL to redirect to upon successful authorization. Authorized
148
+ redirection works in the order defined:
149
+ *** The excluded path (if requested prior to authorization but now authorized).
150
+ *** The authorized URL (if defined and the excluded path wasn't requested).
151
+ *** The root path (if none of the above).
152
+ ** `deauthorized_url` - Optional. The URL to redirect to upon successful deauthorization (i.e.
153
+ logout). Deauthorized redirections works as follows (in the order defined):
154
+ *** The deauthorized URL (if defined).
155
+ *** The auth URL.
156
+ * `url` - Optional. The URL to redirect to when enforcing authentication. Default: `"/login"`.
157
+ * `logger` - Optional. The logger used to log path/account authorization messages. Default:
158
+ `Auther::NullLogger`.
159
+
160
+ === Routes
161
+
162
+ The routes can be customized as follows (installed, by default, via the install generator):
163
+
164
+ [source,ruby]
165
+ ----
166
+ Rails.application.routes.draw do
167
+ mount Auther::Engine => "/auther"
168
+ get "/login", to: "auther/session#new", as: "login"
169
+ delete "/logout", to: "auther/session#destroy", as: "logout"
170
+ end
171
+ ----
172
+
173
+ === Model
174
+
175
+ The `Auther::Account` is a struct that uses ActiveModel validations to aid in attribute validation.
176
+ This model could potentially be replaced with a database-backed object (would require controller
177
+ customization)...but you should question if you have outgrown the use of this gem and need a
178
+ different solution altogether if it comes to that.
179
+
180
+ === Presenter
181
+
182
+ The `Auther::Presenter::Account` is a plain old Ruby object that uses ActiveModel validations to aid
183
+ in form validation. This presenter makes it easy to construct form data for input and validation.
184
+
185
+ === View
186
+
187
+ The view can be customized by creating the following file within your Rails application (assumes
188
+ that the default `Auther::SessionController` implementation is sufficient):
189
+ `app/views/auther/session/new.html`.
190
+
191
+ The form uses the `@account` instance variable which is an instance of the
192
+ `Auther::Presenter::Account` presenter (as mentioned above). The form can be stylized by modifying
193
+ the styles found in the `auther.scss` stylesheet.
194
+
195
+ === Controller
196
+
197
+ The `Auther::SessionController` inherits from the `Auther::BaseController`. To customize, it is
198
+ recommended that you add a controller to your app that inherits from the `Auther::BaseController`.
199
+ Example:
200
+
201
+ [source,ruby]
202
+ ----
203
+ # Example Path: app/controllers/session_controller.rb
204
+ class SessionController < Auther::BaseController
205
+ layout "example"
206
+ end
207
+ ----
208
+
209
+ This allows customization of session controller behavior to serve any special business needs. See
210
+ the `Auther::BaseController` for additional details or the `Auther::SessionController` for default
211
+ implementation.
212
+
213
+ === Logging
214
+
215
+ As mentioned in the setup above, the logger can be customized as follows:
216
+
217
+ [source,ruby]
218
+ ----
219
+ # This is the default logger silences all logging attempts.
220
+ Auther::NullLogger.new
221
+
222
+ # Can be used to log to the environment log.
223
+ ActiveSupport::Logger.new "log/#{Rails.env}.log"
224
+
225
+ # Can be used to log to standard output.
226
+ Logger.new STDOUT
227
+ ----
228
+
229
+ When logging is enabled, you'll be able to see the following information in the server logs to help
230
+ debug custom Auther settings:
231
+
232
+ * Requested path and excluded path detection.
233
+ * Finding (or not finding) of account.
234
+ * Account authentication pass/fail.
235
+ * Account and path authorization pass/fail.
236
+
237
+ === Troubleshooting
238
+
239
+ * If upgrading Rails, changing the cookie/session settings, generating a new secret base key, etc.
240
+ this might cause Auther authentication to fail. Make sure to clear your browser cookies in this
241
+ situation or use Google Chrome (incognito mode) to verify.
242
+ * If the authentication view/form looks broken (stylewise) this could be due to custom
243
+ `ActionView::Base.field_error_proc` settings defined by your app (usually via an initializer).
244
+ Auther uses this configuration `ActionView::Base.field_error_proc = proc { |html_tag, _|
245
+ html_tag.html_safe }` so that no additional markup is added to the DOM when errors are raised. If
246
+ you have customized this to something else, you might want to read the usage documentation
247
+ (mentioned above) to rebuild the authentication view/form for your specific business needs.
248
+
249
+ == Tests
250
+
251
+ To test, run:
252
+
253
+ [source,bash]
254
+ ----
255
+ bundle exec rake
256
+ ----
257
+
258
+ == Versioning
259
+
260
+ Read link:https://semver.org[Semantic Versioning] for details. Briefly, it means:
261
+
262
+ * Major (X.y.z) - Incremented for any backwards incompatible public API changes.
263
+ * Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
264
+ * Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
265
+
266
+ == Code of Conduct
267
+
268
+ Please note that this project is released with a link:CODE_OF_CONDUCT.adoc[CODE OF CONDUCT]. By
269
+ participating in this project you agree to abide by its terms.
270
+
271
+ == Contributions
272
+
273
+ Read link:CONTRIBUTING.adoc[CONTRIBUTING] for details.
274
+
275
+ == License
276
+
277
+ Read link:LICENSE.adoc[LICENSE] for details.
278
+
279
+ == History
280
+
281
+ Read link:CHANGES.adoc[CHANGES] for details.
282
+
283
+ == Credits
284
+
285
+ Engineered by link:https://www.alchemists.io/team/brooke_kuhlmann.html[Brooke Kuhlmann].
@@ -3,20 +3,9 @@
3
3
  module Auther
4
4
  # Gem identity information.
5
5
  module Identity
6
- def self.name
7
- "auther"
8
- end
9
-
10
- def self.label
11
- "Auther"
12
- end
13
-
14
- def self.version
15
- "11.0.1"
16
- end
17
-
18
- def self.version_label
19
- "#{label} #{version}"
20
- end
6
+ NAME = "auther"
7
+ LABEL = "Auther"
8
+ VERSION = "11.1.0"
9
+ VERSION_LABEL = "#{LABEL} #{VERSION}"
21
10
  end
22
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auther
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.0.1
4
+ version: 11.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -10,9 +10,9 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIC/jCCAeagAwIBAgIBAjANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
14
- a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0xOTAyMTcxNjAxMTFaFw0yMDAyMTcx
15
- NjAxMTFaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
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/gY4ggwDQYJKoZIhvcNAQELBQADggEBANgfX7kPZkJvsbdWMvbe
24
- DUUYxRTqTUzCDpLd2p3sQvgLMKjTNSKt6CFq/kh+98b6RCgO6DqiVfxvOEq02dvf
25
- ebMN/ylQqan2FgiAs1rpP0/D4C0MlBjoDktsT+2IyLol1KmkDB20ExJ4Sf1GRNdA
26
- hpWOtcgqHtmrc7xzgB6BuyoYufrKKUlCO3ewTM4C375D2qO7hIdKuMOO3CdPMtSk
27
- OrWpbzCL+nbbXqeoqiHgZaUvcyyQrGj5sQRxMTzuMXzzQxtHnuTuKrcz16HMTX/O
28
- dKvURM+1PwDCzC5tvRwjhUJIizau6+MtkFCvJHmaAj1aZL3odcPejHj5Hxt/0CUW
29
- y84=
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: 2020-02-01 00:00:00.000000000 Z
31
+ date: 2020-04-01 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rails
@@ -204,28 +204,28 @@ dependencies:
204
204
  requirements:
205
205
  - - "~>"
206
206
  - !ruby/object:Gem::Version
207
- version: '5.6'
207
+ version: '6.0'
208
208
  type: :development
209
209
  prerelease: false
210
210
  version_requirements: !ruby/object:Gem::Requirement
211
211
  requirements:
212
212
  - - "~>"
213
213
  - !ruby/object:Gem::Version
214
- version: '5.6'
214
+ version: '6.0'
215
215
  - !ruby/object:Gem::Dependency
216
216
  name: rspec-rails
217
217
  requirement: !ruby/object:Gem::Requirement
218
218
  requirements:
219
219
  - - "~>"
220
220
  - !ruby/object:Gem::Version
221
- version: '3.9'
221
+ version: '4.0'
222
222
  type: :development
223
223
  prerelease: false
224
224
  version_requirements: !ruby/object:Gem::Requirement
225
225
  requirements:
226
226
  - - "~>"
227
227
  - !ruby/object:Gem::Version
228
- version: '3.9'
228
+ version: '4.0'
229
229
  - !ruby/object:Gem::Dependency
230
230
  name: rubocop
231
231
  requirement: !ruby/object:Gem::Requirement
@@ -302,11 +302,11 @@ email:
302
302
  executables: []
303
303
  extensions: []
304
304
  extra_rdoc_files:
305
- - README.md
306
- - LICENSE.md
305
+ - README.adoc
306
+ - LICENSE.adoc
307
307
  files:
308
- - LICENSE.md
309
- - README.md
308
+ - LICENSE.adoc
309
+ - README.adoc
310
310
  - app/assets/stylesheets/auther/application.scss
311
311
  - app/assets/stylesheets/auther/auther.scss
312
312
  - app/controllers/auther/base_controller.rb
@@ -328,13 +328,14 @@ files:
328
328
  - lib/generators/auther/credentials/credentials_generator.rb
329
329
  - lib/generators/auther/install/install_generator.rb
330
330
  - lib/generators/auther/templates/config/initializers/auther.rb
331
- homepage: https://github.com/bkuhlmann/auther
331
+ homepage: https://www.alchemists.io/projects/auther
332
332
  licenses:
333
333
  - Apache-2.0
334
334
  metadata:
335
- source_code_uri: https://github.com/bkuhlmann/auther
336
- changelog_uri: https://github.com/bkuhlmann/auther/blob/master/CHANGES.md
337
335
  bug_tracker_uri: https://github.com/bkuhlmann/auther/issues
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
338
339
  post_install_message:
339
340
  rdoc_options: []
340
341
  require_paths:
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
- [![Gem Version](https://badge.fury.io/rb/auther.svg)](http://badge.fury.io/rb/auther)
8
- [![Code Climate Maintainability](https://api.codeclimate.com/v1/badges/3172d51796930fcdfad8/maintainability)](https://codeclimate.com/github/bkuhlmann/auther/maintainability)
9
- [![Code Climate Test Coverage](https://api.codeclimate.com/v1/badges/3172d51796930fcdfad8/test_coverage)](https://codeclimate.com/github/bkuhlmann/auther/test_coverage)
10
- [![Circle CI Status](https://circleci.com/gh/bkuhlmann/auther.svg?style=svg)](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
- ![Form Without Errors Screenshot](doc/screenshots/form-without_errors.png)
50
- ![Form With Errors Screenshot](doc/screenshots/form-with_errors.png)
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.7.x](https://www.ruby-lang.org).
62
- 1. [Ruby on Rails 6.0.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
- ![Credentials Generator Screenshot](doc/screenshots/credentials_generator.jpg)
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
- - *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).