sinatra-portier 2.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/sinatra/browserid.rb +19 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5775c72ef60b996019c367445bd97aa6a4dd708586e1b16017a211bd5d8f26fa
|
4
|
+
data.tar.gz: 0432d790f5786785e7cc27747183530e6fd3d175953124ecc55c0624d3c92441
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1de7ef55a194edae5ed32618be1527e5b9873b6f5a80406e167f4883c07757c2284b3eb86b187254241f305ef7642ebfd63e3fc8691baf139b15f8ffaad589c1
|
7
|
+
data.tar.gz: ebbb833c8dc072e230edbee513c29736165d93301dde85d4714bd0e6f9b7405208ead1220a45782a22e7dc8f7a7fd304b745ccda983428c26d2d5bdc837b4cf1
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Sinatra plugin that allows authentication against portier, the successor for [Persona](https://
|
1
|
+
Sinatra plugin that allows authentication against portier, the successor for [Persona](https://github.com/mozilla/persona). Like Persona, this lets you verify the email identity of a user.
|
2
2
|
|
3
3
|
To be a drop-in replacement, the code keeps using the browserid namespace.
|
4
4
|
|
data/lib/sinatra/browserid.rb
CHANGED
@@ -22,8 +22,16 @@ module Sinatra
|
|
22
22
|
# Init an in-memory cache via the cachy gem. We use this
|
23
23
|
# instead of the session because of dropped sessions
|
24
24
|
# after redirects, see https://github.com/sinatra/sinatra/issues/1742.
|
25
|
-
Cachy.cache_store = Moneta.new(:Memory, expires: 600) # 10 minutes
|
25
|
+
#Cachy.cache_store = Moneta.new(settings.browserid_cache_store == :memcached ? :Memcached : :Memory, expires: 600) # 10 minutes
|
26
|
+
begin
|
27
|
+
require 'dalli'
|
28
|
+
Cachy.cache_store = Moneta.new(:Memcached, expires: 600)
|
29
|
+
p 'dalli'
|
30
|
+
rescue
|
31
|
+
Cachy.cache_store = Moneta.new(:Memory, expires: 600) # 10 minutes
|
26
32
|
# We need to set a global :expires here because of https://github.com/grosser/cachy/issues/7
|
33
|
+
p 'memory'
|
34
|
+
end
|
27
35
|
|
28
36
|
def self.registered(app)
|
29
37
|
app.helpers BrowserID::Helpers
|
@@ -46,11 +54,16 @@ module Sinatra
|
|
46
54
|
public_key_jwks = ::JSON.parse(URI.parse(public_key_jwks_uri).read)
|
47
55
|
public_key = OpenSSL::PKey::RSA.new
|
48
56
|
if public_key.respond_to? :set_key
|
49
|
-
#
|
50
|
-
#
|
51
|
-
|
52
|
-
|
53
|
-
|
57
|
+
# We initially set n and d via the then new set_key function, as direct access to n and e is blocked for some ruby and openssl versions.
|
58
|
+
# But with OpenSSL 3 this function throws an error, as keys are immutable now. Instead we have to generate the key directly with
|
59
|
+
# the right params, as in https://github.com/railslove/epics/issues/138
|
60
|
+
sequence = []
|
61
|
+
# modulus:
|
62
|
+
sequence << OpenSSL::ASN1::Integer.new(OpenSSL::BN.new(UrlSafeBase64.decode64(public_key_jwks["keys"][0]["n"]), 2))
|
63
|
+
# exponent:
|
64
|
+
sequence << OpenSSL::ASN1::Integer.new(OpenSSL::BN.new(UrlSafeBase64.decode64(public_key_jwks["keys"][0]["e"]), 2))
|
65
|
+
|
66
|
+
public_key = OpenSSL::PKey::RSA.new(OpenSSL::ASN1::Sequence(sequence).to_der)
|
54
67
|
else
|
55
68
|
public_key.e = OpenSSL::BN.new UrlSafeBase64.decode64(public_key_jwks["keys"][0]["e"]), 2
|
56
69
|
public_key.n = OpenSSL::BN.new UrlSafeBase64.decode64(public_key_jwks["keys"][0]["n"]), 2
|
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:
|
4
|
+
version: 2.1.0
|
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:
|
12
|
+
date: 2024-06-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
142
|
- !ruby/object:Gem::Version
|
143
143
|
version: '0'
|
144
144
|
requirements: []
|
145
|
-
rubygems_version: 3.
|
145
|
+
rubygems_version: 3.5.9
|
146
146
|
signing_key:
|
147
147
|
specification_version: 4
|
148
148
|
summary: Sinatra extension for user authentication with portier
|