auth1 0.4.0 → 0.5.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 +28 -16
- data/app/helpers/auth1/sessions_helper.rb +23 -3
- data/lib/auth1/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 87e31158ba864d33d332a4c8d3f51fc22c6efc40f9b7b152c599853af6a3beed
|
|
4
|
+
data.tar.gz: c374e105ca45b58945e28b9609e2551227d23ba029dc4ff98314cf650c7169ce
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6fa02f1713470b70eda1f4cffc1482ae49a797f6520fe8e6786563fefe1a5725703b7dac125d65b951d7eb75805c8240d36cc18d68443b4281b3e2820b40dd3f
|
|
7
|
+
data.tar.gz: ff5ee901c1fbfba45d744d3f99b06a29349aa2a6bbda6bd737366795ae76b88c1fe7c09902858f144bbefed71203075b4b41b85f90fb1d3714d01e0c927f7a07
|
data/README.md
CHANGED
|
@@ -1,8 +1,33 @@
|
|
|
1
1
|
# Auth1
|
|
2
|
-
Auth1 is a Rails Engine for Auth0. Auth1 provides everything you need to use [Auth0](https://auth0.com) in your Rails application.
|
|
2
|
+
Auth1 is a [Rails Engine](https://guides.rubyonrails.org/engines.html) for [Auth0](https://auth0.com). Auth1 provides everything you need to use [Auth0](https://auth0.com) in your Rails application.
|
|
3
3
|
|
|
4
4
|
## Usage
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
### View Helpers
|
|
7
|
+
|
|
8
|
+
#### Link Helpers
|
|
9
|
+
```ruby
|
|
10
|
+
<% if user_signed_in? -%>
|
|
11
|
+
<%= logout_link %>
|
|
12
|
+
<% else -%>
|
|
13
|
+
<%= login_link %>
|
|
14
|
+
<% end -%>
|
|
15
|
+
|
|
16
|
+
# or just
|
|
17
|
+
<%= login_or_logout_link %>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
#### Button Helpers
|
|
21
|
+
```ruby
|
|
22
|
+
<% if user_signed_in? -%>
|
|
23
|
+
<%= logout_button %>
|
|
24
|
+
<% else -%>
|
|
25
|
+
<%= login_button %>
|
|
26
|
+
<% end -%>
|
|
27
|
+
|
|
28
|
+
# or just
|
|
29
|
+
<%= login_or_logout_button %>
|
|
30
|
+
```
|
|
6
31
|
|
|
7
32
|
## Installation
|
|
8
33
|
Add this line to your application's Gemfile:
|
|
@@ -27,23 +52,10 @@ AUTH0_DOMAIN
|
|
|
27
52
|
AUTH0_LOGOUT_URL
|
|
28
53
|
```
|
|
29
54
|
|
|
30
|
-
Update **Allowed Callback URLs** field in [Auth0 Application Settings](https://manage.auth0.com/#/applications). For local development, you can set this value to `http://localhost:3000/auth/auth0/callback
|
|
55
|
+
Update **Allowed Callback URLs** field in [Auth0 Application Settings](https://manage.auth0.com/#/applications). For local development, you can set this value to `http://localhost:3000/auth/auth0/callback`git.
|
|
31
56
|
|
|
32
57
|
Update **Allowed Logout URLs** field in [Auth0 Application Settings](https://manage.auth0.com/#/applications) with the same value in `AUTH0_LOGOUT_URL` environment variable.
|
|
33
58
|
|
|
34
|
-
## View Helpers
|
|
35
|
-
|
|
36
|
-
```ruby
|
|
37
|
-
<% if user_signed_in? -%>
|
|
38
|
-
<%= logout_button %>
|
|
39
|
-
<% else -%>
|
|
40
|
-
<%= login_button %>
|
|
41
|
-
<% end -%>
|
|
42
|
-
|
|
43
|
-
# or just
|
|
44
|
-
<%= login_or_logout_button %>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
59
|
## Contributing
|
|
48
60
|
Contribution directions go here.
|
|
49
61
|
|
|
@@ -28,11 +28,31 @@ module Auth1
|
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
def login_link
|
|
31
|
+
def login_link(name = 'Login', options = nil, html_options = nil, &block)
|
|
32
|
+
options ||= '/auth/auth0'
|
|
33
|
+
html_options ||= {}
|
|
34
|
+
html_options[:method] = :post
|
|
35
|
+
link_to(name, options, html_options, &block)
|
|
36
|
+
end
|
|
32
37
|
|
|
33
|
-
def logout_link
|
|
38
|
+
def logout_link(name = 'Logout', options = nil, html_options = nil, &block)
|
|
39
|
+
options ||= auth1.logout_path
|
|
40
|
+
html_options ||= {}
|
|
41
|
+
html_options[:method] = :get
|
|
42
|
+
link_to(name, options, html_options, &block)
|
|
43
|
+
end
|
|
34
44
|
|
|
35
|
-
def login_or_logout_link
|
|
45
|
+
def login_or_logout_link(name = %w[Login Logout], options = [nil, nil], html_options = [nil, nil], &block)
|
|
46
|
+
if user_signed_in?
|
|
47
|
+
logout_html_options = html_options[1] || {}
|
|
48
|
+
logout_html_options[:method] = :get
|
|
49
|
+
logout_link(name[1], options[1], logout_html_options, &block)
|
|
50
|
+
else
|
|
51
|
+
login_html_options = html_options[0] || {}
|
|
52
|
+
login_html_options[:method] = :post
|
|
53
|
+
login_link(name[0], options[0], login_html_options, &block)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
36
56
|
|
|
37
57
|
def user_signed_in?
|
|
38
58
|
session['userinfo'].present?
|
data/lib/auth1/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: auth1
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Joon Lee
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-04-
|
|
11
|
+
date: 2020-04-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: omniauth-auth0
|