casino 1.3.0 → 1.3.1
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.
- data.tar.gz.sig +0 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile.lock +20 -10
- data/README.md +3 -55
- data/app/assets/fonts/casino-icons.eot +0 -0
- data/app/assets/fonts/casino-icons.svg +36 -0
- data/app/assets/fonts/casino-icons.ttf +0 -0
- data/app/assets/fonts/casino-icons.woff +0 -0
- data/app/assets/stylesheets/casino.scss +15 -0
- data/app/assets/stylesheets/casino/icons.scss +53 -0
- data/app/views/casino/sessions/new.html.erb +6 -0
- data/app/views/casino/two_factor_authenticators/new.html.erb +1 -1
- data/casino.gemspec +1 -0
- data/config/locales/de.yml +1 -0
- data/config/locales/en.yml +1 -0
- data/lib/casino/listener/second_factor_authentication_acceptor.rb +2 -2
- data/lib/casino/version.rb +1 -1
- data/spec/controllers/listener/legacy_validator_spec.rb +4 -4
- data/spec/controllers/listener/second_factor_authentication_acceptor_spec.rb +1 -1
- data/spec/features/login_spec.rb +77 -0
- data/spec/features/logout_spec.rb +16 -0
- data/spec/features/session_overview_spec.rb +56 -0
- data/spec/spec_helper.rb +3 -7
- data/spec/support/features_helper.rb +28 -0
- metadata +35 -7
- metadata.gz.sig +3 -2
- data/.rvmrc +0 -48
- data/spec/support/sign_in.rb +0 -11
data.tar.gz.sig
CHANGED
|
Binary file
|
data/.ruby-gemset
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
casino
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby-1.9.3-p194
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
casino (1.3.
|
|
4
|
+
casino (1.3.1)
|
|
5
5
|
casino_core (~> 1.4.0)
|
|
6
6
|
http_accept_language (~> 2.0.0.pre)
|
|
7
7
|
jquery-rails (~> 2.1)
|
|
@@ -37,21 +37,27 @@ GEM
|
|
|
37
37
|
activesupport (3.2.13)
|
|
38
38
|
i18n (= 0.6.1)
|
|
39
39
|
multi_json (~> 1.0)
|
|
40
|
-
addressable (2.3.
|
|
40
|
+
addressable (2.3.4)
|
|
41
41
|
arel (3.0.2)
|
|
42
42
|
builder (3.0.4)
|
|
43
|
-
|
|
43
|
+
capybara (2.1.0)
|
|
44
|
+
mime-types (>= 1.16)
|
|
45
|
+
nokogiri (>= 1.3.3)
|
|
46
|
+
rack (>= 1.0.0)
|
|
47
|
+
rack-test (>= 0.5.4)
|
|
48
|
+
xpath (~> 2.0)
|
|
49
|
+
casino_core (1.4.3)
|
|
44
50
|
activerecord (~> 3.2.9)
|
|
45
51
|
addressable (~> 2.3)
|
|
46
52
|
faraday (~> 0.8)
|
|
47
53
|
rotp (~> 1.4)
|
|
48
54
|
terminal-table (~> 1.4)
|
|
49
55
|
useragent (~> 0.4)
|
|
50
|
-
diff-lcs (1.2.
|
|
56
|
+
diff-lcs (1.2.4)
|
|
51
57
|
erubis (2.7.0)
|
|
52
58
|
faraday (0.8.7)
|
|
53
59
|
multipart-post (~> 1.1)
|
|
54
|
-
hike (1.2.
|
|
60
|
+
hike (1.2.2)
|
|
55
61
|
http_accept_language (2.0.0.pre)
|
|
56
62
|
i18n (0.6.1)
|
|
57
63
|
journey (1.0.4)
|
|
@@ -63,9 +69,10 @@ GEM
|
|
|
63
69
|
i18n (>= 0.4.0)
|
|
64
70
|
mime-types (~> 1.16)
|
|
65
71
|
treetop (~> 1.4.8)
|
|
66
|
-
mime-types (1.
|
|
72
|
+
mime-types (1.23)
|
|
67
73
|
multi_json (1.7.2)
|
|
68
74
|
multipart-post (1.2.0)
|
|
75
|
+
nokogiri (1.5.9)
|
|
69
76
|
polyglot (0.3.3)
|
|
70
77
|
rack (1.4.5)
|
|
71
78
|
rack-cache (1.2)
|
|
@@ -89,7 +96,7 @@ GEM
|
|
|
89
96
|
rake (>= 0.8.7)
|
|
90
97
|
rdoc (~> 3.4)
|
|
91
98
|
thor (>= 0.14.6, < 2.0)
|
|
92
|
-
rake (10.0.
|
|
99
|
+
rake (10.0.4)
|
|
93
100
|
rdoc (3.12.2)
|
|
94
101
|
json (~> 1.4)
|
|
95
102
|
rotp (1.4.1)
|
|
@@ -100,7 +107,7 @@ GEM
|
|
|
100
107
|
rspec-core (2.13.1)
|
|
101
108
|
rspec-expectations (2.13.0)
|
|
102
109
|
diff-lcs (>= 1.1.3, < 2.0)
|
|
103
|
-
rspec-mocks (2.13.
|
|
110
|
+
rspec-mocks (2.13.1)
|
|
104
111
|
rspec-rails (2.13.0)
|
|
105
112
|
actionpack (>= 3.0)
|
|
106
113
|
activesupport (>= 3.0)
|
|
@@ -119,18 +126,21 @@ GEM
|
|
|
119
126
|
tilt (~> 1.1, != 1.3.0)
|
|
120
127
|
sqlite3 (1.3.7)
|
|
121
128
|
terminal-table (1.4.5)
|
|
122
|
-
thor (0.
|
|
123
|
-
tilt (1.3.
|
|
129
|
+
thor (0.18.1)
|
|
130
|
+
tilt (1.3.7)
|
|
124
131
|
treetop (1.4.12)
|
|
125
132
|
polyglot
|
|
126
133
|
polyglot (>= 0.3.1)
|
|
127
134
|
tzinfo (0.3.37)
|
|
128
135
|
useragent (0.5.0)
|
|
136
|
+
xpath (2.0.0)
|
|
137
|
+
nokogiri (~> 1.3)
|
|
129
138
|
|
|
130
139
|
PLATFORMS
|
|
131
140
|
ruby
|
|
132
141
|
|
|
133
142
|
DEPENDENCIES
|
|
143
|
+
capybara (~> 2.1)
|
|
134
144
|
casino!
|
|
135
145
|
rake (~> 10.0)
|
|
136
146
|
rspec (~> 2.12)
|
data/README.md
CHANGED
|
@@ -13,60 +13,8 @@ This simplifies the creation of a CAS server implementation for other developers
|
|
|
13
13
|
|
|
14
14
|
## Setup
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Please check our [documentation](http://casino.rbcas.com/) for setup and configuration instructions.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
## License
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
cd my-casino
|
|
22
|
-
|
|
23
|
-
### 2. Include and install CASino engine gem
|
|
24
|
-
|
|
25
|
-
Edit your application's Gemfile and add these lines if missing:
|
|
26
|
-
|
|
27
|
-
gem 'sqlite3', '~> 1.3', :group => :development
|
|
28
|
-
gem 'casino'
|
|
29
|
-
|
|
30
|
-
Run `bundle install` afterwards.
|
|
31
|
-
|
|
32
|
-
### 3. Generate the initial configuration
|
|
33
|
-
|
|
34
|
-
bundle exec rails g casino:install
|
|
35
|
-
|
|
36
|
-
### 4. Edit the configuration
|
|
37
|
-
|
|
38
|
-
vim config/cas.yml
|
|
39
|
-
vim config/database.yml
|
|
40
|
-
|
|
41
|
-
Information about configuration can be found in our Wiki: [Configuration](https://github.com/rbCAS/CASino/wiki/Configuration)
|
|
42
|
-
|
|
43
|
-
### 5. Load the database
|
|
44
|
-
|
|
45
|
-
Load the default DB schema with `rake casino_core:db:schema:load`. After an update, run `rake casino_core:db:migrate` instead.
|
|
46
|
-
|
|
47
|
-
### 6. Configure a cronjob
|
|
48
|
-
|
|
49
|
-
Configure a cronjob to do a `rake casino_core:cleanup:all > /dev/null` every 5 minutes. This is not essential in a development environment.
|
|
50
|
-
|
|
51
|
-
### 7. Customize it!
|
|
52
|
-
|
|
53
|
-
Learn how to customize your CASino installation: [Customization](https://github.com/rbCAS/CASino/wiki/Customization)
|
|
54
|
-
|
|
55
|
-
### 8. Ship it!
|
|
56
|
-
|
|
57
|
-
To start the server in a development environment, run:
|
|
58
|
-
|
|
59
|
-
bundle exec rails s
|
|
60
|
-
|
|
61
|
-
## Contributing to CASino
|
|
62
|
-
|
|
63
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
|
64
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
|
65
|
-
* Fork the project.
|
|
66
|
-
* Start a feature/bugfix branch.
|
|
67
|
-
* Commit and push until you are happy with your contribution.
|
|
68
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
|
69
|
-
|
|
70
|
-
## Copyright
|
|
71
|
-
|
|
72
|
-
Copyright (c) 2012 Nils Caspar. See LICENSE.txt for further details.
|
|
20
|
+
CASino is released under the [MIT License](http://www.opensource.org/licenses/MIT). See LICENSE.txt for further details.
|
|
Binary file
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
<metadata>
|
|
5
|
+
Created by FontForge 20110222 at Tue May 7 15:36:48 2013
|
|
6
|
+
By root
|
|
7
|
+
Copyright (C) 2012 by original authors @ fontello.com
|
|
8
|
+
</metadata>
|
|
9
|
+
<defs>
|
|
10
|
+
<font id="casino-icons" horiz-adv-x="887" >
|
|
11
|
+
<font-face
|
|
12
|
+
font-family="casino-icons"
|
|
13
|
+
font-weight="500"
|
|
14
|
+
font-stretch="normal"
|
|
15
|
+
units-per-em="1000"
|
|
16
|
+
panose-1="2 0 6 9 0 0 0 0 0 0"
|
|
17
|
+
ascent="850"
|
|
18
|
+
descent="-150"
|
|
19
|
+
bbox="15 -79 872 779"
|
|
20
|
+
underline-thickness="50"
|
|
21
|
+
underline-position="-100"
|
|
22
|
+
unicode-range="U+E705-E705"
|
|
23
|
+
/>
|
|
24
|
+
<missing-glyph
|
|
25
|
+
d="M33 0v666h265v-666h-265zM66 33h199v600h-199v-600z" />
|
|
26
|
+
<glyph glyph-name=".notdef"
|
|
27
|
+
d="M33 0v666h265v-666h-265zM66 33h199v600h-199v-600z" />
|
|
28
|
+
<glyph glyph-name=".null" horiz-adv-x="0"
|
|
29
|
+
/>
|
|
30
|
+
<glyph glyph-name="nonmarkingreturn"
|
|
31
|
+
/>
|
|
32
|
+
<glyph glyph-name="uniE705" unicode=""
|
|
33
|
+
d="M15 350q0 123 60 219.5t153 151.5q101 58 216 58q123 0 219.5 -60t151.5 -154q57 -99 57 -215q0 -123 -60 -219.5t-153 -151.5q-101 -58 -215 -58q-123 0 -220 60t-152 154q-57 99 -57 215zM301 82q0 -8 5.5 -13t12.5 -5h250q17 0 17 18v36q0 18 -17 18h-54v268
|
|
34
|
+
q0 17 -18 17h-178q-18 0 -18 -17v-36q0 -8 5.5 -13t12.5 -5h53v-214h-53q-7 0 -12.5 -5t-5.5 -13v-36zM372 511q0 -7 5 -12.5t13 -5.5h107q7 0 12.5 5.5t5.5 12.5v107q0 8 -5.5 13t-12.5 5h-107q-8 0 -13 -5t-5 -13v-107z" />
|
|
35
|
+
</font>
|
|
36
|
+
</defs></svg>
|
|
Binary file
|
|
Binary file
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,600);
|
|
2
2
|
@import "casino/normalize";
|
|
3
|
+
@import "casino/icons";
|
|
3
4
|
|
|
4
5
|
/// DEFAULT SETTINGS ///
|
|
5
6
|
$buttonColor: #0074ad !default;
|
|
@@ -231,6 +232,20 @@ table {
|
|
|
231
232
|
}
|
|
232
233
|
}
|
|
233
234
|
|
|
235
|
+
/// LOGIN NOTICE ///
|
|
236
|
+
.notice {
|
|
237
|
+
height: auto;
|
|
238
|
+
background: #f6f6f5;
|
|
239
|
+
border: none;
|
|
240
|
+
margin-bottom: -10%;
|
|
241
|
+
margin-top: 10%;
|
|
242
|
+
padding: 5px;
|
|
243
|
+
font-size: 90%;
|
|
244
|
+
|
|
245
|
+
.icon-info {
|
|
246
|
+
font-size: 100%;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
234
249
|
|
|
235
250
|
/// SESSIONS ///
|
|
236
251
|
.sessions, .logout {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: 'casino-icons';
|
|
3
|
+
src: font-url('casino-icons.eot');
|
|
4
|
+
src: font-url('casino-icons.eot#iefix') format('embedded-opentype'),
|
|
5
|
+
font-url('casino-icons.woff') format('woff'),
|
|
6
|
+
font-url('casino-icons.ttf') format('truetype'),
|
|
7
|
+
font-url('casino-icons.svg#casino-icons') format('svg');
|
|
8
|
+
font-weight: normal;
|
|
9
|
+
font-style: normal;
|
|
10
|
+
}
|
|
11
|
+
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
|
|
12
|
+
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
|
|
13
|
+
/*
|
|
14
|
+
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
|
15
|
+
@font-face {
|
|
16
|
+
font-family: 'casino-icons';
|
|
17
|
+
src: url('../font/casino-icons.svg?11572120#casino-icons') format('svg');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
[class^="icon-"]:before, [class*=" icon-"]:before {
|
|
23
|
+
font-family: "casino-icons";
|
|
24
|
+
font-style: normal;
|
|
25
|
+
font-weight: normal;
|
|
26
|
+
speak: none;
|
|
27
|
+
|
|
28
|
+
display: inline-block;
|
|
29
|
+
text-decoration: inherit;
|
|
30
|
+
width: 1em;
|
|
31
|
+
margin-right: .2em;
|
|
32
|
+
text-align: center;
|
|
33
|
+
/* opacity: .8; */
|
|
34
|
+
|
|
35
|
+
/* For safety - reset parent styles, that can break glyph codes*/
|
|
36
|
+
font-variant: normal;
|
|
37
|
+
text-transform: none;
|
|
38
|
+
|
|
39
|
+
/* fix buttons height, for twitter bootstrap */
|
|
40
|
+
line-height: 1em;
|
|
41
|
+
|
|
42
|
+
/* Animation center compensation - magrins should be symmetric */
|
|
43
|
+
/* remove if not needed */
|
|
44
|
+
margin-left: .2em;
|
|
45
|
+
|
|
46
|
+
/* you can be more comfortable with increased icons size */
|
|
47
|
+
/* font-size: 120%; */
|
|
48
|
+
|
|
49
|
+
/* Uncomment for 3D effect */
|
|
50
|
+
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.icon-info:before { content: '\e705'; } /* '' */
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
<% login_notice = t('login.notice', default: '') %>
|
|
1
2
|
<div class="container">
|
|
3
|
+
<% unless login_notice.blank? %>
|
|
4
|
+
<div class="notice box">
|
|
5
|
+
<i class="icon-info"></i> <%= login_notice %>
|
|
6
|
+
</div>
|
|
7
|
+
<% end %>
|
|
2
8
|
<div class="login box">
|
|
3
9
|
<%= render 'messages' %>
|
|
4
10
|
<div class="logo">
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<div id="qr-code">
|
|
14
14
|
<img src="https://chart.googleapis.com/chart?cht=qr&chs=250x250&chl=<%= u "otpauth://totp/#{u CASinoCore::Settings.frontend[:sso_name] + ': ' + @two_factor_authenticator.user.username}?secret=#{@two_factor_authenticator.secret}" %>" height="250" width="250"><br />
|
|
15
15
|
</div>
|
|
16
|
-
<p>
|
|
16
|
+
<p id="secret">
|
|
17
17
|
<%= t('two_factor_authenticators.secret') %>: <%= @two_factor_authenticator.secret %>
|
|
18
18
|
</p>
|
|
19
19
|
</div>
|
data/casino.gemspec
CHANGED
|
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
|
|
|
23
23
|
s.cert_chain = ['casino-public_cert.pem']
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
+
s.add_development_dependency 'capybara', '~> 2.1'
|
|
26
27
|
s.add_development_dependency 'rake', '~> 10.0'
|
|
27
28
|
s.add_development_dependency 'rspec', '~> 2.12'
|
|
28
29
|
s.add_development_dependency 'rspec-rails', '~> 2.0'
|
data/config/locales/de.yml
CHANGED
|
@@ -7,6 +7,7 @@ de:
|
|
|
7
7
|
label_password: "Passwort"
|
|
8
8
|
label_button: "Login"
|
|
9
9
|
label_remember_me: "Eingeloggt bleiben"
|
|
10
|
+
notice: ""
|
|
10
11
|
service_not_allowed:
|
|
11
12
|
title: "Service nicht erlaubt"
|
|
12
13
|
message: "Dieser SSO-Server ist nicht konfiguriert, um Logins für \"%{service}\" zu erlauben. Wenn Sie denken, es handle sich hierbei um einen Fehler, kontaktieren Sie bitte Ihren Administrator."
|
data/config/locales/en.yml
CHANGED
|
@@ -7,6 +7,7 @@ en:
|
|
|
7
7
|
label_password: "Password"
|
|
8
8
|
label_button: "Login"
|
|
9
9
|
label_remember_me: "Stay logged in"
|
|
10
|
+
notice: ""
|
|
10
11
|
service_not_allowed:
|
|
11
12
|
title: "Service not allowed"
|
|
12
13
|
message: "This SSO server is not configured to allow logins to \"%{service}\". If you think this is an error, please contact your administrator."
|
|
@@ -6,8 +6,8 @@ class CASino::Listener::SecondFactorAuthenticationAcceptor < CASino::Listener
|
|
|
6
6
|
@controller.redirect_to login_path
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
def user_logged_in(url, ticket_granting_ticket)
|
|
10
|
-
@controller.cookies[:tgt] = ticket_granting_ticket
|
|
9
|
+
def user_logged_in(url, ticket_granting_ticket, cookie_expiry_time = nil)
|
|
10
|
+
@controller.cookies[:tgt] = { value: ticket_granting_ticket, expires: cookie_expiry_time }
|
|
11
11
|
if url.nil?
|
|
12
12
|
@controller.redirect_to sessions_path, status: :see_other
|
|
13
13
|
else
|
data/lib/casino/version.rb
CHANGED
|
@@ -3,20 +3,20 @@ require 'spec_helper'
|
|
|
3
3
|
describe CASino::Listener::LegacyValidator do
|
|
4
4
|
let(:controller) { Object.new }
|
|
5
5
|
let(:listener) { described_class.new(controller) }
|
|
6
|
-
let(:
|
|
7
|
-
let(:render_parameters) { { text:
|
|
6
|
+
let(:response_text) { "foobar\nbla\n" }
|
|
7
|
+
let(:render_parameters) { { text: response_text, content_type: 'text/plain' } }
|
|
8
8
|
|
|
9
9
|
describe '#validation_succeeded' do
|
|
10
10
|
it 'tells the controller to render the response text' do
|
|
11
11
|
controller.should_receive(:render).with(render_parameters)
|
|
12
|
-
listener.validation_succeeded(
|
|
12
|
+
listener.validation_succeeded(response_text)
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
describe '#validation_failed' do
|
|
17
17
|
it 'tells the controller to render the response text' do
|
|
18
18
|
controller.should_receive(:render).with(render_parameters)
|
|
19
|
-
listener.validation_failed(
|
|
19
|
+
listener.validation_failed(response_text)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
end
|
|
@@ -35,7 +35,7 @@ describe CASino::Listener::SecondFactorAuthenticationAcceptor do
|
|
|
35
35
|
|
|
36
36
|
it 'creates the tgt cookie' do
|
|
37
37
|
listener.user_logged_in(url, ticket_granting_ticket)
|
|
38
|
-
controller.cookies[:tgt].should == ticket_granting_ticket
|
|
38
|
+
controller.cookies[:tgt].should == { value: ticket_granting_ticket, expires: nil }
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
end
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe 'Login' do
|
|
4
|
+
include CASino::Engine.routes.url_helpers
|
|
5
|
+
|
|
6
|
+
subject { page }
|
|
7
|
+
|
|
8
|
+
context 'with two-factor authentication enabled' do
|
|
9
|
+
before do
|
|
10
|
+
in_browser(:other) do
|
|
11
|
+
sign_in
|
|
12
|
+
@totp = enable_two_factor_authentication
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
context 'with valid username and password' do
|
|
17
|
+
before { sign_in }
|
|
18
|
+
|
|
19
|
+
it { should_not have_button('Login') }
|
|
20
|
+
it { should have_button('Continue') }
|
|
21
|
+
its(:current_path) { should == login_path }
|
|
22
|
+
|
|
23
|
+
context 'when filling in the correct otp' do
|
|
24
|
+
before do
|
|
25
|
+
fill_in :otp, with: @totp.now
|
|
26
|
+
click_button 'Continue'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it { should_not have_button('Login') }
|
|
30
|
+
it { should_not have_button('Continue') }
|
|
31
|
+
its(:current_path) { should == sessions_path }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
context 'when filling in an incorrect otp' do
|
|
35
|
+
before do
|
|
36
|
+
fill_in :otp, with: 'aaaaa'
|
|
37
|
+
click_button 'Continue'
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it { should have_text('The one-time password you entered is not correct') }
|
|
41
|
+
it { should have_button('Continue') }
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
context 'with two-factor authentication disabled' do
|
|
47
|
+
context 'with valid username and password' do
|
|
48
|
+
before { sign_in }
|
|
49
|
+
|
|
50
|
+
it { should_not have_button('Login') }
|
|
51
|
+
its(:current_path) { should == sessions_path }
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
context 'with invalid username' do
|
|
56
|
+
before { sign_in username: 'lalala', password: 'foobar123' }
|
|
57
|
+
|
|
58
|
+
it { should have_button('Login') }
|
|
59
|
+
it { should have_text('Incorrect username or password') }
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
context 'with blank password' do
|
|
63
|
+
before { sign_in password: '' }
|
|
64
|
+
|
|
65
|
+
it { should have_button('Login') }
|
|
66
|
+
it { should have_text('Incorrect username or password') }
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
context 'with german locale' do
|
|
70
|
+
before do
|
|
71
|
+
page.driver.header 'Accept-Language', 'de'
|
|
72
|
+
visit login_path
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
it { should have_text('Benutzername') }
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe 'Logout' do
|
|
4
|
+
include CASino::Engine.routes.url_helpers
|
|
5
|
+
|
|
6
|
+
subject { page }
|
|
7
|
+
|
|
8
|
+
context 'when logged in' do
|
|
9
|
+
before do
|
|
10
|
+
sign_in
|
|
11
|
+
click_link 'Logout'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it { should have_content('logged out') }
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe 'Session overview' do
|
|
4
|
+
include CASino::Engine.routes.url_helpers
|
|
5
|
+
|
|
6
|
+
subject { page }
|
|
7
|
+
|
|
8
|
+
context 'when logged in' do
|
|
9
|
+
before do
|
|
10
|
+
sign_in
|
|
11
|
+
visit sessions_path
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it { should have_link('Logout', href: logout_path) }
|
|
15
|
+
it { should have_text('Your Active Sessions') }
|
|
16
|
+
it { should have_text('Active Session') }
|
|
17
|
+
|
|
18
|
+
context 'without other sessions' do
|
|
19
|
+
it { should_not have_link('End session') }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
context 'when other sessions exist' do
|
|
23
|
+
before do
|
|
24
|
+
in_browser(:other) do
|
|
25
|
+
sign_in
|
|
26
|
+
end
|
|
27
|
+
visit sessions_path
|
|
28
|
+
end
|
|
29
|
+
it { should have_link('End session') }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
context 'with two-factor authentication disabled' do
|
|
33
|
+
before do
|
|
34
|
+
in_browser(:other) do
|
|
35
|
+
sign_in
|
|
36
|
+
end
|
|
37
|
+
visit sessions_path
|
|
38
|
+
end
|
|
39
|
+
it { should have_link('Enable', href: new_two_factor_authenticator_path) }
|
|
40
|
+
it { should_not have_link('Disable') }
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
context 'with two-factor authentication enabled' do
|
|
44
|
+
before { enable_two_factor_authentication }
|
|
45
|
+
it { should_not have_link('Enable', href: new_two_factor_authenticator_path) }
|
|
46
|
+
it { should have_link('Disable') }
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
context 'when not logged in' do
|
|
51
|
+
before { visit sessions_path }
|
|
52
|
+
|
|
53
|
+
it { should have_button('Login') }
|
|
54
|
+
its(:current_path) { should == login_path }
|
|
55
|
+
end
|
|
56
|
+
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -8,6 +8,8 @@ require File.expand_path('../dummy/config/environment.rb', __FILE__)
|
|
|
8
8
|
require 'rspec/rails'
|
|
9
9
|
require 'rspec/autorun'
|
|
10
10
|
|
|
11
|
+
require 'capybara/rails'
|
|
12
|
+
|
|
11
13
|
ENGINE_RAILS_ROOT = File.join(File.dirname(__FILE__), '../')
|
|
12
14
|
|
|
13
15
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
|
@@ -15,13 +17,7 @@ ENGINE_RAILS_ROOT = File.join(File.dirname(__FILE__), '../')
|
|
|
15
17
|
Dir[File.join(ENGINE_RAILS_ROOT, 'spec/support/**/*.rb')].each {|f| require f }
|
|
16
18
|
|
|
17
19
|
RSpec.configure do |config|
|
|
18
|
-
|
|
19
|
-
#
|
|
20
|
-
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
|
21
|
-
#
|
|
22
|
-
# config.mock_with :mocha
|
|
23
|
-
# config.mock_with :flexmock
|
|
24
|
-
# config.mock_with :rr
|
|
20
|
+
config.use_transactional_fixtures = true
|
|
25
21
|
|
|
26
22
|
# If true, the base class of anonymous controllers will be inferred
|
|
27
23
|
# automatically. This will be the default behavior in future versions of
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module FeatureHelpers
|
|
2
|
+
def in_browser(name)
|
|
3
|
+
original_browser = Capybara.session_name
|
|
4
|
+
Capybara.session_name = name
|
|
5
|
+
yield
|
|
6
|
+
Capybara.session_name = original_browser
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def sign_in(options = {})
|
|
10
|
+
visit login_path
|
|
11
|
+
fill_in 'username', with: options[:username] || 'testuser'
|
|
12
|
+
fill_in 'password', with: options[:password] || 'foobar123'
|
|
13
|
+
click_button 'Login'
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def enable_two_factor_authentication
|
|
17
|
+
visit new_two_factor_authenticator_path
|
|
18
|
+
secret = find('p#secret').text.gsub(/^Secret:\s*/, '')
|
|
19
|
+
ROTP::TOTP.new(secret).tap do |totp|
|
|
20
|
+
fill_in 'otp', with: "#{totp.now}"
|
|
21
|
+
click_button 'Verify and enable'
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
RSpec.configure do |config|
|
|
27
|
+
config.include FeatureHelpers, type: :feature
|
|
28
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: casino
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.1
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -38,8 +38,24 @@ cert_chain:
|
|
|
38
38
|
b1VSdnUwRzgvWXlIVUFtSVUvV0tyanIxYmdjZjFWUnYKUjRLRDFNblVWL3Y1
|
|
39
39
|
MDJwaU1sWG1qeE9XZGJLOHl2UUVIa3N1L3pqYkNqU3UrTTJrd0ZtV0dzeDVu
|
|
40
40
|
eCtWZHc9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
|
|
41
|
-
date: 2013-
|
|
41
|
+
date: 2013-05-09 00:00:00.000000000 Z
|
|
42
42
|
dependencies:
|
|
43
|
+
- !ruby/object:Gem::Dependency
|
|
44
|
+
name: capybara
|
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
|
46
|
+
none: false
|
|
47
|
+
requirements:
|
|
48
|
+
- - ~>
|
|
49
|
+
- !ruby/object:Gem::Version
|
|
50
|
+
version: '2.1'
|
|
51
|
+
type: :development
|
|
52
|
+
prerelease: false
|
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
54
|
+
none: false
|
|
55
|
+
requirements:
|
|
56
|
+
- - ~>
|
|
57
|
+
- !ruby/object:Gem::Version
|
|
58
|
+
version: '2.1'
|
|
43
59
|
- !ruby/object:Gem::Dependency
|
|
44
60
|
name: rake
|
|
45
61
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -197,13 +213,18 @@ files:
|
|
|
197
213
|
- .gitignore
|
|
198
214
|
- .powrc
|
|
199
215
|
- .rspec
|
|
200
|
-
- .
|
|
216
|
+
- .ruby-gemset
|
|
217
|
+
- .ruby-version
|
|
201
218
|
- .travis.yml
|
|
202
219
|
- Gemfile
|
|
203
220
|
- Gemfile.lock
|
|
204
221
|
- LICENSE.txt
|
|
205
222
|
- README.md
|
|
206
223
|
- Rakefile
|
|
224
|
+
- app/assets/fonts/casino-icons.eot
|
|
225
|
+
- app/assets/fonts/casino-icons.svg
|
|
226
|
+
- app/assets/fonts/casino-icons.ttf
|
|
227
|
+
- app/assets/fonts/casino-icons.woff
|
|
207
228
|
- app/assets/images/logo.png
|
|
208
229
|
- app/assets/images/logo@2x.png
|
|
209
230
|
- app/assets/images/rails.png
|
|
@@ -211,6 +232,7 @@ files:
|
|
|
211
232
|
- app/assets/javascripts/casino/index.js
|
|
212
233
|
- app/assets/javascripts/casino/sessions.js.coffee
|
|
213
234
|
- app/assets/stylesheets/casino.scss
|
|
235
|
+
- app/assets/stylesheets/casino/icons.scss
|
|
214
236
|
- app/assets/stylesheets/casino/normalize.css
|
|
215
237
|
- app/controllers/casino/api/v1/tickets_controller.rb
|
|
216
238
|
- app/controllers/casino/application_controller.rb
|
|
@@ -326,9 +348,12 @@ files:
|
|
|
326
348
|
- spec/dummy/public/500.html
|
|
327
349
|
- spec/dummy/public/favicon.ico
|
|
328
350
|
- spec/dummy/script/rails
|
|
351
|
+
- spec/features/login_spec.rb
|
|
352
|
+
- spec/features/logout_spec.rb
|
|
353
|
+
- spec/features/session_overview_spec.rb
|
|
329
354
|
- spec/spec_helper.rb
|
|
330
355
|
- spec/support/.gitkeep
|
|
331
|
-
- spec/support/
|
|
356
|
+
- spec/support/features_helper.rb
|
|
332
357
|
- vendor/assets/javascripts/.gitkeep
|
|
333
358
|
- vendor/assets/stylesheets/.gitkeep
|
|
334
359
|
homepage: http://rbcas.org/
|
|
@@ -346,7 +371,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
346
371
|
version: '0'
|
|
347
372
|
segments:
|
|
348
373
|
- 0
|
|
349
|
-
hash:
|
|
374
|
+
hash: -2263526946458307315
|
|
350
375
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
351
376
|
none: false
|
|
352
377
|
requirements:
|
|
@@ -355,7 +380,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
355
380
|
version: '0'
|
|
356
381
|
segments:
|
|
357
382
|
- 0
|
|
358
|
-
hash:
|
|
383
|
+
hash: -2263526946458307315
|
|
359
384
|
requirements: []
|
|
360
385
|
rubyforge_project:
|
|
361
386
|
rubygems_version: 1.8.25
|
|
@@ -416,6 +441,9 @@ test_files:
|
|
|
416
441
|
- spec/dummy/public/500.html
|
|
417
442
|
- spec/dummy/public/favicon.ico
|
|
418
443
|
- spec/dummy/script/rails
|
|
444
|
+
- spec/features/login_spec.rb
|
|
445
|
+
- spec/features/logout_spec.rb
|
|
446
|
+
- spec/features/session_overview_spec.rb
|
|
419
447
|
- spec/spec_helper.rb
|
|
420
448
|
- spec/support/.gitkeep
|
|
421
|
-
- spec/support/
|
|
449
|
+
- spec/support/features_helper.rb
|
metadata.gz.sig
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
��
|
|
2
|
-
|
|
1
|
+
:z�s��_[y-�k��Q�z9V��4���!/��C�/X�
|
|
2
|
+
��D'22:
|
|
3
|
+
�#�k�N�j���>*y�@ͨN?{�
|
data/.rvmrc
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
|
4
|
-
# development environment upon cd'ing into the directory
|
|
5
|
-
|
|
6
|
-
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
|
|
7
|
-
# Only full ruby name is supported here, for short names use:
|
|
8
|
-
# echo "rvm use 1.9.3" > .rvmrc
|
|
9
|
-
environment_id="ruby-1.9.3-p194@casino"
|
|
10
|
-
|
|
11
|
-
# Uncomment the following lines if you want to verify rvm version per project
|
|
12
|
-
# rvmrc_rvm_version="1.15.8 (stable)" # 1.10.1 seams as a safe start
|
|
13
|
-
# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
|
|
14
|
-
# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
|
|
15
|
-
# return 1
|
|
16
|
-
# }
|
|
17
|
-
|
|
18
|
-
# First we attempt to load the desired environment directly from the environment
|
|
19
|
-
# file. This is very fast and efficient compared to running through the entire
|
|
20
|
-
# CLI and selector. If you want feedback on which environment was used then
|
|
21
|
-
# insert the word 'use' after --create as this triggers verbose mode.
|
|
22
|
-
if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
|
|
23
|
-
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
|
24
|
-
then
|
|
25
|
-
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
|
26
|
-
[[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
|
|
27
|
-
\. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
|
|
28
|
-
else
|
|
29
|
-
# If the environment file has not yet been created, use the RVM CLI to select.
|
|
30
|
-
rvm --create "$environment_id" || {
|
|
31
|
-
echo "Failed to create RVM environment '${environment_id}'."
|
|
32
|
-
return 1
|
|
33
|
-
}
|
|
34
|
-
fi
|
|
35
|
-
|
|
36
|
-
# If you use bundler, this might be useful to you:
|
|
37
|
-
# if [[ -s Gemfile ]] && {
|
|
38
|
-
# ! builtin command -v bundle >/dev/null ||
|
|
39
|
-
# builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
|
|
40
|
-
# }
|
|
41
|
-
# then
|
|
42
|
-
# printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
|
|
43
|
-
# gem install bundler
|
|
44
|
-
# fi
|
|
45
|
-
# if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
|
|
46
|
-
# then
|
|
47
|
-
# bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
|
|
48
|
-
# fi
|
data/spec/support/sign_in.rb
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
def test_sign_in(options = {})
|
|
2
|
-
request.env['HTTP_USER_AGENT'] = options[:user_agent] || 'TestBrowser 1.2'
|
|
3
|
-
ticket = TicketGrantingTicket.create!({
|
|
4
|
-
ticket: controller.random_ticket_string('TGC'),
|
|
5
|
-
username: options[:username] || 'user1',
|
|
6
|
-
extra_attributes: options[:extra_attributes],
|
|
7
|
-
user_agent: request.env['HTTP_USER_AGENT']
|
|
8
|
-
})
|
|
9
|
-
request.cookies[:tgt] = ticket.ticket
|
|
10
|
-
return ticket
|
|
11
|
-
end
|