Add four API-key access-review connectors
Add Pylon, OpenRouter, incident.io and Brevo as access-review connectors. All are API-key, single-tenant providers (Pattern 3): the key identifies one tenant, so there is no OAuth flow, picker UI, or bootstrap/helm configuration. - Pylon: Bearer token, GET /users; resolves each user's opaque role_id to a role name via GET /user-roles, with cursor pagination. - OpenRouter: Bearer management key, GET /api/v1/organization/members. The endpoint requires an organization account -- a personal key authenticates but returns 404 -- so the connection probe rejects 404 on top of 401/403 (doProbeRequest gained an opt-in extra-reject set) to surface a non-org key at connect time instead of mid-campaign. - incident.io: Bearer token, GET /v2/users. Its OAuth is outbound-only, so the API key is the inbound path; live base_role/custom_roles take precedence over the deprecated role enum. - Brevo: API key in the api-key header (Registration.APIKeyHeader), GET /v3/organization/invited/users. A live recording corrected the documented schema: is_owner is a JSON boolean (not a string) and an id field is present, so it is used as the stable ExternalID. The OpenRouter and Brevo cassettes are anonymized live recordings; Pylon and incident.io use hand-authored fixtures (no self-serve test tenant). The shared three-valued active-status mapping is consolidated into activeFromStatus in driver.go. Each adds the enum value, migration, GraphQL binding, provider Registration, a driver with a cassette-driven test, and a brand logo. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
35
pkg/accessreview/drivers/testdata/brevo.yaml
vendored
Normal file
35
pkg/accessreview/drivers/testdata/brevo.yaml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
# Recorded live against GET /v3/organization/invited/users (Brevo, api-key
|
||||
# header) on 2026-06-24, then anonymized: real ids, emails and locales are
|
||||
# replaced with synthetic values, while the {users} wrapper and member shape
|
||||
# are the verbatim live response — note is_owner is a JSON boolean (not the
|
||||
# string the docs/SDK show), an `id` is present, and feature_access carries
|
||||
# more keys than documented (transactional/phone/meetings/sequences) with a
|
||||
# "full" level. The api-key header is stripped on save.
|
||||
version: 2
|
||||
interactions:
|
||||
- id: 0
|
||||
request:
|
||||
proto: HTTP/1.1
|
||||
proto_major: 1
|
||||
proto_minor: 1
|
||||
content_length: 0
|
||||
host: api.brevo.com
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
url: https://api.brevo.com/v3/organization/invited/users
|
||||
method: GET
|
||||
response:
|
||||
proto: HTTP/2.0
|
||||
proto_major: 2
|
||||
proto_minor: 0
|
||||
content_length: -1
|
||||
uncompressed: true
|
||||
body: '{"users":[{"id":"000000000000000000000001","email":"owner@example.com","is_owner":true,"status":"active","feature_access":{"marketing":"owner","conversations":"owner","crm":"owner","transactional":"owner","phone":"owner"},"locale":"fr_FR"},{"id":"000000000000000000000002","email":"member@example.com","is_owner":false,"status":"active","feature_access":{"marketing":"none","conversations":"none","crm":"full","transactional":"full","phone":"none","meetings":"none","sequences":"none"},"locale":"fr_FR"},{"id":"000000000000000000000003","email":"viewer@example.com","is_owner":false,"status":"active","feature_access":{"marketing":"none","conversations":"none","crm":"full","transactional":"full","phone":"none","meetings":"none","sequences":"none"},"locale":"en_US"}]}'
|
||||
headers:
|
||||
Content-Type:
|
||||
- application/json
|
||||
status: 200 OK
|
||||
code: 200
|
||||
duration: 124ms
|
||||
71
pkg/accessreview/drivers/testdata/incidentio.yaml
vendored
Normal file
71
pkg/accessreview/drivers/testdata/incidentio.yaml
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
---
|
||||
# Hand-authored fixture for GET /v2/users against an incident.io
|
||||
# organization. The user object shape (id, name, email, role, base_role,
|
||||
# custom_roles) and the {users, pagination_meta} wrapper mirror the
|
||||
# documented response. Synthetic IDs/emails only.
|
||||
#
|
||||
# Two interactions deliberately split three users across two pages, where the
|
||||
# FIRST page returns fewer than page_size rows while still handing back a
|
||||
# non-empty `after` cursor. This regression-guards the pagination terminator:
|
||||
# the driver must follow the cursor (and return all three users) rather than
|
||||
# stop early on the short first page.
|
||||
version: 2
|
||||
interactions:
|
||||
- id: 0
|
||||
request:
|
||||
proto: HTTP/1.1
|
||||
proto_major: 1
|
||||
proto_minor: 1
|
||||
content_length: 0
|
||||
host: api.incident.io
|
||||
form:
|
||||
page_size:
|
||||
- "100"
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
url: https://api.incident.io/v2/users?page_size=100
|
||||
method: GET
|
||||
response:
|
||||
proto: HTTP/2.0
|
||||
proto_major: 2
|
||||
proto_minor: 0
|
||||
content_length: -1
|
||||
uncompressed: true
|
||||
body: '{"users":[{"id":"01ABCOWNER","name":"Lisa Curtis","email":"lisa@example.com","role":"viewer","base_role":{"id":"r1","name":"Owner","slug":"owner"},"custom_roles":[],"slack_user_id":"U01"},{"id":"01DEFRESP","name":"Sam Responder","email":"sam@example.com","role":"responder","base_role":{"id":"r2","name":"Responder","slug":"responder"},"custom_roles":[{"id":"c1","name":"On-call Lead","slug":"on-call-lead"}],"slack_user_id":"U02"}],"pagination_meta":{"after":"01PAGE2CURSOR0000000000000","page_size":100,"total_record_count":3}}'
|
||||
headers:
|
||||
Content-Type:
|
||||
- application/json
|
||||
status: 200 OK
|
||||
code: 200
|
||||
duration: 150ms
|
||||
- id: 1
|
||||
request:
|
||||
proto: HTTP/1.1
|
||||
proto_major: 1
|
||||
proto_minor: 1
|
||||
content_length: 0
|
||||
host: api.incident.io
|
||||
form:
|
||||
after:
|
||||
- "01PAGE2CURSOR0000000000000"
|
||||
page_size:
|
||||
- "100"
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
url: https://api.incident.io/v2/users?after=01PAGE2CURSOR0000000000000&page_size=100
|
||||
method: GET
|
||||
response:
|
||||
proto: HTTP/2.0
|
||||
proto_major: 2
|
||||
proto_minor: 0
|
||||
content_length: -1
|
||||
uncompressed: true
|
||||
body: '{"users":[{"id":"01GHIADMIN","name":"","email":"legacy-admin@example.com","role":"administrator","base_role":null,"custom_roles":[],"slack_user_id":""}],"pagination_meta":{"after":"","page_size":100,"total_record_count":3}}'
|
||||
headers:
|
||||
Content-Type:
|
||||
- application/json
|
||||
status: 200 OK
|
||||
code: 200
|
||||
duration: 140ms
|
||||
40
pkg/accessreview/drivers/testdata/openrouter.yaml
vendored
Normal file
40
pkg/accessreview/drivers/testdata/openrouter.yaml
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
# Recorded live against GET /api/v1/organization/members (with an OpenRouter
|
||||
# organization management key) on 2026-06-24, then anonymized: the real
|
||||
# member's id, name and email are replaced with synthetic values, while the
|
||||
# {data, total_count} wrapper and member shape (id, first_name, last_name,
|
||||
# email, role) are the verbatim live response shape. The Authorization header
|
||||
# is stripped on save. The org:member role and null-name fallbacks (absent
|
||||
# from this single-admin org) are covered by unit tests in the driver test.
|
||||
version: 2
|
||||
interactions:
|
||||
- id: 0
|
||||
request:
|
||||
proto: HTTP/1.1
|
||||
proto_major: 1
|
||||
proto_minor: 1
|
||||
content_length: 0
|
||||
host: openrouter.ai
|
||||
form:
|
||||
limit:
|
||||
- "100"
|
||||
offset:
|
||||
- "0"
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
url: https://openrouter.ai/api/v1/organization/members?limit=100&offset=0
|
||||
method: GET
|
||||
response:
|
||||
proto: HTTP/2.0
|
||||
proto_major: 2
|
||||
proto_minor: 0
|
||||
content_length: -1
|
||||
uncompressed: true
|
||||
body: '{"data":[{"id":"user_000000000000000000000admin","first_name":"Ada","last_name":"Admin","email":"ada.admin@example.com","role":"org:admin"}],"total_count":1}'
|
||||
headers:
|
||||
Content-Type:
|
||||
- application/json
|
||||
status: 200 OK
|
||||
code: 200
|
||||
duration: 454ms
|
||||
64
pkg/accessreview/drivers/testdata/pylon.yaml
vendored
Normal file
64
pkg/accessreview/drivers/testdata/pylon.yaml
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
---
|
||||
# Hand-authored fixture for the Pylon access-review driver. The driver first
|
||||
# resolves the organization's role catalogue (GET /user-roles), then lists
|
||||
# members (GET /users) and maps each user's opaque role_id to a role name.
|
||||
# The user/role object shapes mirror the documented OpenAPI schema. Synthetic
|
||||
# IDs/emails only.
|
||||
version: 2
|
||||
interactions:
|
||||
- id: 0
|
||||
request:
|
||||
proto: HTTP/1.1
|
||||
proto_major: 1
|
||||
proto_minor: 1
|
||||
content_length: 0
|
||||
host: api.usepylon.com
|
||||
form:
|
||||
limit:
|
||||
- "100"
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
url: https://api.usepylon.com/user-roles?limit=100
|
||||
method: GET
|
||||
response:
|
||||
proto: HTTP/2.0
|
||||
proto_major: 2
|
||||
proto_minor: 0
|
||||
content_length: -1
|
||||
uncompressed: true
|
||||
body: '{"data":[{"id":"role_admin","name":"Admin","slug":"admin"},{"id":"role_member","name":"Member","slug":"member"}],"pagination":{"cursor":"","has_next_page":false},"request_id":"req_roles_1"}'
|
||||
headers:
|
||||
Content-Type:
|
||||
- application/json
|
||||
status: 200 OK
|
||||
code: 200
|
||||
duration: 120ms
|
||||
- id: 1
|
||||
request:
|
||||
proto: HTTP/1.1
|
||||
proto_major: 1
|
||||
proto_minor: 1
|
||||
content_length: 0
|
||||
host: api.usepylon.com
|
||||
form:
|
||||
limit:
|
||||
- "100"
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
url: https://api.usepylon.com/users?limit=100
|
||||
method: GET
|
||||
response:
|
||||
proto: HTTP/2.0
|
||||
proto_major: 2
|
||||
proto_minor: 0
|
||||
content_length: -1
|
||||
uncompressed: true
|
||||
body: '{"data":[{"id":"user_1","email":"alice@example.com","name":"Alice Admin","role_id":"role_admin","status":"active"},{"id":"user_2","email":"bob@example.com","name":"Bob Member","role_id":"role_member","status":"active"},{"id":"user_3","email":"carol@example.com","name":"","role_id":"role_member","status":"deactivated"}],"pagination":{"cursor":"","has_next_page":false},"request_id":"req_users_1"}'
|
||||
headers:
|
||||
Content-Type:
|
||||
- application/json
|
||||
status: 200 OK
|
||||
code: 200
|
||||
duration: 140ms
|
||||
Reference in New Issue
Block a user