Applies to: Version 1.4 and later
axesFlip REST Server acts as an OAuth 2.0 / OpenID Connect resource server. It never signs users in. Your client obtains an access token (a JWT) from your identity provider (IdP) and sends it with every request:
Authorization: Bearer <access-token>
Depending on the security mode, the server validates the token (signature, issuer, audience, expiry) and checks whether the caller has the application role required by the endpoint. How your IdP's claims map to roles is set entirely in flip.config.json. Onboarding a new IdP requires no code changes.
Security modes
| Mode | Token required | Role required | Use for |
|---|---|---|---|
Anonymous |
No | No | Trusted, isolated networks only. Authentication is disabled and every request passes. |
Authenticated |
Yes | No | Any valid token from your IdP is accepted ("logged in = allowed"). |
Authorized |
Yes | Yes | A valid token and the endpoint's required role. Recommended for production. |
If Security:Mode is not set, the server runs in Default mode. With Stage set to Demo, Default behaves like Anonymous, so local testing works without IdP setup. With Stage set to Production, the server refuses to start.
Warning: In Production, the server does not start without an explicit security mode. Stage defaults to Production. If Security:Mode is not set, the server stops at start-up with an AxesFlipException. This also affects upgrades: a flip.config.json from an earlier version that sets neither Stage nor Security:Mode no longer starts. Always set Security:Mode explicitly on any server reachable by others. Setting Anonymous explicitly is allowed but disables authentication completely. The shipped flip.config.json sets Stage to Demo for local testing; do not expose that configuration to untrusted networks.
Stage accepts Demo or Production (default). Set it at the root of flip.config.json (Stage), under Flip (Flip:Stage), or as the environment variable Flip__Stage. A root Stage takes precedence over Flip:Stage. Any other value stops the server at start-up. Stage controls only this security check; licensing still uses Environment.
Minimal configuration
All settings live in the Security section of flip.config.json. For all other settings, see the axesFlip REST Server configuration guide.
| Key | Required | Description |
|---|---|---|
Mode |
Yes (see warning above) |
Anonymous, Authenticated or Authorized. |
Authority |
Authenticated, Authorized
|
Base URL of your IdP (the OIDC issuer). The server loads the discovery document and signing keys from here. Must use HTTPS. |
Audience |
Authenticated, Authorized
|
Expected aud value of the access token, usually your API's identifier. Tokens issued for another audience are rejected. |
Issuer |
No | Expected iss value. If omitted, the server reads it from the IdP's discovery document. |
NameClaimType |
No | Claim used as the caller's name in logs and audit entries. Default: preferred_username. |
ClockSkew |
No | Tolerance for token expiry and not-before times, as a time span, e.g. 00:02:00. Default: 5 minutes. Only lower it if your servers' clocks are reliably synchronized. |
ClaimMappings |
Authorized |
Maps IdP claims to application roles. See Map IdP claims to roles below. |
Minimal example (Authenticated mode). Add it to your existing flip.config.json:
{
"Stage": "Production",
"Security": {
"Mode": "Authenticated",
"Authority": "https://keycloak.example.com/realms/flip",
"Audience": "flip-api"
}
}Roles and endpoint access
Roles are checked in Authorized mode only. In Authenticated mode, any valid token can call every protected endpoint. In Anonymous mode, every request passes.
| Role | Grants |
|---|---|
Designer |
Managing templates. |
Operator |
Running remediation. |
Administrator |
Everything. This super-role satisfies every endpoint's requirement. |
| Endpoint | Required role |
|---|---|
GET /v1/health/ping |
None (anonymous in every mode) |
POST /v1/health/selftest |
None (anonymous in every mode) |
GET /v1/templates |
Designer |
HEAD, GET, POST, PUT, DELETE /v1/templates/{templateId}
|
Designer |
GET /v1/templates/{templateId}/content |
Designer |
POST /v1/templates/{templateId}/enable and /disable
|
Designer |
POST /v1/remediation/remediate |
Operator |
Designer and Operator don't include each other: a Designer cannot remediate, and an Operator cannot manage templates. To allow both, assign both roles or Administrator. The self-test runs a real remediation; restrict access to it at network level if needed.
Map IdP claims to roles
Required in Authorized mode. Every IdP names and structures its role, group and scope claims differently. Each ClaimMappings entry describes one claim source. Create one entry per claim, not one per role.
| Field | Required | Description |
|---|---|---|
ClaimType |
Yes | The token claim to read, e.g. resource_access, realm_access, roles, groups or scope. |
ClaimPath |
No | Slash-separated path into a nested JSON claim, e.g. flip-api/roles. Omit it for flat claims. |
Delimiter |
No | Splits a delimited string claim, e.g. " " for scope. Omit it to use the whole string as one value. |
Roles |
Yes | Map of IdP value → application role. Matching is case-sensitive. |
-
ClaimPathmust point at the exact array you want. Nested objects are not searched, so one client's roles cannot leak into another's. - A missing claim or path grants nothing (fail closed).
- With several entries, the caller's roles are the union of all matches.
- Machine-to-machine clients (client-credentials flow) usually carry only scopes. Map a scope to a role to let them call the API, and decide deliberately which scopes stand in for which roles.
Claim shapes
| Shape | Claim in the token | Matching ClaimMappings entry |
|---|---|---|
| Nested JSON with path | "resource_access": { "flip-api": { "roles": ["designer"] } } |
{ "ClaimType": "resource_access", "ClaimPath": "flip-api/roles", "Roles": { "designer": "Designer" } } |
| Flat array | "roles": ["Flip.Admin"] |
{ "ClaimType": "roles", "Roles": { "Flip.Admin": "Administrator" } } |
| Delimited string | "scp": "flip.process openid" |
{ "ClaimType": "scp", "Delimiter": " ", "Roles": { "flip.process": "Operator" } } |
Identity provider quick reference
| IdP | ClaimType |
ClaimPath |
Delimiter |
|---|---|---|---|
| Keycloak – realm roles | realm_access |
roles |
– |
| Keycloak – client roles | resource_access |
<client-id>/roles |
– |
| Microsoft Entra ID – app roles | roles |
– | – |
| Microsoft Entra ID – scopes | scp |
– | " " |
| Okta – groups | groups |
– | – |
| Auth0 – roles (namespaced) | https://<your-namespace>/roles |
– | – |
| Amazon Cognito – groups | cognito:groups |
– | – |
| Generic OAuth 2.0 – scopes | scope |
– | " " |
Full example: Keycloak (client roles, realm roles and scopes)
{
"Stage": "Production",
"Security": {
"Mode": "Authorized",
"Authority": "https://keycloak.example.com/realms/flip",
"Audience": "flip-api",
"NameClaimType": "preferred_username",
"ClaimMappings": [
{
"ClaimType": "resource_access",
"ClaimPath": "flip-api/roles",
"Roles": {
"designer": "Designer",
"operator": "Operator",
"administrator": "Administrator"
}
},
{
"ClaimType": "realm_access",
"ClaimPath": "roles",
"Roles": { "flip-admin": "Administrator" }
},
{
"ClaimType": "scope",
"Delimiter": " ",
"Roles": { "flip.designer": "Designer" }
}
]
}
}For Keycloak, we recommend a dedicated client for the API audience (here flip-api) that is separate from the clients users log in with. This keeps ID tokens from carrying the API's audience.
401 and 403 responses
| Status | Meaning | Returned in |
|---|---|---|
401 Unauthorized |
The access token is missing, expired or invalid. The response includes a WWW-Authenticate: Bearer header. |
Authenticated, Authorized
|
403 Forbidden |
The token is valid, but the caller lacks the required role. | Authorized |
Swagger UI and OpenAPI
The Swagger UI (/swagger) and the OpenAPI document (/swagger/v1/swagger.json) are served only when Swagger.Enabled is true. They are not protected by the security mode. The OpenAPI document reflects the configured mode:
-
Anonymous: no security scheme. -
Authenticated: a Bearer JWT scheme and401responses. -
Authorized: additionally403responses and the required role of each operation, in the description and inx-required-roles.
To try protected endpoints in Swagger UI, click Authorize and paste the raw access token, without the Bearer prefix.
Check your setup with curl
Obtain an access token from your IdP and store it in the variable ACCESS_TOKEN. Then run:
# 1. Server reachable (never needs a token) curl -i https://[HOSTNAME]:29375/v1/health/ping # 2. Protected endpoint without a token curl -i https://[HOSTNAME]:29375/v1/templates # 3. Protected endpoint with your access token curl -i -H "Authorization: Bearer $ACCESS_TOKEN" https://[HOSTNAME]:29375/v1/templates
| Command | Expected in Authenticated
|
Expected in Authorized
|
|---|---|---|
| 1 | 200 |
200 |
| 2 | 401 |
401 |
| 3 | 200 |
200 if the token maps to Designer or Administrator, otherwise 403
|
In Windows PowerShell, use curl.exe instead of curl and $env:ACCESS_TOKEN instead of $ACCESS_TOKEN.
Troubleshooting
The server does not start: "Flip security is not configured for stage 'Production'".Security:Mode is not set and Stage is Production (also the default). Set Security:Mode to Anonymous, Authenticated or Authorized.
The server does not start: "Security:Authority is required…" or "Security:Audience is required…".Authenticated and Authorized mode need both Authority and Audience.
The server does not start: "Invalid Stage".Stage must be Demo or Production.
Login works, but the API returns 401.
The client probably sends the ID token instead of the access token; only the access token is meant for the API. Also check that the token's aud matches Audience and its iss matches Issuer or the IdP's discovery document.
Every request returns 403 in Authorized mode.
Usually a ClaimMappings mismatch: wrong ClaimType (e.g. scope instead of Entra's scp), wrong ClaimPath, or a value that doesn't exactly match a key in Roles (case-sensitive).
Some users lose their roles (Microsoft Entra ID).
When a user belongs to too many groups, Entra omits the groups claim and refers to Microsoft Graph instead (group overage). Use app roles instead of groups for authorization.