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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f3604df3a9d0a7a058d4048f5dfa6722255c360f
4
- data.tar.gz: 9593f0a09970b98531cbb767e65940011b0a1381
3
+ metadata.gz: c927b5d0e915a7f853269c01359bbce8adbe20dc
4
+ data.tar.gz: a32ae90fe4019746feafdf7fdc6aed68d0627a9e
5
5
  SHA512:
6
- metadata.gz: 2d3b3d021c0678cdc73678503c0dff16e96d99102a0a2d1357fc4f53ccf6e80401256ec7345b5d2ed67b3bd1a14cb0fe8b657e3c4290be6fd73e1f3735f711ab
7
- data.tar.gz: 9664aadd09b7721f543605b3cd08d629a54d9e424100efa78e4182159270b437393e85a7f1cc9e56ec8b8d0ecebf374e9bbf72578feb2464da2f75a694a1ab1c
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
- qr = RQRCode::QRCode.new(otp_auth_url(two_factor_authenticator), size: 5, level: :l)
10
- qr.to_img.resize(250,250).to_data_url
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
@@ -1,3 +1,5 @@
1
+ require 'casino/authenticator'
2
+
1
3
  module CASino::AuthenticationProcessor
2
4
  extend ActiveSupport::Concern
3
5
 
@@ -1,3 +1,3 @@
1
1
  module CASino
2
- VERSION = '4.0.0'
2
+ VERSION = '4.0.1'
3
3
  end
@@ -35,7 +35,7 @@ production:
35
35
  <<: *defaults
36
36
  authenticators:
37
37
  my_company_ldap:
38
- authenticator: "ldap"
38
+ authenticator: "LDAP"
39
39
  options:
40
40
  host: "localhost"
41
41
  port: 12445
@@ -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.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-15 00:00:00.000000000 Z
13
+ date: 2015-05-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: capybara