omniauth-azure-activedirectory 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rubocop.yml +8 -0
- data/.rubocop_todo.yml +20 -0
- data/.travis.yml +7 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +98 -0
- data/Rakefile +22 -0
- data/examples/rails-todo-list-app/.gitignore +25 -0
- data/examples/rails-todo-list-app/Gemfile +33 -0
- data/examples/rails-todo-list-app/README.md +83 -0
- data/examples/rails-todo-list-app/Rakefile +3 -0
- data/examples/rails-todo-list-app/app/assets/javascripts/application.js +4 -0
- data/examples/rails-todo-list-app/app/assets/stylesheets/application.css +2 -0
- data/examples/rails-todo-list-app/app/controllers/application_controller.rb +3 -0
- data/examples/rails-todo-list-app/app/controllers/home_controller.rb +2 -0
- data/examples/rails-todo-list-app/app/controllers/profile_controller.rb +20 -0
- data/examples/rails-todo-list-app/app/controllers/sessions_controller.rb +28 -0
- data/examples/rails-todo-list-app/app/controllers/signed_in_controller.rb +25 -0
- data/examples/rails-todo-list-app/app/controllers/tasks_controller.rb +33 -0
- data/examples/rails-todo-list-app/app/models/task.rb +10 -0
- data/examples/rails-todo-list-app/app/models/user.rb +58 -0
- data/examples/rails-todo-list-app/app/views/home/index.html.haml +4 -0
- data/examples/rails-todo-list-app/app/views/layouts/application.html.haml +12 -0
- data/examples/rails-todo-list-app/app/views/layouts/signed_in.html.haml +18 -0
- data/examples/rails-todo-list-app/app/views/profile/index.html.haml +13 -0
- data/examples/rails-todo-list-app/app/views/tasks/index.html.haml +11 -0
- data/examples/rails-todo-list-app/bin/bundle +3 -0
- data/examples/rails-todo-list-app/bin/rails +4 -0
- data/examples/rails-todo-list-app/bin/rake +4 -0
- data/examples/rails-todo-list-app/bin/setup +29 -0
- data/examples/rails-todo-list-app/config.ru +4 -0
- data/examples/rails-todo-list-app/config/application.rb +29 -0
- data/examples/rails-todo-list-app/config/boot.rb +3 -0
- data/examples/rails-todo-list-app/config/database.yml +25 -0
- data/examples/rails-todo-list-app/config/environment.rb +13 -0
- data/examples/rails-todo-list-app/config/environments/development.rb +41 -0
- data/examples/rails-todo-list-app/config/environments/production.rb +79 -0
- data/examples/rails-todo-list-app/config/environments/test.rb +42 -0
- data/examples/rails-todo-list-app/config/initializers/assets.rb +11 -0
- data/examples/rails-todo-list-app/config/initializers/backtrace_silencers.rb +7 -0
- data/examples/rails-todo-list-app/config/initializers/cookies_serializer.rb +3 -0
- data/examples/rails-todo-list-app/config/initializers/filter_parameter_logging.rb +4 -0
- data/examples/rails-todo-list-app/config/initializers/inflections.rb +16 -0
- data/examples/rails-todo-list-app/config/initializers/mime_types.rb +4 -0
- data/examples/rails-todo-list-app/config/initializers/omniauth.rb +3 -0
- data/examples/rails-todo-list-app/config/initializers/session_store.rb +3 -0
- data/examples/rails-todo-list-app/config/initializers/wrap_parameters.rb +14 -0
- data/examples/rails-todo-list-app/config/routes.rb +22 -0
- data/examples/rails-todo-list-app/db/schema.rb +35 -0
- data/examples/rails-todo-list-app/public/404.html +67 -0
- data/examples/rails-todo-list-app/public/422.html +67 -0
- data/examples/rails-todo-list-app/public/500.html +66 -0
- data/examples/rails-todo-list-app/public/favicon.ico +0 -0
- data/examples/sinatra-multiple-providers-app/.env +11 -0
- data/examples/sinatra-multiple-providers-app/Gemfile +8 -0
- data/examples/sinatra-multiple-providers-app/README.md +13 -0
- data/examples/sinatra-multiple-providers-app/app.rb +51 -0
- data/examples/sinatra-multiple-providers-app/config.ru +45 -0
- data/lib/omniauth-azure-activedirectory.rb +23 -0
- data/lib/omniauth/azure_activedirectory.rb +24 -0
- data/lib/omniauth/azure_activedirectory/version.rb +28 -0
- data/lib/omniauth/strategies/azure_activedirectory.rb +329 -0
- data/omniauth-azure-activedirectory.gemspec +25 -0
- data/spec/fixtures/id_token.txt +1 -0
- data/spec/fixtures/id_token_bad_audience.txt +1 -0
- data/spec/fixtures/id_token_bad_chash.txt +1 -0
- data/spec/fixtures/id_token_bad_issuer.txt +1 -0
- data/spec/fixtures/id_token_bad_kid.txt +1 -0
- data/spec/fixtures/id_token_bad_nonce.txt +1 -0
- data/spec/fixtures/id_token_no_alg.txt +1 -0
- data/spec/fixtures/x5c.txt +1 -0
- data/spec/fixtures/x5c_different.txt +1 -0
- data/spec/omniauth/strategies/azure_activedirectory_spec.rb +222 -0
- data/spec/spec_helper.rb +44 -0
- metadata +217 -0
@@ -0,0 +1,11 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Version of your assets, change this if you want to expire all your assets.
|
4
|
+
Rails.application.config.assets.version = '1.0'
|
5
|
+
|
6
|
+
# Add additional assets to the asset load path
|
7
|
+
# Rails.application.config.assets.paths << Emoji.images_path
|
8
|
+
|
9
|
+
# Precompile additional assets.
|
10
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
11
|
+
# Rails.application.config.assets.precompile += %w( search.js )
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
4
|
+
# are locale specific, and you may define rules for as many different
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
8
|
+
# inflect.singular /^(ox)en/i, '\1'
|
9
|
+
# inflect.irregular 'person', 'people'
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
11
|
+
# end
|
12
|
+
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
+
# inflect.acronym 'RESTful'
|
16
|
+
# end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
|
+
end
|
10
|
+
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
13
|
+
# self.include_root_in_json = true
|
14
|
+
# end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
root to: 'home#index'
|
3
|
+
|
4
|
+
resource :session, only: [:destroy]
|
5
|
+
resources :profile, only: [:index]
|
6
|
+
resources :tasks, only: [:index, :update, :create, :destroy, :post]
|
7
|
+
|
8
|
+
# This is where we send people to authenticate with OmniAuth.
|
9
|
+
get '/auth/azureactivedirectory', as: :sign_in
|
10
|
+
|
11
|
+
# This is where we are redirected if OmniAuth successfully authenicates
|
12
|
+
# the user.
|
13
|
+
match '/auth/:provider/callback', to: 'sessions#create', via: [:get, :post]
|
14
|
+
|
15
|
+
# This is where we are redirected if we acquire authorization separately from
|
16
|
+
# OmniAuth.
|
17
|
+
match '/authorize', to: 'signed_in#add_auth', via: [:get, :post]
|
18
|
+
|
19
|
+
# This is where we are redirected if OmniAuth fails to authenticate the user.
|
20
|
+
# user
|
21
|
+
match '/auth/:provider/failure', to: redirect('/'), via: [:get, :post]
|
22
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(version: 20150819163233) do
|
15
|
+
|
16
|
+
create_table "tasks", force: :cascade do |t|
|
17
|
+
t.string "user_id"
|
18
|
+
t.text "description"
|
19
|
+
t.date "due_date"
|
20
|
+
t.datetime "created_at", null: false
|
21
|
+
t.datetime "updated_at", null: false
|
22
|
+
end
|
23
|
+
|
24
|
+
create_table "users", force: :cascade do |t|
|
25
|
+
t.string "uid"
|
26
|
+
t.string "provider"
|
27
|
+
t.string "name"
|
28
|
+
t.string "email"
|
29
|
+
t.datetime "created_at", null: false
|
30
|
+
t.datetime "updated_at", null: false
|
31
|
+
t.string "adal_unique_id"
|
32
|
+
t.string "adal_displayable_id"
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/404.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/422.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The change you wanted was rejected.</h1>
|
62
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/500.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
62
|
+
</div>
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
64
|
+
</div>
|
65
|
+
</body>
|
66
|
+
</html>
|
File without changes
|
@@ -0,0 +1,11 @@
|
|
1
|
+
AAD_KEY=<your aad key here>
|
2
|
+
AAD_TENANT=<your aad tenant here>
|
3
|
+
|
4
|
+
AMAZON_KEY=<your amazon key here>
|
5
|
+
AMAZON_SECRET=<your amazon secret here>
|
6
|
+
|
7
|
+
GITHUB_KEY=<your github key here>
|
8
|
+
GITHUB_SECRET=<your github secret here>
|
9
|
+
|
10
|
+
GOOGLE_KEY=<your google key here>
|
11
|
+
GOOGLE_SECRET=<your google secret here>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
This example shows how OmniAuth can be used with many different providers, including AzureAD.
|
2
|
+
|
3
|
+
Before running this sample, you should install the dependencies with:
|
4
|
+
|
5
|
+
```
|
6
|
+
bundle install
|
7
|
+
```
|
8
|
+
|
9
|
+
You can then run the sample with:
|
10
|
+
|
11
|
+
```
|
12
|
+
bundle exec rackup
|
13
|
+
```
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#-------------------------------------------------------------------------------
|
2
|
+
# Copyright (c) 2015 Micorosft Corporation
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
9
|
+
# furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in
|
12
|
+
# all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
# THE SOFTWARE.
|
21
|
+
#-------------------------------------------------------------------------------
|
22
|
+
|
23
|
+
require 'sinatra'
|
24
|
+
|
25
|
+
# Configure Sinatra.
|
26
|
+
set :run, false
|
27
|
+
set :raise_errors, true
|
28
|
+
|
29
|
+
get '/' do
|
30
|
+
content_type 'text/html'
|
31
|
+
<<-HTML
|
32
|
+
<h3>Hello there!</h3>
|
33
|
+
<a href='/auth/amazon'>Sign in with Amazon</a>
|
34
|
+
<a href='/auth/azureactivedirectory'>Sign in with AzureAD</a>
|
35
|
+
<a href='/auth/github'>Sign in with Github</a>
|
36
|
+
<a href='/auth/google_oauth2'>Sign in with Google</a>
|
37
|
+
HTML
|
38
|
+
end
|
39
|
+
|
40
|
+
%w(get post).each do |method|
|
41
|
+
send(method, '/auth/:provider/callback') do
|
42
|
+
auth = request.env['omniauth.auth']
|
43
|
+
"Your authentication looks like #{JSON.unparse(auth)}."
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
%w(get post).each do |method|
|
48
|
+
send(method, '/auth/:provider/failure') do
|
49
|
+
"Aw shucks, we couldn't verify your identity!"
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#-------------------------------------------------------------------------------
|
2
|
+
# Copyright (c) 2015 Micorosft Corporation
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
9
|
+
# furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in
|
12
|
+
# all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
# THE SOFTWARE.
|
21
|
+
#-------------------------------------------------------------------------------
|
22
|
+
|
23
|
+
require 'dotenv'
|
24
|
+
require 'omniauth'
|
25
|
+
require 'omniauth-amazon'
|
26
|
+
require 'omniauth-azure-activedirectory'
|
27
|
+
require 'omniauth-github'
|
28
|
+
require 'omniauth-google-oauth2'
|
29
|
+
|
30
|
+
# Load API keys from .env
|
31
|
+
Dotenv.load
|
32
|
+
|
33
|
+
require_relative './app.rb'
|
34
|
+
|
35
|
+
# You must provide a session to use OmniAuth.
|
36
|
+
use Rack::Session::Cookie, secret: 'top secret'
|
37
|
+
|
38
|
+
use OmniAuth::Builder do
|
39
|
+
provider :amazon, ENV['AMAZON_KEY'], ENV['AMAZON_SECRET']
|
40
|
+
provider :azure_activedirectory, ENV['AAD_KEY'], ENV['AAD_TENANT']
|
41
|
+
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET']
|
42
|
+
provider :google_oauth2, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET']
|
43
|
+
end
|
44
|
+
|
45
|
+
run Sinatra::Application
|