onelogin 1.0.4 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/examples/rails-custom-login-page/.gitignore +45 -0
- data/examples/rails-custom-login-page/.ruby-version +1 -0
- data/examples/rails-custom-login-page/Gemfile +57 -0
- data/examples/rails-custom-login-page/Gemfile.lock +208 -0
- data/examples/rails-custom-login-page/README.md +104 -0
- data/examples/rails-custom-login-page/Rakefile +6 -0
- data/examples/rails-custom-login-page/app/assets/config/manifest.js +3 -0
- data/examples/rails-custom-login-page/app/assets/images/.keep +0 -0
- data/examples/rails-custom-login-page/app/assets/javascripts/application.js +18 -0
- data/examples/rails-custom-login-page/app/assets/javascripts/cable.js +13 -0
- data/examples/rails-custom-login-page/app/assets/javascripts/channels/.keep +0 -0
- data/examples/rails-custom-login-page/app/assets/javascripts/dashboard.coffee +3 -0
- data/examples/rails-custom-login-page/app/assets/javascripts/home.coffee +3 -0
- data/examples/rails-custom-login-page/app/assets/javascripts/sessions.coffee +3 -0
- data/examples/rails-custom-login-page/app/assets/stylesheets/application.css +63 -0
- data/examples/rails-custom-login-page/app/assets/stylesheets/dashboard.scss +3 -0
- data/examples/rails-custom-login-page/app/assets/stylesheets/home.scss +3 -0
- data/examples/rails-custom-login-page/app/assets/stylesheets/sessions.scss +3 -0
- data/examples/rails-custom-login-page/app/channels/application_cable/channel.rb +4 -0
- data/examples/rails-custom-login-page/app/channels/application_cable/connection.rb +4 -0
- data/examples/rails-custom-login-page/app/controllers/application_controller.rb +23 -0
- data/examples/rails-custom-login-page/app/controllers/concerns/.keep +0 -0
- data/examples/rails-custom-login-page/app/controllers/dashboard_controller.rb +10 -0
- data/examples/rails-custom-login-page/app/controllers/home_controller.rb +4 -0
- data/examples/rails-custom-login-page/app/controllers/sessions_controller.rb +20 -0
- data/examples/rails-custom-login-page/app/helpers/application_helper.rb +2 -0
- data/examples/rails-custom-login-page/app/helpers/dashboard_helper.rb +28 -0
- data/examples/rails-custom-login-page/app/helpers/home_helper.rb +2 -0
- data/examples/rails-custom-login-page/app/helpers/sessions_helper.rb +60 -0
- data/examples/rails-custom-login-page/app/jobs/application_job.rb +2 -0
- data/examples/rails-custom-login-page/app/mailers/application_mailer.rb +4 -0
- data/examples/rails-custom-login-page/app/models/application_record.rb +3 -0
- data/examples/rails-custom-login-page/app/models/concerns/.keep +0 -0
- data/examples/rails-custom-login-page/app/views/dashboard/index.html.erb +37 -0
- data/examples/rails-custom-login-page/app/views/home/index.html.erb +103 -0
- data/examples/rails-custom-login-page/app/views/layouts/application.html.erb +18 -0
- data/examples/rails-custom-login-page/app/views/layouts/mailer.html.erb +13 -0
- data/examples/rails-custom-login-page/app/views/layouts/mailer.text.erb +1 -0
- data/examples/rails-custom-login-page/bin/bundle +3 -0
- data/examples/rails-custom-login-page/bin/rails +9 -0
- data/examples/rails-custom-login-page/bin/rake +9 -0
- data/examples/rails-custom-login-page/bin/setup +38 -0
- data/examples/rails-custom-login-page/bin/spring +17 -0
- data/examples/rails-custom-login-page/bin/update +29 -0
- data/examples/rails-custom-login-page/bin/yarn +11 -0
- data/examples/rails-custom-login-page/config/application.rb +18 -0
- data/examples/rails-custom-login-page/config/boot.rb +3 -0
- data/examples/rails-custom-login-page/config/cable.yml +10 -0
- data/examples/rails-custom-login-page/config/database.yml +25 -0
- data/examples/rails-custom-login-page/config/environment.rb +5 -0
- data/examples/rails-custom-login-page/config/environments/development.rb +54 -0
- data/examples/rails-custom-login-page/config/environments/production.rb +91 -0
- data/examples/rails-custom-login-page/config/environments/test.rb +42 -0
- data/examples/rails-custom-login-page/config/initializers/application_controller_renderer.rb +8 -0
- data/examples/rails-custom-login-page/config/initializers/assets.rb +14 -0
- data/examples/rails-custom-login-page/config/initializers/backtrace_silencers.rb +7 -0
- data/examples/rails-custom-login-page/config/initializers/cookies_serializer.rb +5 -0
- data/examples/rails-custom-login-page/config/initializers/filter_parameter_logging.rb +4 -0
- data/examples/rails-custom-login-page/config/initializers/inflections.rb +16 -0
- data/examples/rails-custom-login-page/config/initializers/mime_types.rb +4 -0
- data/examples/rails-custom-login-page/config/initializers/onelogin.rb +4 -0
- data/examples/rails-custom-login-page/config/initializers/wrap_parameters.rb +14 -0
- data/examples/rails-custom-login-page/config/locales/en.yml +33 -0
- data/examples/rails-custom-login-page/config/puma.rb +56 -0
- data/examples/rails-custom-login-page/config/routes.rb +12 -0
- data/examples/rails-custom-login-page/config/secrets.yml.sample +36 -0
- data/examples/rails-custom-login-page/config/spring.rb +6 -0
- data/examples/rails-custom-login-page/config.ru +5 -0
- data/examples/rails-custom-login-page/db/seeds.rb +7 -0
- data/examples/rails-custom-login-page/lib/assets/.keep +0 -0
- data/examples/rails-custom-login-page/lib/tasks/.keep +0 -0
- data/examples/rails-custom-login-page/package.json +5 -0
- data/examples/rails-custom-login-page/public/404.html +67 -0
- data/examples/rails-custom-login-page/public/422.html +67 -0
- data/examples/rails-custom-login-page/public/500.html +66 -0
- data/examples/rails-custom-login-page/public/apple-touch-icon-precomposed.png +0 -0
- data/examples/rails-custom-login-page/public/apple-touch-icon.png +0 -0
- data/examples/rails-custom-login-page/public/favicon.ico +0 -0
- data/examples/rails-custom-login-page/public/robots.txt +1 -0
- data/examples/rails-custom-login-page/test/application_system_test_case.rb +5 -0
- data/examples/rails-custom-login-page/test/controllers/.keep +0 -0
- data/examples/rails-custom-login-page/test/controllers/dashboard_controller_test.rb +9 -0
- data/examples/rails-custom-login-page/test/controllers/home_controller_test.rb +9 -0
- data/examples/rails-custom-login-page/test/controllers/sessions_controller_test.rb +7 -0
- data/examples/rails-custom-login-page/test/fixtures/.keep +0 -0
- data/examples/rails-custom-login-page/test/fixtures/files/.keep +0 -0
- data/examples/rails-custom-login-page/test/helpers/.keep +0 -0
- data/examples/rails-custom-login-page/test/integration/.keep +0 -0
- data/examples/rails-custom-login-page/test/mailers/.keep +0 -0
- data/examples/rails-custom-login-page/test/models/.keep +0 -0
- data/examples/rails-custom-login-page/test/system/.keep +0 -0
- data/examples/rails-custom-login-page/test/test_helper.rb +9 -0
- data/examples/rails-custom-login-page/vendor/.keep +0 -0
- data/lib/onelogin/api/client.rb +45 -14
- data/lib/onelogin/api/util/constants.rb +4 -3
- data/lib/onelogin/version.rb +1 -1
- metadata +96 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0b09f92686da99fbe19429f8ae65da9962f97a0
|
4
|
+
data.tar.gz: 8fe313cf382979cc481a5bb26961ca4091a615d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: feaa630f6e10bbeaac2f783dfa4af64fb19afabbe4c6781745be745dce0f5fe52863d9ce7e7202f8be86b61d286ec211074c524b54475d7ae178a26f90b65207
|
7
|
+
data.tar.gz: 9276fb49aa63b3d9f2cc04ff089eeb5decd8c6b5329d7fe57bbd70e371c3b1f4784bf8a5cc486c4abbf2baaa487487240904a22feabc59e56c1d7d117141ea22
|
data/README.md
CHANGED
@@ -323,6 +323,9 @@ enrollment_response = client.activate_factor(user_id, device_id)
|
|
323
323
|
# Verify an Authentication Factor
|
324
324
|
result = client.verify_factor(user_id, device_id, otp_token="4242342423")
|
325
325
|
|
326
|
+
# Remove a Factor
|
327
|
+
result = client.remove_factor(user_id, device_id)
|
328
|
+
|
326
329
|
# Generate Invite Link
|
327
330
|
url_link = client.generate_invite_link("user@example.com")
|
328
331
|
|
@@ -0,0 +1,45 @@
|
|
1
|
+
*.rbc
|
2
|
+
capybara-*.html
|
3
|
+
.rspec
|
4
|
+
/log
|
5
|
+
/tmp
|
6
|
+
/db/*.sqlite3
|
7
|
+
/db/*.sqlite3-journal
|
8
|
+
/public/system
|
9
|
+
/coverage/
|
10
|
+
/spec/tmp
|
11
|
+
*.orig
|
12
|
+
rerun.txt
|
13
|
+
pickle-email-*.html
|
14
|
+
|
15
|
+
|
16
|
+
# TODO Comment out this rule if you are OK with secrets being uploaded to the repo
|
17
|
+
config/initializers/secret_token.rb
|
18
|
+
|
19
|
+
# Only include if you have production secrets in this file, which is no longer a Rails default
|
20
|
+
config/secrets.yml
|
21
|
+
|
22
|
+
# dotenv
|
23
|
+
# TODO Comment out this rule if environment variables can be committed
|
24
|
+
.env
|
25
|
+
|
26
|
+
## Environment normalization:
|
27
|
+
/.bundle
|
28
|
+
/vendor/bundle
|
29
|
+
|
30
|
+
# these should all be checked in to normalize the environment:
|
31
|
+
Gemfile.lock, .ruby-version, .ruby-gemset
|
32
|
+
|
33
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
34
|
+
.rvmrc
|
35
|
+
|
36
|
+
# if using bower-rails ignore default bower_components path bower.json files
|
37
|
+
/vendor/assets/bower_components
|
38
|
+
*.bowerrc
|
39
|
+
bower.json
|
40
|
+
|
41
|
+
# Ignore pow environment settings
|
42
|
+
.powenv
|
43
|
+
|
44
|
+
# Ignore Byebug command history file.
|
45
|
+
.byebug_history
|
@@ -0,0 +1 @@
|
|
1
|
+
2.2.5
|
@@ -0,0 +1,57 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
git_source(:github) do |repo_name|
|
4
|
+
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
5
|
+
"https://github.com/#{repo_name}.git"
|
6
|
+
end
|
7
|
+
|
8
|
+
|
9
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
10
|
+
gem 'rails', '~> 5.1.4'
|
11
|
+
# Use sqlite3 as the database for Active Record
|
12
|
+
gem 'sqlite3'
|
13
|
+
# Use Puma as the app server
|
14
|
+
gem 'puma', '~> 3.7'
|
15
|
+
# Use SCSS for stylesheets
|
16
|
+
gem 'sass-rails', '~> 5.0'
|
17
|
+
# Use Uglifier as compressor for JavaScript assets
|
18
|
+
gem 'uglifier', '>= 1.3.0'
|
19
|
+
# See https://github.com/rails/execjs#readme for more supported runtimes
|
20
|
+
# gem 'therubyracer', platforms: :ruby
|
21
|
+
|
22
|
+
# Use CoffeeScript for .coffee assets and views
|
23
|
+
gem 'coffee-rails', '~> 4.2'
|
24
|
+
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
25
|
+
gem 'turbolinks', '~> 5'
|
26
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
27
|
+
gem 'jbuilder', '~> 2.5'
|
28
|
+
# Use Redis adapter to run Action Cable in production
|
29
|
+
# gem 'redis', '~> 3.0'
|
30
|
+
# Use ActiveModel has_secure_password
|
31
|
+
# gem 'bcrypt', '~> 3.1.7'
|
32
|
+
|
33
|
+
# Use Capistrano for deployment
|
34
|
+
# gem 'capistrano-rails', group: :development
|
35
|
+
|
36
|
+
gem 'onelogin', '~> 1.0.4'
|
37
|
+
gem 'jquery-rails'
|
38
|
+
|
39
|
+
group :development, :test do
|
40
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
41
|
+
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
42
|
+
# Adds support for Capybara system testing and selenium driver
|
43
|
+
gem 'capybara', '~> 2.13'
|
44
|
+
gem 'selenium-webdriver'
|
45
|
+
end
|
46
|
+
|
47
|
+
group :development do
|
48
|
+
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
|
49
|
+
gem 'web-console', '>= 3.3.0'
|
50
|
+
gem 'listen', '>= 3.0.5', '< 3.2'
|
51
|
+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
52
|
+
gem 'spring'
|
53
|
+
gem 'spring-watcher-listen', '~> 2.0.0'
|
54
|
+
end
|
55
|
+
|
56
|
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
57
|
+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
@@ -0,0 +1,208 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
actioncable (5.1.5)
|
5
|
+
actionpack (= 5.1.5)
|
6
|
+
nio4r (~> 2.0)
|
7
|
+
websocket-driver (~> 0.6.1)
|
8
|
+
actionmailer (5.1.5)
|
9
|
+
actionpack (= 5.1.5)
|
10
|
+
actionview (= 5.1.5)
|
11
|
+
activejob (= 5.1.5)
|
12
|
+
mail (~> 2.5, >= 2.5.4)
|
13
|
+
rails-dom-testing (~> 2.0)
|
14
|
+
actionpack (5.1.5)
|
15
|
+
actionview (= 5.1.5)
|
16
|
+
activesupport (= 5.1.5)
|
17
|
+
rack (~> 2.0)
|
18
|
+
rack-test (>= 0.6.3)
|
19
|
+
rails-dom-testing (~> 2.0)
|
20
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
21
|
+
actionview (5.1.5)
|
22
|
+
activesupport (= 5.1.5)
|
23
|
+
builder (~> 3.1)
|
24
|
+
erubi (~> 1.4)
|
25
|
+
rails-dom-testing (~> 2.0)
|
26
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
27
|
+
activejob (5.1.5)
|
28
|
+
activesupport (= 5.1.5)
|
29
|
+
globalid (>= 0.3.6)
|
30
|
+
activemodel (5.1.5)
|
31
|
+
activesupport (= 5.1.5)
|
32
|
+
activerecord (5.1.5)
|
33
|
+
activemodel (= 5.1.5)
|
34
|
+
activesupport (= 5.1.5)
|
35
|
+
arel (~> 8.0)
|
36
|
+
activesupport (5.1.5)
|
37
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
38
|
+
i18n (~> 0.7)
|
39
|
+
minitest (~> 5.1)
|
40
|
+
tzinfo (~> 1.1)
|
41
|
+
addressable (2.5.2)
|
42
|
+
public_suffix (>= 2.0.2, < 4.0)
|
43
|
+
arel (8.0.0)
|
44
|
+
bindex (0.5.0)
|
45
|
+
builder (3.2.3)
|
46
|
+
byebug (10.0.1)
|
47
|
+
capybara (2.18.0)
|
48
|
+
addressable
|
49
|
+
mini_mime (>= 0.1.3)
|
50
|
+
nokogiri (>= 1.3.3)
|
51
|
+
rack (>= 1.0.0)
|
52
|
+
rack-test (>= 0.5.4)
|
53
|
+
xpath (>= 2.0, < 4.0)
|
54
|
+
childprocess (0.9.0)
|
55
|
+
ffi (~> 1.0, >= 1.0.11)
|
56
|
+
coffee-rails (4.2.2)
|
57
|
+
coffee-script (>= 2.2.0)
|
58
|
+
railties (>= 4.0.0)
|
59
|
+
coffee-script (2.4.1)
|
60
|
+
coffee-script-source
|
61
|
+
execjs
|
62
|
+
coffee-script-source (1.12.2)
|
63
|
+
concurrent-ruby (1.0.5)
|
64
|
+
crass (1.0.3)
|
65
|
+
erubi (1.7.1)
|
66
|
+
execjs (2.7.0)
|
67
|
+
ffi (1.9.23)
|
68
|
+
globalid (0.4.1)
|
69
|
+
activesupport (>= 4.2.0)
|
70
|
+
httparty (0.16.1)
|
71
|
+
multi_xml (>= 0.5.2)
|
72
|
+
i18n (0.9.5)
|
73
|
+
concurrent-ruby (~> 1.0)
|
74
|
+
jbuilder (2.7.0)
|
75
|
+
activesupport (>= 4.2.0)
|
76
|
+
multi_json (>= 1.2)
|
77
|
+
jquery-rails (4.3.1)
|
78
|
+
rails-dom-testing (>= 1, < 3)
|
79
|
+
railties (>= 4.2.0)
|
80
|
+
thor (>= 0.14, < 2.0)
|
81
|
+
listen (3.1.5)
|
82
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
83
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
84
|
+
ruby_dep (~> 1.2)
|
85
|
+
loofah (2.2.2)
|
86
|
+
crass (~> 1.0.2)
|
87
|
+
nokogiri (>= 1.5.9)
|
88
|
+
mail (2.7.0)
|
89
|
+
mini_mime (>= 0.1.1)
|
90
|
+
method_source (0.9.0)
|
91
|
+
mini_mime (1.0.0)
|
92
|
+
mini_portile2 (2.3.0)
|
93
|
+
minitest (5.11.3)
|
94
|
+
multi_json (1.13.1)
|
95
|
+
multi_xml (0.6.0)
|
96
|
+
nio4r (2.3.0)
|
97
|
+
nokogiri (1.8.2)
|
98
|
+
mini_portile2 (~> 2.3.0)
|
99
|
+
onelogin (1.0.4)
|
100
|
+
httparty (>= 0.13.7)
|
101
|
+
nokogiri (>= 1.6.3.1)
|
102
|
+
public_suffix (3.0.2)
|
103
|
+
puma (3.11.3)
|
104
|
+
rack (2.0.4)
|
105
|
+
rack-test (0.8.3)
|
106
|
+
rack (>= 1.0, < 3)
|
107
|
+
rails (5.1.5)
|
108
|
+
actioncable (= 5.1.5)
|
109
|
+
actionmailer (= 5.1.5)
|
110
|
+
actionpack (= 5.1.5)
|
111
|
+
actionview (= 5.1.5)
|
112
|
+
activejob (= 5.1.5)
|
113
|
+
activemodel (= 5.1.5)
|
114
|
+
activerecord (= 5.1.5)
|
115
|
+
activesupport (= 5.1.5)
|
116
|
+
bundler (>= 1.3.0)
|
117
|
+
railties (= 5.1.5)
|
118
|
+
sprockets-rails (>= 2.0.0)
|
119
|
+
rails-dom-testing (2.0.3)
|
120
|
+
activesupport (>= 4.2.0)
|
121
|
+
nokogiri (>= 1.6)
|
122
|
+
rails-html-sanitizer (1.0.4)
|
123
|
+
loofah (~> 2.2, >= 2.2.2)
|
124
|
+
railties (5.1.5)
|
125
|
+
actionpack (= 5.1.5)
|
126
|
+
activesupport (= 5.1.5)
|
127
|
+
method_source
|
128
|
+
rake (>= 0.8.7)
|
129
|
+
thor (>= 0.18.1, < 2.0)
|
130
|
+
rake (12.3.1)
|
131
|
+
rb-fsevent (0.10.3)
|
132
|
+
rb-inotify (0.9.10)
|
133
|
+
ffi (>= 0.5.0, < 2)
|
134
|
+
ruby_dep (1.5.0)
|
135
|
+
rubyzip (1.2.1)
|
136
|
+
sass (3.5.5)
|
137
|
+
sass-listen (~> 4.0.0)
|
138
|
+
sass-listen (4.0.0)
|
139
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
140
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
141
|
+
sass-rails (5.0.7)
|
142
|
+
railties (>= 4.0.0, < 6)
|
143
|
+
sass (~> 3.1)
|
144
|
+
sprockets (>= 2.8, < 4.0)
|
145
|
+
sprockets-rails (>= 2.0, < 4.0)
|
146
|
+
tilt (>= 1.1, < 3)
|
147
|
+
selenium-webdriver (3.11.0)
|
148
|
+
childprocess (~> 0.5)
|
149
|
+
rubyzip (~> 1.2)
|
150
|
+
spring (2.0.2)
|
151
|
+
activesupport (>= 4.2)
|
152
|
+
spring-watcher-listen (2.0.1)
|
153
|
+
listen (>= 2.7, < 4.0)
|
154
|
+
spring (>= 1.2, < 3.0)
|
155
|
+
sprockets (3.7.1)
|
156
|
+
concurrent-ruby (~> 1.0)
|
157
|
+
rack (> 1, < 3)
|
158
|
+
sprockets-rails (3.2.1)
|
159
|
+
actionpack (>= 4.0)
|
160
|
+
activesupport (>= 4.0)
|
161
|
+
sprockets (>= 3.0.0)
|
162
|
+
sqlite3 (1.3.13)
|
163
|
+
thor (0.20.0)
|
164
|
+
thread_safe (0.3.6)
|
165
|
+
tilt (2.0.8)
|
166
|
+
turbolinks (5.1.0)
|
167
|
+
turbolinks-source (~> 5.1)
|
168
|
+
turbolinks-source (5.1.0)
|
169
|
+
tzinfo (1.2.5)
|
170
|
+
thread_safe (~> 0.1)
|
171
|
+
uglifier (4.1.8)
|
172
|
+
execjs (>= 0.3.0, < 3)
|
173
|
+
web-console (3.5.1)
|
174
|
+
actionview (>= 5.0)
|
175
|
+
activemodel (>= 5.0)
|
176
|
+
bindex (>= 0.4.0)
|
177
|
+
railties (>= 5.0)
|
178
|
+
websocket-driver (0.6.5)
|
179
|
+
websocket-extensions (>= 0.1.0)
|
180
|
+
websocket-extensions (0.1.3)
|
181
|
+
xpath (3.0.0)
|
182
|
+
nokogiri (~> 1.8)
|
183
|
+
|
184
|
+
PLATFORMS
|
185
|
+
ruby
|
186
|
+
|
187
|
+
DEPENDENCIES
|
188
|
+
byebug
|
189
|
+
capybara (~> 2.13)
|
190
|
+
coffee-rails (~> 4.2)
|
191
|
+
jbuilder (~> 2.5)
|
192
|
+
jquery-rails
|
193
|
+
listen (>= 3.0.5, < 3.2)
|
194
|
+
onelogin (~> 1.0.4)
|
195
|
+
puma (~> 3.7)
|
196
|
+
rails (~> 5.1.4)
|
197
|
+
sass-rails (~> 5.0)
|
198
|
+
selenium-webdriver
|
199
|
+
spring
|
200
|
+
spring-watcher-listen (~> 2.0.0)
|
201
|
+
sqlite3
|
202
|
+
turbolinks (~> 5)
|
203
|
+
tzinfo-data
|
204
|
+
uglifier (>= 1.3.0)
|
205
|
+
web-console (>= 3.3.0)
|
206
|
+
|
207
|
+
BUNDLED WITH
|
208
|
+
1.16.1
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# Customized Login Page
|
2
|
+
|
3
|
+
This sample is a default [Ruby on Rails 5](http://rubyonrails.org/) app that makes use of the OneLogin ruby sdk for authenticating users.
|
4
|
+
|
5
|
+
It is the recommended approach when building a customized login flow where you want complete control
|
6
|
+
over the look & feel.
|
7
|
+
|
8
|
+
The downside to this approach is that you have to implement MFA and password resets etc yourself. However we do have the APIs for these actions available and have demonstrated how to use them in this app.
|
9
|
+
|
10
|
+
![Custom Login](https://s3.amazonaws.com/onelogin-screenshots/dev_site/images/custom-login-os.gif)
|
11
|
+
|
12
|
+
If you want a standards based, out of the box way to authenticate users then we recommend you use [our OpenId Connect implementation](https://github.com/onelogin/onelogin-oidc-ruby).
|
13
|
+
|
14
|
+
## Get Started
|
15
|
+
|
16
|
+
The sample tries to keep everything as simple as possible so only
|
17
|
+
implements
|
18
|
+
* Login - Authenticate users in a single request to OneLogin with out any redirects
|
19
|
+
* MFA - Does MFA verification if required
|
20
|
+
* User Apps - List apps available to a user and provides SSO links
|
21
|
+
* User Roles - Lists a users roles
|
22
|
+
* Logout - destroying the local session and revoking the token at OneLogin
|
23
|
+
|
24
|
+
In order to run this sample you need API credentials for a OneLogin account. If you don't have a OneLogin developer account [you can sign up here](https://www.onelogin.com/developer-signup).
|
25
|
+
|
26
|
+
1. Clone this repo
|
27
|
+
|
28
|
+
```sh
|
29
|
+
git clone https://github.com/onelogin/onelogin-ruby-sdk.git
|
30
|
+
```
|
31
|
+
|
32
|
+
2. Move to the rails example and install the required gems
|
33
|
+
```sh
|
34
|
+
cd onelogin-ruby-sdk/examples/rails-custom-login-page && bundle install
|
35
|
+
```
|
36
|
+
|
37
|
+
3. Rename `config/secrets.yml.sample` to `config/secrets.yml` and update with your OneLogin API credentials, region and subdomain.
|
38
|
+
|
39
|
+
```yaml
|
40
|
+
development:
|
41
|
+
secret_key_base: xxx
|
42
|
+
ONELOGIN_CLIENT_ID: xxx
|
43
|
+
ONELOGIN_CLIENT_SECRET: xxx
|
44
|
+
ONELOGIN_REGION: us
|
45
|
+
ONELOGIN_SUBDOMAIN: xxx
|
46
|
+
```
|
47
|
+
4. Run the sample and browse to `http://localhost:3000`
|
48
|
+
```sh
|
49
|
+
rails s
|
50
|
+
```
|
51
|
+
|
52
|
+
The `/dashboard` route renders a protected page to prove the authentication works and creates a session. You will need to be authenticated to view it. If you are not authenticate you will be redirected back to the login page.
|
53
|
+
|
54
|
+
### Authenticate the user
|
55
|
+
|
56
|
+
*helpers/sessions_helper.rb*
|
57
|
+
```ruby
|
58
|
+
response = api_client.create_session_login_token({
|
59
|
+
'username_or_email' => username,
|
60
|
+
'password' => password,
|
61
|
+
'subdomain' => ONELOGIN_SUBDOMAIN,
|
62
|
+
},
|
63
|
+
request.base_url # included for CORS session cookie request
|
64
|
+
)
|
65
|
+
```
|
66
|
+
|
67
|
+
### Verify MFA
|
68
|
+
|
69
|
+
*helpers/sessions_helper.rb*
|
70
|
+
```ruby
|
71
|
+
response = api_client.get_session_token_verified(
|
72
|
+
device_id,
|
73
|
+
session[:state_token],
|
74
|
+
otp_token,
|
75
|
+
request.base_url
|
76
|
+
)
|
77
|
+
```
|
78
|
+
|
79
|
+
### Destroy the session
|
80
|
+
|
81
|
+
*helpers/sessions_helper.rb*
|
82
|
+
```ruby
|
83
|
+
api_client.log_user_out(current_user_id)
|
84
|
+
session.delete(:user)
|
85
|
+
```
|
86
|
+
|
87
|
+
### Make CORS request to establish SSO session
|
88
|
+
|
89
|
+
Using the `session_token` returned from the `session_controller` after a new login or successful MFA verification.
|
90
|
+
|
91
|
+
*views/home/index.html.erb*
|
92
|
+
```javascript
|
93
|
+
function makeCors(session_token) {
|
94
|
+
var xhr = new XMLHttpRequest();
|
95
|
+
xhr.withCredentials = true;
|
96
|
+
method = "POST";
|
97
|
+
var url = "https://" + ONELOGIN_SUBDOMAIN + ".onelogin.com/session_via_api_token";
|
98
|
+
xhr.open(method, url, true);
|
99
|
+
xhr.setRequestHeader("Content-Type", "application/json");
|
100
|
+
body = {"session_token": session_token};
|
101
|
+
xhr.send(JSON.stringify(body));
|
102
|
+
};
|
103
|
+
```
|
104
|
+
|
File without changes
|
@@ -0,0 +1,18 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
|
5
|
+
// vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require rails-ujs
|
14
|
+
//= require turbolinks
|
15
|
+
//= require_tree .
|
16
|
+
//= require jquery
|
17
|
+
//= require jquery_ujs
|
18
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// Action Cable provides the framework to deal with WebSockets in Rails.
|
2
|
+
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
|
3
|
+
//
|
4
|
+
//= require action_cable
|
5
|
+
//= require_self
|
6
|
+
//= require_tree ./channels
|
7
|
+
|
8
|
+
(function() {
|
9
|
+
this.App || (this.App = {});
|
10
|
+
|
11
|
+
App.cable = ActionCable.createConsumer();
|
12
|
+
|
13
|
+
}).call(this);
|
File without changes
|
@@ -0,0 +1,63 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
|
6
|
+
* vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
16
|
+
|
17
|
+
body {
|
18
|
+
padding: 20px;
|
19
|
+
font-family: Arial, Helvetica, sans-serif
|
20
|
+
}
|
21
|
+
|
22
|
+
.alert, .error {
|
23
|
+
color: red;
|
24
|
+
text-align: center;
|
25
|
+
}
|
26
|
+
|
27
|
+
.row {
|
28
|
+
padding: 5px 0px;
|
29
|
+
}
|
30
|
+
|
31
|
+
.row span {
|
32
|
+
display: inline-block;
|
33
|
+
font-weight: bold;
|
34
|
+
}
|
35
|
+
|
36
|
+
.login-form, .mfa-form {
|
37
|
+
width: 300px;
|
38
|
+
margin: 0 auto;
|
39
|
+
text-align: center;
|
40
|
+
padding: 50px;
|
41
|
+
background: green; /* For browsers that do not support gradients */
|
42
|
+
background: -webkit-linear-gradient(left, orange , yellow, green, cyan, blue, violet); /* For Safari 5.1 to 6.0 */
|
43
|
+
background: -o-linear-gradient(right, orange, yellow, green, cyan, blue, violet); /* For Opera 11.1 to 12.0 */
|
44
|
+
background: -moz-linear-gradient(right, orange, yellow, green, cyan, blue, violet); /* For Firefox 3.6 to 15 */
|
45
|
+
background: linear-gradient(to right, orange , yellow, green, cyan, blue, violet); /* Standard syntax (must be last) */
|
46
|
+
}
|
47
|
+
|
48
|
+
.login-form input, .mfa-form input {
|
49
|
+
width: 90%;
|
50
|
+
padding: 5px;
|
51
|
+
margin: 5px;
|
52
|
+
}
|
53
|
+
|
54
|
+
.login-form h1, .mfa-form h1 {
|
55
|
+
color: #fff;
|
56
|
+
}
|
57
|
+
|
58
|
+
.login-footer {
|
59
|
+
width: 300px;
|
60
|
+
margin: 50px auto;
|
61
|
+
text-align: center;
|
62
|
+
}
|
63
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'onelogin'
|
2
|
+
|
3
|
+
class ApplicationController < ActionController::Base
|
4
|
+
protect_from_forgery with: :exception
|
5
|
+
include SessionsHelper
|
6
|
+
|
7
|
+
def require_current_user
|
8
|
+
if current_user
|
9
|
+
return true
|
10
|
+
else
|
11
|
+
redirect_to root_url, error: "Please sign in."
|
12
|
+
return false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def api_client
|
17
|
+
@api_client ||= OneLogin::Api::Client.new(
|
18
|
+
client_id: ONELOGIN_CLIENT_ID,
|
19
|
+
client_secret: ONELOGIN_CLIENT_SECRET,
|
20
|
+
region: ONELOGIN_REGION
|
21
|
+
)
|
22
|
+
end
|
23
|
+
end
|
File without changes
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class SessionsController < ApplicationController
|
2
|
+
def new
|
3
|
+
response = log_in(params['username'], params['password'])
|
4
|
+
status = response ? :ok : :unauthorized
|
5
|
+
|
6
|
+
render json: response, status: status
|
7
|
+
end
|
8
|
+
|
9
|
+
def verify
|
10
|
+
response = verify_mfa(params['device_id'], params['otp_token'])
|
11
|
+
status = response ? :ok : :unauthorized
|
12
|
+
|
13
|
+
render json: response, status: status
|
14
|
+
end
|
15
|
+
|
16
|
+
def destroy
|
17
|
+
log_out
|
18
|
+
redirect_to root_url
|
19
|
+
end
|
20
|
+
end
|