Using sculk.network as an authorizer
A closed route on sculkworm can use a sculk.network instance as its OpenID Connect provider so that only players who hold server.play on a specific server on that instance are admitted.
Provider requirement: Only use
allow.sculk_serverwith anoidcclient whoseissueris a sculk.network instance (where thesculk_serversuserinfo claim is authoritative and controlled solely by the provider, never editable by end users). Pointingallow.sculk_serverat a different OIDC provider that lets users populate custom profile claims namedsculk_serverswould allow any user on that provider to admit themselves.
Membership is re-checked live via /oauth/userinfo on every login, every ticket mint (POST /tickets), and every connect stream OPEN older than 60 seconds. Removing a player from the server, dropping their server.play permission, revoking their OIDC grant, or blocking their subject on sculk.network denies them on the next check. If the sculk.network instance is unreachable, the relay fails closed (503 idp_unavailable / RESET code 7).
1. Enable the OIDC provider on sculk.network#
On the sculk.network instance, enable the oidcProvider feature flag (enabled by default on dev and nightly builds; forced on stable builds with SCULK_FEATURES=oidcProvider) and list at least one administrator user ID in SCULK_OIDC_ADMINS (comma-separated):
SCULK_FEATURES=oidcProvider
SCULK_OIDC_ADMINS=<your-sculk-user-id>Sign in on sculk.network and confirm GET /api/me returns your id and GET /.well-known/openid-configuration returns 200 OK.
2. Register the relay as an OIDC client#
Call POST /api/oidc/clients with a session belonging to a user in SCULK_OIDC_ADMINS. Register ${SCULKWORM_PUBLIC_URL}/login/callback as the redirect URI (use firstParty: true if you want players to skip the consent prompt). Only add loopback redirect URIs (such as http://127.0.0.1/callback with native: true) if a native client talks to sculk.network directly — sculkworm-connect talks to the relay, and the relay is the OIDC client.
curl -sS -X POST https://sculk.example/api/oidc/clients \
-H "Cookie: sculk_session=$ADMIN_SESSION" \
-H "Content-Type: application/json" \
-d '{
"name": "sculkworm relay",
"redirectUris": ["https://relay.example/login/callback"],
"firstParty": true
}'Save client.clientId and clientSecret from the 201 Created response (clientSecret is returned once and never shown again).
3. Add the client to the relay secrets file#
Add an oidc entry to SCULKWORM_SECRETS_FILE (mode 0600 or 0400) pointing issuer at the sculk.network base URL (SCULK_BASE_URL):
{
"login_keys": {
"1": "QEFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaW1xdXl8"
},
"clients": {
"sculk-main": {
"tenant": "sculk",
"kind": "oidc",
"issuer": "https://sculk.example",
"scopes": ["openid", "profile", "offline_access", "sculk:servers"],
"client_id": "vb3efdhxc2sbpqkmvbbd",
"client_secret_env": "SCULKWORM_SCULK_OIDC_SECRET"
}
}
}- Including
offline_accesslets the relay refresh expired 1-hour access tokens silently over the 30-day sealed login lifetime. - Even if you omit
sculk:serversfrom the client's defaultscopesor the route'sscopes, any route withallow: {"sculk_server": "<server id>"}addssculk:serversautomatically. - Reload the relay with
SIGHUP(or restart it) after editing the secrets file.
4. Create the closed route with allow.sculk_server#
Create or update the route through the relay admin API using the server's sculk.network ID (from GET /api/servers or POST /api/servers):
curl -sS -i -X PUT \
-H "Authorization: Bearer $SCULKWORM_TENANT_KEY" \
-H "Content-Type: application/json" \
-d '{
"mode": "closed",
"authorizer": {
"type": "oidc",
"client": "sculk-main",
"allow": {
"sculk_server": "6uabltcpud3qpiy5"
}
}
}' \
http://127.0.0.1:8080/v1/routes/friends.play.sculk.networkWhen saving the route, the relay fetches https://sculk.example/.well-known/openid-configuration, verifies that issuer matches verbatim and that token_endpoint and userinfo_endpoint share the issuer's origin, and stores the route.
Then mint an agent token (POST /v1/routes/friends.play.sculk.network/agent-token) and run sculkworm-agent next to the Minecraft server as described in Configuration.
5. What the player sees#
- Vanilla Minecraft client without connect: pinging
friends.play.sculk.networkshowsClosed server: join it with sculkworm-connectand trying to join disconnects with instructions to runsculkworm-connect play friends.play.sculk.network. - First login with
sculkworm-connect play friends.play.sculk.network:- Connect opens the player's browser (or falls back to the device code flow if no browser is available) and sends them to the relay, which redirects to
https://sculk.example/oauth/authorizerequestingopenid profile offline_access sculk:servers. - The player signs in to sculk.network (and approves consent once if
firstPartyisfalse). - sculk.network redirects back to
https://relay.example/login/callback. The relay exchanges the code, validates the ID token, calls/oauth/userinfo, and checks thatsculk_serverscontains an object withid == "6uabltcpud3qpiy5"andis_player == true. - Admitted player: the browser shows login complete, connect stores the sealed login (
swl_...) inlogins.json(0600), and the player joins127.0.0.1:25565in Minecraft. - Non-member or member without
server.play: the relay answers403 Forbidden("You are signed in as<name>, butfriends.play.sculk.networkdoes not admit this account.") and issues no login.
- Connect opens the player's browser (or falls back to the device code flow if no browser is available) and sends them to the relay, which redirects to
- Revocation:
- Player loses
server.playon6uabltcpud3qpiy5(removed from the server or moved to a role withoutserver.play):/oauth/userinfono longer includes that server withis_player: true, so the nextPOST /ticketsfails with403 not_admitted(and a new connect streamOPENpast the 60-second check window fails with streamRESETcode6). - OIDC grant revoked (
DELETE /api/oidc/grants/:grantId) or subject blocked (POST /api/oidc/subjects/:userId/block): sculk.network rejects/oauth/userinfowith401and rejects the subsequent token refresh withinvalid_grant, so the nextPOST /ticketsfails with401 login_expired(and a new connect streamOPENpast the 60-second check window fails with streamRESETcode6).
- Player loses