omniauth-rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +71 -0
- data/Rakefile +41 -0
- data/app/assets/config/omniauth_rails_manifest.js +1 -0
- data/app/assets/stylesheets/omniauth/rails/application.css +19 -0
- data/app/controllers/omniauth/rails/application_controller.rb +8 -0
- data/app/controllers/omniauth/rails/flash.rb +46 -0
- data/app/controllers/omniauth/rails/require_authentication.rb +26 -0
- data/app/controllers/omniauth/rails/require_authorization.rb +32 -0
- data/app/controllers/omniauth/rails/sessions_controller.rb +55 -0
- data/app/helpers/omniauth/rails/application_helper.rb +16 -0
- data/app/models/omniauth/rails/authentication_data_store.rb +31 -0
- data/app/models/omniauth/rails/authentication_request.rb +28 -0
- data/app/models/omniauth/rails/authentication_session.rb +53 -0
- data/app/models/omniauth/rails/authorization_checker.rb +28 -0
- data/app/models/omniauth/rails/authorization_types/base.rb +17 -0
- data/app/models/omniauth/rails/authorization_types/domains.rb +22 -0
- data/app/models/omniauth/rails/authorization_types/emails.rb +18 -0
- data/app/models/omniauth/rails/authorization_types/regex.rb +18 -0
- data/app/models/omniauth/rails/omni_auth_route_builder.rb +18 -0
- data/app/views/omniauth/rails/sessions/destroy.html.erb +6 -0
- data/config/initializers/omniauth_rails.rb +35 -0
- data/config/routes.rb +6 -0
- data/lib/omniauth/rails/configuration.rb +15 -0
- data/lib/omniauth/rails/engine.rb +22 -0
- data/lib/omniauth/rails/test/controller_helpers.rb +17 -0
- data/lib/omniauth/rails/test/request_helpers.rb +25 -0
- data/lib/omniauth/rails/version.rb +6 -0
- data/lib/omniauth/rails.rb +9 -0
- data/spec/controllers/application_controller_spec.rb +9 -0
- data/spec/examples.txt +19 -0
- data/spec/models/omniauth/rails/authorization_types/emails_spec.rb +28 -0
- data/spec/models/omniauth/rails/authorization_types/regex_spec.rb +28 -0
- data/spec/omniauth_rails_spec.rb +10 -0
- data/spec/rails_helper_for_engine.rb +62 -0
- data/spec/spec_helper.rb +93 -0
- data/spec/test_app/Rakefile +12 -0
- data/spec/test_app/app/assets/config/manifest.js +4 -0
- data/spec/test_app/app/assets/javascripts/application.js +13 -0
- data/spec/test_app/app/assets/stylesheets/application.css +15 -0
- data/spec/test_app/app/controllers/application_controller.rb +4 -0
- data/spec/test_app/app/controllers/private_controller.rb +9 -0
- data/spec/test_app/app/controllers/public_controller.rb +6 -0
- data/spec/test_app/app/helpers/application_helper.rb +3 -0
- data/spec/test_app/app/mailers/application_mailer.rb +5 -0
- data/spec/test_app/app/models/application_record.rb +4 -0
- data/spec/test_app/app/views/layouts/application.html.erb +24 -0
- data/spec/test_app/app/views/private/show.html.erb +1 -0
- data/spec/test_app/app/views/public/show.html.erb +1 -0
- data/spec/test_app/bin/bundle +4 -0
- data/spec/test_app/bin/rails +5 -0
- data/spec/test_app/bin/rake +5 -0
- data/spec/test_app/bin/setup +35 -0
- data/spec/test_app/bin/update +30 -0
- data/spec/test_app/config/application.rb +23 -0
- data/spec/test_app/config/boot.rb +6 -0
- data/spec/test_app/config/environment.rb +6 -0
- data/spec/test_app/config/environments/development.rb +55 -0
- data/spec/test_app/config/environments/production.rb +89 -0
- data/spec/test_app/config/environments/test.rb +43 -0
- data/spec/test_app/config/initializers/application_controller_renderer.rb +7 -0
- data/spec/test_app/config/initializers/assets.rb +12 -0
- data/spec/test_app/config/initializers/backtrace_silencers.rb +10 -0
- data/spec/test_app/config/initializers/cookies_serializer.rb +6 -0
- data/spec/test_app/config/initializers/filter_parameter_logging.rb +5 -0
- data/spec/test_app/config/initializers/inflections.rb +17 -0
- data/spec/test_app/config/initializers/mime_types.rb +5 -0
- data/spec/test_app/config/initializers/session_store.rb +4 -0
- data/spec/test_app/config/initializers/wrap_parameters.rb +15 -0
- data/spec/test_app/config/locales/en.yml +23 -0
- data/spec/test_app/config/omniauth_rails.yml +16 -0
- data/spec/test_app/config/puma.rb +48 -0
- data/spec/test_app/config/routes.rb +8 -0
- data/spec/test_app/config/secrets.yml +22 -0
- data/spec/test_app/config/spring.rb +7 -0
- data/spec/test_app/config.ru +6 -0
- data/spec/test_app/log/development.log +4451 -0
- data/spec/test_app/log/test.log +7601 -0
- data/spec/test_app/public/404.html +67 -0
- data/spec/test_app/public/422.html +67 -0
- data/spec/test_app/public/500.html +66 -0
- data/spec/test_app/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/test_app/public/apple-touch-icon.png +0 -0
- data/spec/test_app/public/favicon.ico +0 -0
- data/spec/test_app/spec/controllers/private_controller_spec.rb +19 -0
- data/spec/test_app/spec/rails_helper.rb +54 -0
- data/spec/test_app/spec/requests/private_controller_spec.rb +26 -0
- data/spec/test_app/spec/requests/public_controller_spec.rb +13 -0
- data/spec/test_app/spec/requests/sessions_controller_spec.rb +87 -0
- data/spec/test_app/spec/spec_helper.rb +99 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/-5/-528MPRmC3ByNiAzVD1hs-NG3Muhf9FsYPaDbo4qIpI.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/3v/3voyTxS8FmTTGPrz-QQ23N6AgGate2o7X5ZnZeTkQbs.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/5V/5VAABbvE5t5bCDKmKjLivvfe1CqYdD4n4vtZQiMa4I0.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/64/64siRwVaDPAW5fTe1O4rlGaq-0ExxAWA0-csPcik-uM.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Aa/AasprW2BgqWDcmZnsPRxs-R5D0VGpL7dHYMwtsC1tmE.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/An/An3DVlfO1pzT7FAnm09q3Ok_2PmGYhiAvxuW9OgG9wc.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/C-/C-_kx_I8fFV2TrLPw8CNFy1uLrN6G4yLPg_4vOhlohQ.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/EG/EGN6771mS8m_7wi-Cr-GgFKv9U9IE3gpo9JQ-N3AYlQ.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Hl/HlzBaGDQ4NV3ctlz-qlmStUWDCELhxzVK1-SgLkPCH0.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/IB/IBoXb9_P8EU8f7aPVNE8cWJybcus8fS7KGvi4HxKdMU.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/K2/K28c2b37N3eRA-Pckb3MO3D3BvGXfbxDGNeRYIXG8Cg.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/KJ/KJdFFU6zb4YpQWEm8bsXxx8kdQ01BdK0F0h6TTzpOiY.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/KW/KWwCiQwwI6oqiIHZg_Qg2nrs1zXJISos9799GIL5viU.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Kh/KhKDGOFwOEJlSwLMaG8Yak8AktHsnEr-fUwLpl9d0tc.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/NX/NXZl3HljnPNJmh2CNpp0skcYvQx4eSEp6vuG5o3lqqY.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/NX/nxTv3sKVUQZADJyM3dPaVmUA78MIsMLD_K279yN_GsI.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Ob/ObDGu7gmDzQuH86CeAdhWRPf0sfv9Qo3CoxGK3VOYWI.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/QG/QGjnK1OGVhAWzpma8R60Qdcr6v46sAWmpwQpeoWltX8.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Qn/Qn2TRz8mMz8dPVvXgHUfqXC19EPZQgG3XDqm5W_E-A0.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/WC/WCTd8gm1KmkPKRB14gd1wwFv3x9NwMsmquXet4Z1DTU.cache +2 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Z-/Z-3hfqbx8r350iW9zFPz_OdVHX0X4Z4bMk9YbS1eha8.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Z2/Z2DJdVm4jsJXg0HzuQVyAAmjJbVdzKntXlmd14iNVbU.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/ZA/ZAzUlqsc-uLa_zcjt1t6EBkPqI8PkEoxz40i4FgrRlQ.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/bN/bNCmkb6T3JKDzd6s7ZxOLn_WdC6gUnRARnBDHrMFS7o.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/b_/b_Itlk9QZZd7Rvf8kcA4yLP1R5Acu7jB-m1xQiSU0qE.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/d6/d6PosAq3dbPqxxvjAcaLgePkRuQ8w__EA-M42WarK_0.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/fD/fDbKpwc4jlsYlnxTT3vnhsiBcSJF3imnAGUBp9nq_Bw.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/fE/fEHvM7gLiXuJB6lDj2KNzgAx5L3BBn2NSsuodvPAryI.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/fg/fgbqfgH_CvzP2H744Q3ywDzlqLRSgSw0AH6ifkC7roo.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/g4/g4TbkEUbvKBMpO8z4ioPbq8ArdLl-scuF3pVaLJhmVI.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/id/idcyFsf20F5Vd3GC1XtM_PxlNnROM6CxO1j11NG3RWk.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/ih/ihflBRw1ToLzP0q8oKAJl_a6EHHbTdJUcVR5DANsIuA.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/jz/jzXohzOyfczV5wKfQVQWgE1H0IMN4jaxEM3XlhHNgvk.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/lH/lHLoBOtMavo_6UnfOn0DVLI2JQBT1W9sGR3IZzOD6o8.cache +2 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/mD/mDmWU5fLvNY4uggphc1wqYVQDn_w_U6Jz2XRSf59jDc.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/mX/mX1nlsL_SWOB4y22W5FheRX0YEONKyOY7xUeIvRiHco.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/n5/n5FDaqgvLV4Rc1Xm6TykMEFanDhSJJ77HPuPCEgCDQM.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/n9/n9Nzbk_dEL3fNO-u56owqnrG7YQmhcvDgJ2fWWE_9jE.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/nU/nUDR2L4CaIx5IszaYaaaACw519TTTzvpxsp7NMl6KyQ.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/n_/n_xYqQYhwEMQknb3jFQnjlxxBE9TzMNHCdJ-bEyZFIw.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/pc/pcFf9fij5Xa__QoHi-QzN_0Q_UGLhv6gihTXnoFX3sg.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/q-/q-721tFv_0DZO9GZ_kHYUD_jn6GNRC09vb51mwyxbuI.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/r6/r6saZ-BJCnX2-U353od1DgtZIGy5kXrCuXatXntMcTE.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/wY/wYWiPwDGlToFGYId__oKg8QMPEeuRZoP1FhQahshfOo.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/yD/yDj60NQvsiwl1QWQXH-iC4pgF1cmHkUFo-kkXBSjsIQ.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/ym/ymCwqEVBkEs6bYteLf70KCA5pCKZtqjQ3TbZQzrIs3M.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/z0/z041WxjoEQvRhtSLORbkRlsNTgi68Rwx7XUyaDbPn0M.cache +1 -0
- data/spec/test_app/tmp/pids/server.pid +1 -0
- metadata +453 -0
@@ -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
|
File without changes
|
File without changes
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.expand_path("../../", __FILE__)
|
4
|
+
require "rails_helper"
|
5
|
+
|
6
|
+
RSpec.describe PrivateController do
|
7
|
+
describe "#show" do
|
8
|
+
context "user is authenticated" do
|
9
|
+
before do
|
10
|
+
sign_in "foo@bar.com"
|
11
|
+
end
|
12
|
+
|
13
|
+
it "responds with a 200" do
|
14
|
+
get :show
|
15
|
+
expect(response).to have_http_status(:success)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
3
|
+
ENV["RAILS_ENV"] ||= "test"
|
4
|
+
require File.expand_path("../../config/environment", __FILE__)
|
5
|
+
# Prevent database truncation if the environment is production
|
6
|
+
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
7
|
+
require "spec_helper"
|
8
|
+
require "rspec/rails"
|
9
|
+
|
10
|
+
require "omniauth/rails/test/controller_helpers"
|
11
|
+
require "omniauth/rails/test/request_helpers"
|
12
|
+
OmniAuth.config.test_mode = true
|
13
|
+
|
14
|
+
# Add additional requires below this line. Rails is not loaded until this point!
|
15
|
+
|
16
|
+
# Requires supporting ruby files with custom matchers and macros, etc, in
|
17
|
+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
18
|
+
# run as spec files by default. This means that files in spec/support that end
|
19
|
+
# in _spec.rb will both be required and run as specs, causing the specs to be
|
20
|
+
# run twice. It is recommended that you do not name files matching this glob to
|
21
|
+
# end with _spec.rb. You can configure this pattern with the --pattern
|
22
|
+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
23
|
+
#
|
24
|
+
# The following line is provided for convenience purposes. It has the downside
|
25
|
+
# of increasing the boot-up time by auto-requiring all files in the support
|
26
|
+
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
27
|
+
# require only the support files necessary.
|
28
|
+
#
|
29
|
+
# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
30
|
+
|
31
|
+
RSpec.configure do |config|
|
32
|
+
# RSpec Rails can automatically mix in different behaviours to your tests
|
33
|
+
# based on their file location, for example enabling you to call `get` and
|
34
|
+
# `post` in specs under `spec/controllers`.
|
35
|
+
#
|
36
|
+
# You can disable this behaviour by removing the line below, and instead
|
37
|
+
# explicitly tag your specs with their type, e.g.:
|
38
|
+
#
|
39
|
+
# RSpec.describe UsersController, :type => :controller do
|
40
|
+
# # ...
|
41
|
+
# end
|
42
|
+
#
|
43
|
+
# The different available types are documented in the features, such as in
|
44
|
+
# https://relishapp.com/rspec/rspec-rails/docs
|
45
|
+
config.infer_spec_type_from_file_location!
|
46
|
+
|
47
|
+
# Filter lines from Rails gems in backtraces.
|
48
|
+
config.filter_rails_from_backtrace!
|
49
|
+
# arbitrary gems may also be filtered via:
|
50
|
+
# config.filter_gems_from_backtrace("gem name")
|
51
|
+
|
52
|
+
config.include Omniauth::Rails::Test::ControllerHelpers, type: :controller
|
53
|
+
config.include Omniauth::Rails::Test::RequestHelpers, type: :request
|
54
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.expand_path("../../", __FILE__)
|
4
|
+
require "rails_helper"
|
5
|
+
|
6
|
+
RSpec.describe PrivateController do
|
7
|
+
describe "#show" do
|
8
|
+
context "user is not authenticated" do
|
9
|
+
it "redirects to the sign_in page" do
|
10
|
+
get "/private"
|
11
|
+
expect(response).to redirect_to("/auth/sign_in")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context "user is authenticated" do
|
16
|
+
before do
|
17
|
+
sign_in("foo@bar.com")
|
18
|
+
end
|
19
|
+
|
20
|
+
it "responds with a 200" do
|
21
|
+
get "/private"
|
22
|
+
expect(response).to have_http_status(:success)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.expand_path("../../", __FILE__)
|
4
|
+
require "rails_helper"
|
5
|
+
|
6
|
+
RSpec.describe PublicController do
|
7
|
+
describe "#show" do
|
8
|
+
it "responds with a 200" do
|
9
|
+
get "/public"
|
10
|
+
expect(response).to have_http_status(:success)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.expand_path("../../", __FILE__)
|
4
|
+
require "rails_helper"
|
5
|
+
|
6
|
+
RSpec.describe Omniauth::Rails::SessionsController do
|
7
|
+
describe "#new" do
|
8
|
+
it "redirects to the OmniAuth provider endpoint" do
|
9
|
+
get "/auth/sign_in"
|
10
|
+
expect(response).to redirect_to("/auth/google_oauth2")
|
11
|
+
end
|
12
|
+
|
13
|
+
context "an authenticated user" do
|
14
|
+
before do
|
15
|
+
sign_in("foo@bar.com")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "redirects directly to the authenticated_root" do
|
19
|
+
get "/auth/sign_in"
|
20
|
+
expect(response).to redirect_to(Omniauth::Rails::Configuration.authenticated_root)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#destroy" do
|
26
|
+
context "an authenticated user" do
|
27
|
+
before do
|
28
|
+
sign_in("foo@bar.com")
|
29
|
+
end
|
30
|
+
|
31
|
+
it "logs the user out" do
|
32
|
+
expect(authenticated?).to eq(true)
|
33
|
+
delete "/auth/sign_out"
|
34
|
+
expect(authenticated?).to eq(false)
|
35
|
+
end
|
36
|
+
|
37
|
+
context "unauthenticated_root is blank" do
|
38
|
+
around(:each) do |example|
|
39
|
+
original_value = Omniauth::Rails::Configuration.unauthenticated_root
|
40
|
+
Omniauth::Rails::Configuration.unauthenticated_root = nil
|
41
|
+
example.run
|
42
|
+
Omniauth::Rails::Configuration.unauthenticated_root = original_value
|
43
|
+
end
|
44
|
+
|
45
|
+
it "renders some html saying you have been logged out" do
|
46
|
+
delete "/auth/sign_out"
|
47
|
+
expect(response).to have_http_status(:success)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "#create" do
|
54
|
+
context "a response with invalid CSRF" do
|
55
|
+
around(:each) do |example|
|
56
|
+
OmniAuth.config.mock_auth[:google_oauth2] = :csrf_detected
|
57
|
+
example.run
|
58
|
+
OmniAuth.config.mock_auth[:google_oauth2] = nil
|
59
|
+
end
|
60
|
+
|
61
|
+
it "redirects to /auth/failure?message=csrf_detected&strategy=google_oauth2" do
|
62
|
+
get "/auth/google_oauth2/callback"
|
63
|
+
expect(response).to redirect_to("/auth/failure?message=csrf_detected&strategy=google_oauth2")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
context "a response with invalid credentials" do
|
68
|
+
around(:each) do |example|
|
69
|
+
OmniAuth.config.mock_auth[:google_oauth2] = :invalid_credentials
|
70
|
+
example.run
|
71
|
+
OmniAuth.config.mock_auth[:google_oauth2] = nil
|
72
|
+
end
|
73
|
+
|
74
|
+
it "redirects to /auth/failure?message=invalid_credentials&strategy=google_oauth2" do
|
75
|
+
get "/auth/google_oauth2/callback"
|
76
|
+
expect(response).to redirect_to("/auth/failure?message=invalid_credentials&strategy=google_oauth2")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
context "a valid auth response" do
|
81
|
+
it "redirects to Configuration.authenticated_root" do
|
82
|
+
get "/auth/google_oauth2/callback"
|
83
|
+
expect(response).to redirect_to(Omniauth::Rails::Configuration.authenticated_root)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
3
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
4
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
5
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
6
|
+
# files.
|
7
|
+
#
|
8
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
9
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
10
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
11
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
12
|
+
# a separate helper file that requires the additional dependencies and performs
|
13
|
+
# the additional setup, and require it from the spec files that actually need
|
14
|
+
# it.
|
15
|
+
#
|
16
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
17
|
+
# users commonly want.
|
18
|
+
#
|
19
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
20
|
+
RSpec.configure do |config|
|
21
|
+
# rspec-expectations config goes here. You can use an alternate
|
22
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
23
|
+
# assertions if you prefer.
|
24
|
+
config.expect_with :rspec do |expectations|
|
25
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
26
|
+
# and `failure_message` of custom matchers include text for helper methods
|
27
|
+
# defined using `chain`, e.g.:
|
28
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
29
|
+
# # => "be bigger than 2 and smaller than 4"
|
30
|
+
# ...rather than:
|
31
|
+
# # => "be bigger than 2"
|
32
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
33
|
+
end
|
34
|
+
|
35
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
36
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
37
|
+
config.mock_with :rspec do |mocks|
|
38
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
39
|
+
# a real object. This is generally recommended, and will default to
|
40
|
+
# `true` in RSpec 4.
|
41
|
+
mocks.verify_partial_doubles = true
|
42
|
+
end
|
43
|
+
|
44
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
45
|
+
# have no way to turn it off -- the option exists only for backwards
|
46
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
47
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
48
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
49
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
50
|
+
|
51
|
+
# The settings below are suggested to provide a good initial experience
|
52
|
+
# with RSpec, but feel free to customize to your heart's content.
|
53
|
+
|
54
|
+
# This allows you to limit a spec run to individual examples or groups
|
55
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
56
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
57
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
58
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
59
|
+
config.filter_run_when_matching :focus
|
60
|
+
|
61
|
+
# Allows RSpec to persist some state between runs in order to support
|
62
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
63
|
+
# you configure your source control system to ignore this file.
|
64
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
65
|
+
|
66
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
67
|
+
# recommended. For more details, see:
|
68
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
69
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
70
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
71
|
+
config.disable_monkey_patching!
|
72
|
+
|
73
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
74
|
+
# file, and it's useful to allow more verbose output when running an
|
75
|
+
# individual spec file.
|
76
|
+
if config.files_to_run.one?
|
77
|
+
# Use the documentation formatter for detailed output,
|
78
|
+
# unless a formatter has already been configured
|
79
|
+
# (e.g. via a command-line flag).
|
80
|
+
config.default_formatter = "doc"
|
81
|
+
end
|
82
|
+
|
83
|
+
# Print the 10 slowest examples and example groups at the
|
84
|
+
# end of the spec run, to help surface which specs are running
|
85
|
+
# particularly slow.
|
86
|
+
# config.profile_examples = 10
|
87
|
+
|
88
|
+
# Run specs in random order to surface order dependencies. If you find an
|
89
|
+
# order dependency and want to debug it, you can fix the order by providing
|
90
|
+
# the seed, which is printed after each run.
|
91
|
+
# --seed 1234
|
92
|
+
config.order = :random
|
93
|
+
|
94
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
95
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
96
|
+
# test failures related to randomization by passing the same `--seed` value
|
97
|
+
# as the one that triggered the failure.
|
98
|
+
Kernel.srand config.seed
|
99
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
I"}app/assets/stylesheets/application.css?type=text/css&id=c75c96f38ddd7d3acbdc8eb353df2a587cb93deb7d5cb8959dde22ab83527753:ET
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�/Users/danrabinowitz/code/omniauth-rails/app/assets/stylesheets/omniauth/rails/application.css?type=text/css&id=10873ebd6f3f5be50b1faa13da13c681bcfb84ae3146e4e78693c23f96e6cca5:ET
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�/Users/danrabinowitz/code/omniauth-rails/app/assets/stylesheets/omniauth/rails/application.css?type=text/css&pipeline=self&id=eac832b70e7f05c8bc995ff9adc7b5eca4e938f20232e991a64c5ea4648e4bdf:ET
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/javascripts/application.js?type=application/javascript&pipeline=self&id=2409dfa578e19808d47bafbf9b9c29149faa28150242b9fac9573650c7f08204:ET
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/javascripts/application.js?type=application/javascript&id=1b8fedc464a39e95fe859936c0fda0c108b222efde53d177d9aef62398a5f205:ET
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�/Users/danrabinowitz/code/omniauth-rails/app/assets/stylesheets/omniauth/rails/application.css?type=text/css&pipeline=self&id=c676ad8c34760c385acb5cecdead17e690d76d9fb1c4b769d00a8860ae9d1db8:ET
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
"%�<������X���̀#+�����,�(o���
|
@@ -0,0 +1 @@
|
|
1
|
+
I"}app/assets/stylesheets/application.css?type=text/css&id=fd801911a7e6193d2838bd7f703417bf71d8ce3ca31ff326107768f112ff96c6:ET
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/javascripts/application.js?type=application/javascript&id=3076e81b81fd17cbd4b1354d2abbe5577d9839a4a1c8ec70ea92ba0cedb620ef:ET
|
@@ -0,0 +1 @@
|
|
1
|
+
"%��Rm�v�S3.��O�L���ڹc�ƕq�=_j�
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/javascripts/application.js?type=application/javascript&pipeline=self&id=b3730f963c5abdbee2696d8f87fafc89d0b97fa099737d43969e3c2a03346914:ET
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�/Users/danrabinowitz/code/omniauth-rails/app/assets/stylesheets/omniauth/rails/application.css?type=text/css&pipeline=self&id=c1a9b030ae533063886d78ff5a42558e067b3f516fed9c73cfb48a3e2758c02f:ET
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�/Users/danrabinowitz/code/omniauth-rails/app/assets/stylesheets/omniauth/rails/application.css?type=text/css&pipeline=self&id=f59f6f9bee8fde64c70583604fc42dad09d51ead1747545cd27fe7a993bd7c01:ET
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�/Users/danrabinowitz/code/omniauth-rails/app/assets/stylesheets/omniauth/rails/application.css?type=text/css&id=13c0d152244934572dba3ac4543c9165dc56c46a82e76a41b795bd940c1c03b3:ET
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
"%�!�����=��U�"6���{��(��z�
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=7206b13a3fa5378a73e0412e4386f03a239c6343cad1fb13af7ea6e86eebcc10:ET
|
@@ -0,0 +1 @@
|
|
1
|
+
"%�!�����=��U�"6���{��(��z�
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�app/assets/stylesheets/application.css?type=text/css&pipeline=self&id=787d547e343a1daa42e771726a93bc90a2a8fcdabd14ac09d0d9f80f4035f773:ET
|
@@ -0,0 +1 @@
|
|
1
|
+
I"�/Users/danrabinowitz/code/omniauth-rails/app/assets/stylesheets/omniauth/rails/application.css?type=text/css&id=a19c132e3c446ff10b0009fd0ec4d057ab7914cef41c95b2c16f4fa70a857875:ET
|