auth1 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +3 -1
- data/app/controllers/auth1/application_controller.rb +2 -0
- data/app/controllers/auth1/sessions_controller.rb +41 -0
- data/app/helpers/auth1/application_helper.rb +2 -0
- data/app/helpers/auth1/sessions_helper.rb +9 -0
- data/app/jobs/auth1/application_job.rb +2 -0
- data/app/mailers/auth1/application_mailer.rb +2 -0
- data/app/models/auth1/application_record.rb +2 -0
- data/config/initializers/auth0.rb +14 -0
- data/config/routes.rb +5 -0
- data/lib/auth1/engine.rb +8 -0
- data/lib/auth1/version.rb +3 -1
- data/lib/auth1.rb +4 -2
- data/lib/tasks/auth1_tasks.rake +1 -0
- metadata +43 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cbe8220cdce0cc3e9456969eb995ad9bb70425afaef6f5379804806e3e7fe38
|
4
|
+
data.tar.gz: 4dd79d2768e93420123259e50a0257c45487baeb510f8c054199b66a1ecdd864
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81187a4a8dc57e6e692e93c2fc0896637ea8dcdfb9686d2dfb2bdd38f6b58db7d1b5e821fe532387bb686fbe5aaa10924ec89236e2d5eb6d50867a483b4f005c
|
7
|
+
data.tar.gz: a69a4ddeb703bd03beaddbcf7001649e36ec2a5815491e6781cb26a55fa9d59dea81dcabf64a331d52f6d3c4a56e112589a1c158cfe24deed5b04317a37ec48f
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
begin
|
2
4
|
require 'bundler/setup'
|
3
5
|
rescue LoadError
|
@@ -14,7 +16,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
14
16
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
17
|
end
|
16
18
|
|
17
|
-
APP_RAKEFILE = File.expand_path(
|
19
|
+
APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
|
18
20
|
load 'rails/tasks/engine.rake'
|
19
21
|
|
20
22
|
load 'rails/tasks/statistics.rake'
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_dependency 'auth1/application_controller'
|
4
|
+
|
5
|
+
module Auth1
|
6
|
+
class SessionsController < ApplicationController
|
7
|
+
def callback
|
8
|
+
# This stores all the user information that came from Auth0 and the IdP
|
9
|
+
# See also: https://github.com/auth0/omniauth-auth0#authentication-hash
|
10
|
+
session[:userinfo] = request.env['omniauth.auth']
|
11
|
+
|
12
|
+
# Redirect to the URL you want after successful auth
|
13
|
+
redirect_to request.env['omniauth.origin']
|
14
|
+
end
|
15
|
+
|
16
|
+
def failure
|
17
|
+
# show a failure page or redirect to an error page
|
18
|
+
@error_msg = request.params['message']
|
19
|
+
end
|
20
|
+
|
21
|
+
def logout
|
22
|
+
reset_session
|
23
|
+
redirect_to auth0_logout_url
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def auth0_logout_url
|
29
|
+
request_params = {
|
30
|
+
client_id: ENV['AUTH0_CLIENT_ID'],
|
31
|
+
returnTo: 'http://localhost:3000/' # TODO
|
32
|
+
}
|
33
|
+
|
34
|
+
URI::HTTPS.build(
|
35
|
+
host: ENV['AUTH0_DOMAIN'],
|
36
|
+
path: '/v2/logout',
|
37
|
+
query: request_params.to_query
|
38
|
+
).to_s
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Auth1::Engine.config.middleware.use OmniAuth::Builder do
|
4
|
+
provider(
|
5
|
+
:auth0,
|
6
|
+
ENV['AUTH0_CLIENT_ID'],
|
7
|
+
ENV['AUTH0_CLIENT_SECRET'],
|
8
|
+
ENV['AUTH0_DOMAIN'],
|
9
|
+
callback_path: '/auth/auth0/callback',
|
10
|
+
authorize_params: {
|
11
|
+
scope: 'openid email profile'
|
12
|
+
}
|
13
|
+
)
|
14
|
+
end
|
data/config/routes.rb
CHANGED
data/lib/auth1/engine.rb
CHANGED
data/lib/auth1/version.rb
CHANGED
data/lib/auth1.rb
CHANGED
data/lib/tasks/auth1_tasks.rake
CHANGED
metadata
CHANGED
@@ -1,91 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auth1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.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-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: omniauth-auth0
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '2.3'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 2.3.1
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: '2.3'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 2.3.1
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name: omniauth-
|
34
|
+
name: omniauth-rails_csrf_protection
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
39
|
+
version: '0.1'
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
42
|
+
version: 0.1.2
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
49
|
+
version: '0.1'
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
52
|
+
version: 0.1.2
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
|
-
name:
|
54
|
+
name: rails
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
57
|
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version:
|
59
|
+
version: 6.0.2
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 0.
|
62
|
+
version: 6.0.2.2
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: 6.0.2
|
70
70
|
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: 0.
|
72
|
+
version: 6.0.2.2
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
|
-
name:
|
74
|
+
name: dotenv-rails
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '2.7'
|
77
80
|
- - ">="
|
78
81
|
- !ruby/object:Gem::Version
|
79
|
-
version:
|
82
|
+
version: 2.7.5
|
80
83
|
type: :development
|
81
84
|
prerelease: false
|
82
85
|
version_requirements: !ruby/object:Gem::Requirement
|
83
86
|
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.7'
|
84
90
|
- - ">="
|
85
91
|
- !ruby/object:Gem::Version
|
86
|
-
version:
|
92
|
+
version: 2.7.5
|
87
93
|
- !ruby/object:Gem::Dependency
|
88
94
|
name: rubocop
|
95
|
+
requirement: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0.81'
|
100
|
+
type: :development
|
101
|
+
prerelease: false
|
102
|
+
version_requirements: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - "~>"
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0.81'
|
107
|
+
- !ruby/object:Gem::Dependency
|
108
|
+
name: sqlite3
|
89
109
|
requirement: !ruby/object:Gem::Requirement
|
90
110
|
requirements:
|
91
111
|
- - ">="
|
@@ -111,11 +131,14 @@ files:
|
|
111
131
|
- app/assets/config/auth1_manifest.js
|
112
132
|
- app/assets/stylesheets/auth1/application.css
|
113
133
|
- app/controllers/auth1/application_controller.rb
|
134
|
+
- app/controllers/auth1/sessions_controller.rb
|
114
135
|
- app/helpers/auth1/application_helper.rb
|
136
|
+
- app/helpers/auth1/sessions_helper.rb
|
115
137
|
- app/jobs/auth1/application_job.rb
|
116
138
|
- app/mailers/auth1/application_mailer.rb
|
117
139
|
- app/models/auth1/application_record.rb
|
118
140
|
- app/views/layouts/auth1/application.html.erb
|
141
|
+
- config/initializers/auth0.rb
|
119
142
|
- config/routes.rb
|
120
143
|
- lib/auth1.rb
|
121
144
|
- lib/auth1/engine.rb
|