The forge keeps no accounts of its own. People sign in through their organization’s OpenID Connect identity provider; the forge checks the ID token the provider gives them and starts an agent of theirs that af then acts as. This page connects a provider to the operator’s organization. Another organization’s provider is named when it is created, with af create-organization (Organizations and repositories).
What the forge checks
The forge checks each ID token as OpenID Connect Core §3.1.3.7 says, as coreos/go-oidc does:
- Discovery. It reads
<issuer>/.well-known/openid-configuration, whoseissuermust be the one you give, character for character. - Keys. It reads the issuer’s
jwks_uri, and reads it again, once, when a token is signed by a key it has not seen, as providers rotate keys. - Algorithms. It takes only the asymmetric ones the issuer lists: RSA, RSA-PSS, ECDSA P-256 and P-384, and Ed25519. Never
none, never a shared secret. - Claims.
issis the issuer,audholds the forge’s client ID, andexphas not passed. Annbfmay be at most five minutes ahead, for clock skew. - The tenant. An issuer many organizations share must carry your tenant’s claim with your value, exactly.
- A second factor.
amr(RFC 8176) must hold one of the methods you take as a second factor.
Register the forge with your provider
Register one application for the forge. af auth signs people in from a terminal with the OAuth 2.0 device authorization grant (RFC 8628), so the application must allow it:
| Provider | Application to register | Issuer | Tenant claim |
|---|---|---|---|
| Google Workspace | An OAuth client of type TVs and Limited Input devices | https://accounts.google.com |
hd, your domain |
| Microsoft Entra ID | An app registration with Allow public client flows turned on | https://login.microsoftonline.com/<tenant id>/v2.0 |
tid, your tenant ID |
| Okta | An app integration of type Native Application, with the Device Authorization grant | your Okta org or authorization server URL | none: the issuer is yours alone |
| Any other | A client that may use the device authorization grant | its issuer URL, exactly as its tokens’ iss |
the claim that names your tenant, if the issuer is shared |
Ask for the openid, profile and email scopes. Note the client ID, and the client secret if the provider gives one to such clients, as Google does.
Start the forge with it
Give the issuer, the client ID and, for a shared issuer, the tenant claim as claim=value:
$ af-server --data-dir /var/lib/af-server \
> --oidc-issuer https://accounts.google.com \
> --oidc-client-id <CLIENT_ID> \
> --oidc-tenant hd=example.com \
> --first-administrator ada@example.com \
> ...A token whose tenant claim is missing or names another tenant is refused: a shared issuer signs in everyone it knows, and only the claim says they are yours. --first-administrator names, by verified email, the person who becomes the operator’s organization’s first administrator the first time they sign in. Every administrator after them is granted by a record.
Require a second factor
By default a token must say, in amr, that its person signed in with mfa. If your provider writes other values for its second factors, list those that count, separated by commas; any one is enough:
$ af-server ... --oidc-second-factor mfa,hwk,otpA token whose amr names only other methods, such as pwd alone, is refused.
Some providers write no amr in their ID tokens. Decode one of yours and look: its payload is the middle part of the token, base64url-encoded JSON. If it carries none, and your provider requires a second factor of everyone who signs in to the forge’s application, declare that:
$ af-server ... --oidc-second-factor-by-policyA token that says nothing of how its person signed in is then taken on your declaration, and each sign-in’s record notes that it relied on it, so a compliance report shows it. A token that does say, without a second factor, is still refused.
Sign in
A person signs in with af auth. It asks the forge for its issuer and client ID, starts the device flow with the provider, and prints where to go:
$ af auth
Open https://www.google.com/device and enter the code WXYZ-ABCD; it lasts 30 minutes.
signed in as 5c0d3e81a2b94f7c6d1e0a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4e3f2a1be19a for person 7f2b6a1c9d8e7f6a5b4c3d2e1f0a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4ec4d1, until 1767225600000 msThe page and the code are the provider’s own; Google’s are shown here. They open the page in any browser, on any device, sign in to the provider as they always do, and enter the code. af keeps the new agent’s key in its credential file, and every command after acts as that agent until it expires. A provider that needs a client secret for its device flow takes it with --client-secret, or AF_OIDC_CLIENT_SECRET.
Without a browser, give af auth an ID token obtained some other way, with --token or AF_TOKEN. The forge checks it the same way.
When a sign-in is refused
The answer says why, in the provider’s words where it can:
| Refusal | What to do |
|---|---|
a token of another tenant |
The person signed in with another tenant’s account, or --oidc-tenant names the wrong value. |
signed in by ["pwd"], without a second factor |
The person signed in with a password alone. Require a second factor at the provider, or list the methods your provider writes with --oidc-second-factor. |
the token does not say how its person signed in |
Your provider writes no amr. If it requires a second factor of everyone, declare it with --oidc-second-factor-by-policy. |
a token signed with HS256 |
The provider signed with a shared secret, which the forge never takes. Use an asymmetric signing key. |
Troubleshooting lists each refusal and its first step.
Next
- Organizations and repositories: each organization’s own provider, at its own host.
- Identity: people, the agents born from them, and what each sign-in records.