casino 4.0.0 → 4.0.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.
- checksums.yaml +4 -4
- data/app/helpers/casino/two_factor_authenticators_helper.rb +15 -2
- data/app/processors/casino/authentication_processor.rb +2 -0
- data/lib/casino/version.rb +1 -1
- data/lib/generators/casino/install/templates/cas.yml +1 -1
- data/spec/controllers/two_factor_authenticators_controller_spec.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c927b5d0e915a7f853269c01359bbce8adbe20dc
|
4
|
+
data.tar.gz: a32ae90fe4019746feafdf7fdc6aed68d0627a9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d276f8dfa53f08edd9d16ca3fa5d1f338f4f2fc1504e80f25e0c09670c5dfdc3e0f1e9b92566fd506dbb9536a9a4561c5129285f04e594237c2e264791fdf08c
|
7
|
+
data.tar.gz: 089bcbf1982f01a85d7f7c0ad12aa0b7fc327b65e8c701e7906eb591790c4b802b05cc5d03ae7bd84db287c56d735c86c7728eec29a3de290ac232796668c1b4
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'rqrcode'
|
1
2
|
require 'rqrcode_png'
|
2
3
|
|
3
4
|
module CASino::TwoFactorAuthenticatorsHelper
|
@@ -6,7 +7,19 @@ module CASino::TwoFactorAuthenticatorsHelper
|
|
6
7
|
end
|
7
8
|
|
8
9
|
def otp_qr_code_data_url(two_factor_authenticator)
|
9
|
-
|
10
|
-
|
10
|
+
auth_url = otp_auth_url(two_factor_authenticator)
|
11
|
+
size = otp_qr_code_suggested_size(auth_url)
|
12
|
+
qr = RQRCode::QRCode.new(auth_url, size: size, level: :l)
|
13
|
+
qr.to_img.resize(250, 250).to_data_url
|
14
|
+
end
|
15
|
+
|
16
|
+
def otp_qr_code_suggested_size(data)
|
17
|
+
data_bits = data.length * 8
|
18
|
+
(3..40).each do |size|
|
19
|
+
metadata_bits = 4 + RQRCode::QRUtil.get_length_in_bits(RQRCode::QRMODE[:mode_8bit_byte], size)
|
20
|
+
total_data_bits = metadata_bits + data_bits
|
21
|
+
max_data_bits = RQRCode::QRCode.count_max_data_bits(RQRCode::QRRSBlock.get_rs_blocks(size, 1))
|
22
|
+
return size if total_data_bits < max_data_bits
|
23
|
+
end
|
11
24
|
end
|
12
25
|
end
|
data/lib/casino/version.rb
CHANGED
@@ -35,6 +35,19 @@ describe CASino::TwoFactorAuthenticatorsController do
|
|
35
35
|
get :new, request_options
|
36
36
|
response.should render_template(:new)
|
37
37
|
end
|
38
|
+
|
39
|
+
context 'with a really long service name' do
|
40
|
+
before(:each) do
|
41
|
+
CASino.config.frontend[:sso_name] = 'Na' * 200
|
42
|
+
end
|
43
|
+
|
44
|
+
render_views
|
45
|
+
|
46
|
+
it 'renders the new template' do
|
47
|
+
get :new, request_options
|
48
|
+
response.should render_template(:new)
|
49
|
+
end
|
50
|
+
end
|
38
51
|
end
|
39
52
|
|
40
53
|
context 'without a ticket-granting ticket' do
|
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: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nils Caspar
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-05-
|
13
|
+
date: 2015-05-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: capybara
|