sinatra-portier 1.5.0 → 1.5.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 +5 -5
- data/lib/sinatra/browserid.rb +11 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a3da293640f70f3b3f0b91c3bea64407d0682b997d901470f40f643164d1d92f
|
4
|
+
data.tar.gz: aefa14eeed1e114e25896608699ffdff4b1b89e846c8964d116be57a1b123b13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0b4ab607a02a0aecb07b728200b9341f786c022ce8621668a0f4738531d2dbf64f1a5d12e7a6c40e7919b2efb5fed479f0c9fc973afbf3029229a1ff0cf69a1
|
7
|
+
data.tar.gz: a600a75cf7247e8f31c4e0b3f5149df87396b749c4e72a970601fb5163b42d5304826b1a2cc82aac8387bd3f6c6b7a5cd17777dc3d2640f20a7ace47c0fb0411
|
data/lib/sinatra/browserid.rb
CHANGED
@@ -35,8 +35,16 @@ module Sinatra
|
|
35
35
|
# for that, fetch the public key from the LA instance (TODO: Do that beforehand for trusted instances, and generally cache the key)
|
36
36
|
public_key_jwks = ::JSON.parse(URI.parse(URI.escape(settings.browserid_url + '/keys.json')).read)
|
37
37
|
public_key = OpenSSL::PKey::RSA.new
|
38
|
-
public_key.
|
39
|
-
|
38
|
+
if public_key.respond_to? :set_key
|
39
|
+
# set n and d via the new set_key function, as direct access to n and e is blocked for some ruby and openssl versions.
|
40
|
+
# Note that we have no d, as this is a public key, which would be the third param
|
41
|
+
public_key.set_key( (OpenSSL::BN.new UrlSafeBase64.decode64(public_key_jwks["keys"][0]["n"]), 2),
|
42
|
+
(OpenSSL::BN.new UrlSafeBase64.decode64(public_key_jwks["keys"][0]["e"]), 2),
|
43
|
+
nil)
|
44
|
+
else
|
45
|
+
public_key.e = OpenSSL::BN.new UrlSafeBase64.decode64(public_key_jwks["keys"][0]["e"]), 2
|
46
|
+
public_key.n = OpenSSL::BN.new UrlSafeBase64.decode64(public_key_jwks["keys"][0]["n"]), 2
|
47
|
+
end
|
40
48
|
|
41
49
|
id_token = JWT.decode params[:id_token], public_key, true, { :algorithm => 'RS256' }
|
42
50
|
id_token = id_token[0]
|
@@ -46,7 +54,7 @@ module Sinatra
|
|
46
54
|
id_token["exp"] > Time.now.to_i &&
|
47
55
|
id_token["email_verified"] &&
|
48
56
|
id_token["nonce"] == session[:nonce])
|
49
|
-
session[:browserid_email] = id_token['
|
57
|
+
session[:browserid_email] = id_token['email']
|
50
58
|
session.delete(:nonce)
|
51
59
|
if session['redirect_url']
|
52
60
|
redirect session['redirect_url']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-portier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Fritchman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-12-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
version: '0'
|
103
103
|
requirements: []
|
104
104
|
rubyforge_project:
|
105
|
-
rubygems_version: 2.
|
105
|
+
rubygems_version: 2.7.8
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: Sinatra extension for user authentication with portier
|