sinatra-portier 2.0.1 → 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 +10 -2
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31afe71da2eac370eaa964127e62202abf4917c535e7309d317e8e089476a834
4
- data.tar.gz: b9bbcb6d954ba8e0653bf277d52df97333b25ac26ea5e5e64608b70067c2b97e
3
+ metadata.gz: 642765d420d438014584936cf81a6b0d837e8d0121063a20103360a042cdbc7b
4
+ data.tar.gz: 917725a06011719d6e6cf490772222d939d3a050c80a433e9de52adee903f669
5
5
  SHA512:
6
- metadata.gz: 30d0daa34b639d24fb2b0cc6dc71bf693bd6a702ddab6d811e8742116edd13e6470f3c2814c84b41dda9515cb0459224a9268b9bc920a84bfee42c1b5d5c0918
7
- data.tar.gz: a90b89b5e2263fe61507ea7f055962218d5f24821ac7b1af96caa8e2f504cf0fddb19720bc0104584531670362d37ec07ce469e39aad733e988df1d21bf5c8fd
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://login.persona.org/about). 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,11 +19,19 @@ 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(:Memory, expires: 600) # 10 minutes
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.
29
+ require 'dalli'
30
+ Cachy.cache_store = Moneta.new(:Memcached, expires: 600)
31
+ rescue LoadError
32
+ Cachy.cache_store = Moneta.new(:Memory, expires: 600) # 10 minutes
26
33
  # We need to set a global :expires here because of https://github.com/grosser/cachy/issues/7
34
+ end
27
35
 
28
36
  def self.registered(app)
29
37
  app.helpers BrowserID::Helpers
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.0.1
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: 2023-11-22 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.4.10
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