iorwerth-hub 0.3.0 → 0.4.0
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 +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +16 -4
- data/lib/iorwerth/hub/omniauth.rb +7 -4
- data/lib/iorwerth/hub/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ccb7cd07fb35bb31f30c9e1cf6745d85af73e2191f24afcbe6fd31a4a06acea4
|
|
4
|
+
data.tar.gz: 1251c0a59f7f236a19fabd563dc5ff25f2634a13c51df04bffd99bb5c0fcf00b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c8b17b28b437e5e126fa3c37af38381fc735eff5a60446cdbd1e37da4a92f08ca5af8f6f8439e6a424acf53e33705fc4aeb7c784e26a71fa7c2144ca1bb29e21
|
|
7
|
+
data.tar.gz: 12fbc699b292ba772bcbb32eddca0c7c9e690758f2a60e3c99cce42600d4a90a569f9562363d69afbf726d596cf9c987280327e9d3bda2620e507b6a927d4b58
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
- Sign-in strategy forwards `organization` as an authorization parameter, so a product
|
|
6
|
+
that signs up organizations passes the name on its "Start free trial" link
|
|
7
|
+
(`/auth/hub?prompt=create&plan=…&organization=…`). The Hub creates that organization
|
|
8
|
+
and no longer renders a field of its own for it (platform ADR-0014).
|
|
9
|
+
|
|
3
10
|
## 0.3.0
|
|
4
11
|
|
|
5
12
|
- `Iorwerth::Hub.end_session`: RP-initiated logout. Builds the request to the Hub's
|
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Connects a Ruby product to the Iorwerth Customer Hub. It provides four pieces:
|
|
4
4
|
|
|
5
|
-
- **Sign-in:** the
|
|
5
|
+
- **Sign-in:** the OmniAuth strategy, mounted as `:hub`. OpenID Connect, code flow with PKCE.
|
|
6
6
|
- **API client:** `Iorwerth::Hub::Client`, one method per `/api/v1` operation.
|
|
7
7
|
- **Entitlement checks:** `Iorwerth::Hub.entitled?`, cached, and still answering while the Hub is down.
|
|
8
8
|
- **Webhooks:** `Iorwerth::Hub::Webhook::Receiver`, a Rack endpoint that verifies each signature.
|
|
@@ -60,13 +60,20 @@ end
|
|
|
60
60
|
require "iorwerth/hub/omniauth"
|
|
61
61
|
|
|
62
62
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
|
63
|
-
provider :iorwerth_hub, redirect_uri: "https://podium.app/auth/
|
|
63
|
+
provider :iorwerth_hub, name: :hub, redirect_uri: "https://podium.app/auth/hub/callback"
|
|
64
64
|
end
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
`name: :hub` mounts the strategy at `/auth/hub`, so the callback is `/auth/hub/callback`. Register
|
|
68
|
+
that exact URL as the product's redirect URI with the Hub.
|
|
69
|
+
|
|
70
|
+
- **Signing in:** send people to `/auth/hub`. The callback receives the usual OmniAuth hash.
|
|
71
|
+
- **Starting a trial:** send people to `/auth/hub?prompt=create&plan=<plan key>`. The Hub
|
|
69
72
|
shows its signup page and records the requested plan.
|
|
73
|
+
- **Naming the organization:** if your customers are organizations (leagues, teams,
|
|
74
|
+
companies), collect the name in your own signup step and add `&organization=<name>` to
|
|
75
|
+
that trial link. The Hub creates that organization and attaches the plan to it; it never
|
|
76
|
+
asks for the name itself. Leave it off for individual customers.
|
|
70
77
|
|
|
71
78
|
The callback's `uid` is the Hub's `usr_` id. `info` holds the person's name and email.
|
|
72
79
|
`Iorwerth::Hub.organizations(auth)` returns the organizations they belong to, as this
|
|
@@ -93,6 +100,11 @@ session first, then send the browser to the Hub's end-session endpoint. POST it
|
|
|
93
100
|
token stays out of URLs; the Hub returns to `post_logout_redirect_uri` with `state`
|
|
94
101
|
unchanged, which you can use to pick where to land.
|
|
95
102
|
|
|
103
|
+
The POST is cross-site, so the browser does not send the Hub's session cookie with it. The
|
|
104
|
+
Hub handles that for you: it bounces the browser through a same-site redirect of its own that
|
|
105
|
+
does carry the cookie, then on to `post_logout_redirect_uri`. Your side is unchanged — submit
|
|
106
|
+
the form and let the browser follow the redirects.
|
|
107
|
+
|
|
96
108
|
```ruby
|
|
97
109
|
# config/initializers/omniauth.rb — register the return URL with the Hub, per product:
|
|
98
110
|
# post_logout_redirect_uris = https://podium.app/auth/hub/signed_out
|
|
@@ -11,11 +11,14 @@ module OmniAuth
|
|
|
11
11
|
# # config/initializers/omniauth.rb
|
|
12
12
|
# require "iorwerth/hub/omniauth"
|
|
13
13
|
# Rails.application.config.middleware.use OmniAuth::Builder do
|
|
14
|
-
# provider :iorwerth_hub, redirect_uri: "https://podium.app/auth/
|
|
14
|
+
# provider :iorwerth_hub, name: :hub, redirect_uri: "https://podium.app/auth/hub/callback"
|
|
15
15
|
# end
|
|
16
16
|
#
|
|
17
|
-
# Link to /auth/
|
|
18
|
-
# for "Start free trial": the Hub shows signup and
|
|
17
|
+
# `name: :hub` mounts it at /auth/hub. Link to /auth/hub to sign in, or
|
|
18
|
+
# /auth/hub?prompt=create&plan=<key> for "Start free trial": the Hub shows signup and
|
|
19
|
+
# records the plan. When your customers are organizations, collect the organization's
|
|
20
|
+
# name in your own signup wizard and pass it as &organization=<name>; the Hub creates
|
|
21
|
+
# that organization and never shows a field of its own for it. The auth hash's
|
|
19
22
|
# extra.raw_info carries the `organizations` claim (Iorwerth::Hub.organizations(auth)).
|
|
20
23
|
class IorwerthHub < OpenIDConnect
|
|
21
24
|
option :name, "iorwerth_hub"
|
|
@@ -23,7 +26,7 @@ module OmniAuth
|
|
|
23
26
|
option :pkce, true
|
|
24
27
|
option :response_type, "code"
|
|
25
28
|
option :scope, %i[openid email profile]
|
|
26
|
-
option :allow_authorize_params, %i[plan]
|
|
29
|
+
option :allow_authorize_params, %i[plan organization]
|
|
27
30
|
|
|
28
31
|
def initialize(app, *args, &block)
|
|
29
32
|
super
|
data/lib/iorwerth/hub/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: iorwerth-hub
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Iorwerth Technologies
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Sign-in through the Hub (OmniAuth), its /api/v1 client, cached entitlement
|
|
14
14
|
checks, and a Rack endpoint that verifies the Hub's webhooks.
|