sinatra-portier 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -3
  3. data/lib/sinatra/browserid.rb +5 -5
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5775c72ef60b996019c367445bd97aa6a4dd708586e1b16017a211bd5d8f26fa
4
- data.tar.gz: 0432d790f5786785e7cc27747183530e6fd3d175953124ecc55c0624d3c92441
3
+ metadata.gz: 642765d420d438014584936cf81a6b0d837e8d0121063a20103360a042cdbc7b
4
+ data.tar.gz: 917725a06011719d6e6cf490772222d939d3a050c80a433e9de52adee903f669
5
5
  SHA512:
6
- metadata.gz: 1de7ef55a194edae5ed32618be1527e5b9873b6f5a80406e167f4883c07757c2284b3eb86b187254241f305ef7642ebfd63e3fc8691baf139b15f8ffaad589c1
7
- data.tar.gz: ebbb833c8dc072e230edbee513c29736165d93301dde85d4714bd0e6f9b7405208ead1220a45782a22e7dc8f7a7fd304b745ccda983428c26d2d5bdc837b4cf1
6
+ metadata.gz: 35d28839424d126f05eda54d752357d290e4bbcba7aa7f45de5bd9464f2756abe65e55e540851e1e71f7afd2693e9a003c87a6934b9c167df0e455bf9b098f1f
7
+ data.tar.gz: b549f301831e584ab7ff45e4afe85547d75c2de6e287a9922b080fa0d20e0e1acee83146d45188cfca186c6fe4a99df55433af987910aeac6e133094b85124ca
data/README.md CHANGED
@@ -1,4 +1,6 @@
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.
1
+ Sinatra plugin that allows authentication against portier, the successor for
2
+ [Persona](https://github.com/mozilla/persona). Like Persona, this lets you verify the email
3
+ identity of a user.
2
4
 
3
5
  To be a drop-in replacement, the code keeps using the browserid namespace.
4
6
 
@@ -6,7 +8,8 @@ To be a drop-in replacement, the code keeps using the browserid namespace.
6
8
 
7
9
  To learn more, [read about portier](https://portier.github.io/).
8
10
 
9
- Note that logins are not done from within a form on your site -- you provide a login form, and that will start up the login flow and redirect back to your main page.
11
+ Note that logins are not done from within a form on your site -- you provide a login form, and that
12
+ will start up the login flow and redirect back to your main page.
10
13
 
11
14
  ## How to get started
12
15
 
@@ -66,6 +69,21 @@ Available sinatra settings:
66
69
  * <tt>:browserid_url</tt>: If you're using an alternate auth provider
67
70
  other than https://broker.portier.io
68
71
  * <tt>:browserid_login_url</tt>: URL users get redirected to when the
69
- <tt>authorize!(redirect: nil)</tt> helper is called and a user is not logged in. `redirect` is an optional parameter to set the redirect target on the function call instead.
72
+ <tt>authorize!(redirect: nil)</tt> helper is called and a user is not logged in. `redirect` is an
73
+ optional parameter to set the redirect target on the function call instead.
70
74
  * <tt>:browserid_button_class</tt>: Css class of the login button
71
75
  * <tt>:browserid_button_text</tt>: Text of the login button
76
+
77
+ ## Multiprocess environment
78
+
79
+ To use this gem with a multiprocess app server (like when puma got started with `-w n` and n > 1),
80
+ you can use memcached. Install the `dalli` gem with a working memcached server.
81
+
82
+ Background: Originally, this gem used the session to store a nonce whenever a user was sent off to
83
+ the broker. However, in some server or browser configurations that session was reset when the user
84
+ came back (see https://github.com/sinatra/sinatra/issues/1742). As a workaround a local cache is
85
+ used that was initially only stored in memory - but this wasn't shared over multiple processes in
86
+ at least one test environment. The memcached server is a solution for that, as its content does get
87
+ shared over multiple processes.
88
+
89
+ To be extended in future iterations.
@@ -19,18 +19,18 @@ require 'moneta'
19
19
  module Sinatra
20
20
  module BrowserID
21
21
 
22
- # Init an in-memory cache via the cachy gem. We use this
22
+ # Init an 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(settings.browserid_cache_store == :memcached ? :Memcached : :Memory, expires: 600) # 10 minutes
26
25
  begin
26
+ # To avoid issues when the outer server is run in multiprocess mode (like puma -w), we
27
+ # offer the option here to use a cache backend that will remain consistent over
28
+ # processes. Currently dalli for memcached, can be expanded.
27
29
  require 'dalli'
28
30
  Cachy.cache_store = Moneta.new(:Memcached, expires: 600)
29
- p 'dalli'
30
- rescue
31
+ rescue LoadError
31
32
  Cachy.cache_store = Moneta.new(:Memory, expires: 600) # 10 minutes
32
33
  # We need to set a global :expires here because of https://github.com/grosser/cachy/issues/7
33
- p 'memory'
34
34
  end
35
35
 
36
36
  def self.registered(app)
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: 2.1.0
4
+ version: 2.1.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: 2024-06-12 00:00:00.000000000 Z
12
+ date: 2024-08-08 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.5.9
145
+ rubygems_version: 3.5.11
146
146
  signing_key:
147
147
  specification_version: 4
148
148
  summary: Sinatra extension for user authentication with portier