openapi: 3.1.0 info: title: Dexwize Identity Service version: 1.0.0 description: > Security token service (RFC 8693 token exchange), per-tenant OIDC federation, SCIM 2.0 provisioning and just-in-time operator access. Access tokens are ES256, 15 minutes, with claims sub, tid, pid, role, amr, jti and jit_grant. See ADR-0007. servers: - url: https://identity.dexwize.example security: - bearer: [] paths: /.well-known/openid-configuration: get: summary: OpenID discovery document security: [] responses: '200': description: Discovery document (issuer, jwks_uri, token_endpoint) content: application/json: schema: type: object /.well-known/jwks.json: get: summary: Public signing keys (EC P-256, ES256) security: [] responses: '200': description: JSON Web Key Set content: application/json: schema: type: object properties: keys: type: array items: type: object required: - kty - crv - kid - x - 'y' properties: kty: const: EC crv: const: P-256 use: const: sig alg: const: ES256 kid: type: string x: type: string 'y': type: string /v1/token: post: summary: > Exchange a customer IdP id_token for a Dexwize access token; or, for services (ADR-0023), obtain a service token with client_credentials (private_key_jwt or federated workload token as client_assertion) or exchange a platform service token addressed to identity-service for a tenant-scoped token. security: [] requestBody: required: true content: application/x-www-form-urlencoded: schema: oneOf: - title: User sign-in (id_token exchange) type: object required: [grant_type, subject_token, subject_token_type, tenant_id] properties: grant_type: { const: 'urn:ietf:params:oauth:grant-type:token-exchange' } subject_token: { type: string, maxLength: 16384 } subject_token_type: { const: 'urn:ietf:params:oauth:token-type:id_token' } tenant_id: { type: string, format: uuid, description: Dexwize extension; the tenant to sign in to } - title: Service token (client credentials) type: object required: [grant_type, client_assertion_type, client_assertion, audience] properties: grant_type: { const: client_credentials } client_id: { type: string, description: Required for federated clients } client_assertion_type: { const: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer' } client_assertion: { type: string } audience: { type: array, maxItems: 16, items: { type: string, description: Target service name } } - title: Tenant-scoped service token (exchange) type: object required: [grant_type, subject_token, subject_token_type, tenant_id, client_assertion_type, client_assertion, audience] properties: grant_type: { const: 'urn:ietf:params:oauth:grant-type:token-exchange' } subject_token: { type: string, description: Platform service token addressed to identity-service } subject_token_type: { const: 'urn:ietf:params:oauth:token-type:access_token' } tenant_id: { type: string, format: uuid } client_id: { type: string } client_assertion_type: { const: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer' } client_assertion: { type: string } audience: { type: array, maxItems: 16, items: { type: string } } - title: Delegated audience (a person narrows their own token, ADR-0033) description: > No client assertion and no tenant_id. The subject token must be a person's platform-audience Dexwize token; the result is bound to exactly one configured delegated audience (Sts:DelegatedAudiences, for example dexwize-assistant or the MCP resource), keeps the same claims and never outlives the subject token. Narrowed and service tokens are refused (invalid_grant); other audiences are invalid_target. type: object required: [grant_type, subject_token, subject_token_type] properties: grant_type: { const: 'urn:ietf:params:oauth:grant-type:token-exchange' } subject_token: { type: string, maxLength: 16384 } subject_token_type: { const: 'urn:ietf:params:oauth:token-type:access_token' } audience: { type: string, description: Exactly one of audience or resource } resource: { type: string, description: RFC 8707 resource indicator (the MCP resource) } responses: '401': description: invalid_client (service assertion missing, invalid, expired or replayed) content: application/json: schema: { type: object, required: [error], properties: { error: { const: invalid_client } } } '429': { description: Rate limited; see Retry-After } '200': description: Issued token content: application/json: schema: $ref: '#/components/schemas/TokenResponse' '400': description: > invalid_request, unsupported_grant_type or invalid_grant. Only error_description=mfa_required is ever returned; other failures carry no detail. content: application/json: schema: type: object required: - error properties: error: { enum: [invalid_request, unsupported_grant_type, invalid_grant, invalid_target, unauthorized_client] } error_description: { enum: [mfa_required] } /v1/federation: get: summary: The caller's tenant federation (TenantRead) responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/Federation' '404': description: Not configured put: summary: Set the caller's tenant federation (TenantManage) requestBody: required: true content: application/json: schema: type: object required: - issuer - audience - jwksUri properties: issuer: type: string format: uri description: https only audience: type: string maxLength: 200 jwksUri: type: string format: uri description: https, public DNS host only subjectClaim: enum: - sub - oid - email - preferred_username - upn default: sub responses: '200': description: Saved content: application/json: schema: $ref: '#/components/schemas/Federation' '400': description: Validation failed '403': description: Missing permission /v1/scim-token: post: summary: Issue (rotate) the tenant SCIM bearer token (UsersManage). Shown once; previous token stops working. responses: '200': description: New token content: application/json: schema: type: object properties: token: type: string issuedAt: type: string format: date-time /v1/role-mappings: get: summary: Group-to-role mappings (UsersManage) responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/RoleMappings' put: summary: Replace group-to-role mappings (UsersManage) requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/RoleMappings' responses: '200': description: Saved content: application/json: schema: $ref: '#/components/schemas/RoleMappings' '400': description: Invalid mapping or role not assignable in this tenant /v1/users: get: summary: "The organisation's people with their roles, who manages them and how they sign in (UsersManage)" description: > Always the caller's own tenant. managedBy "directory" means SCIM provisions the person and their roles are read-only in the portal. signIn "managed" means the tenant signs in through the identity provider Dexwize operates. responses: '200': description: OK content: application/json: schema: $ref: '#/components/schemas/PortalUserList' '403': description: Missing permission post: summary: Add a person to the organisation's directory (UsersManage; not from a JIT session) description: > In a managed sign-in tenant this also creates the person's sign-in account with a temporary password and a pre-enrolled authenticator, returned once in credentials and never stored by identity-service. An account that already exists for the email is linked (existingSignIn true) and keeps its credentials. requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateUserRequest' responses: '201': description: Created headers: Location: schema: type: string content: application/json: schema: $ref: '#/components/schemas/PortalUserResult' '400': description: Invalid email or display name, or a role not assignable in this organisation '403': description: Missing permission or a JIT session (title jit_session) '409': description: "email_in_use, user_inactive (reactivate instead; userId is set) or directory_required" content: application/problem+json: schema: $ref: '#/components/schemas/UserProblem' '502': description: The managed identity provider could not be reached (title sign_in_unavailable); nothing was created /v1/users/assignable-roles: get: summary: Role keys this organisation may grant and its administrator role (UsersManage) responses: '200': description: OK content: application/json: schema: type: object required: [roles, adminRole] properties: roles: type: array items: $ref: '#/components/schemas/PersonRole' adminRole: $ref: '#/components/schemas/PersonRole' /v1/users/{id}/roles: parameters: - $ref: '#/components/parameters/UserId' put: summary: Replace a portal-managed person's directly assigned roles (UsersManage; not from a JIT session) requestBody: required: true content: application/json: schema: type: object required: [roles] properties: roles: type: array minItems: 1 items: $ref: '#/components/schemas/PersonRole' responses: '200': description: Saved content: application/json: schema: $ref: '#/components/schemas/PortalUserResult' '400': description: No role or a role not assignable in this organisation '404': description: No such user in this organisation '409': description: "directory_managed, self_change (your own administrator role) or last_admin" content: application/problem+json: schema: $ref: '#/components/schemas/UserProblem' /v1/users/{id}/deactivate: parameters: - $ref: '#/components/parameters/UserId' post: summary: Deactivate a person; their managed sign-in account is disabled and its sessions end (UsersManage) responses: '200': description: Deactivated (idempotent) content: application/json: schema: $ref: '#/components/schemas/PortalUserResult' '404': description: No such user in this organisation '409': description: "self_change or last_admin" content: application/problem+json: schema: $ref: '#/components/schemas/UserProblem' /v1/users/{id}/reactivate: parameters: - $ref: '#/components/parameters/UserId' post: summary: Reactivate a person and enable their managed sign-in account (UsersManage) responses: '200': description: Active (idempotent) content: application/json: schema: $ref: '#/components/schemas/PortalUserResult' '404': description: No such user in this organisation /v1/users/{id}/reset-sign-in: parameters: - $ref: '#/components/parameters/UserId' post: summary: Issue a new temporary password and authenticator for a managed sign-in account, returned once (UsersManage) responses: '200': description: New one-time credentials content: application/json: schema: $ref: '#/components/schemas/PortalUserResult' '404': description: No such user in this organisation '409': description: "not_managed_sign_in, sign_in_not_owned, user_inactive, self_change or sign_in_shared" content: application/problem+json: schema: $ref: '#/components/schemas/UserProblem' '502': description: The managed identity provider could not be reached (title sign_in_unavailable) /v1/directories/{tenantId}/partner: put: summary: Mark a tenant as a partner home tenant (platform operator with MFA) parameters: - name: tenantId in: path required: true schema: type: string format: uuid requestBody: required: true content: application/json: schema: type: object properties: partnerId: type: - string - 'null' format: uuid responses: '200': description: Saved content: application/json: schema: type: object properties: tenantId: type: string format: uuid partnerId: type: - string - 'null' format: uuid '400': description: Platform tenant or empty id '403': description: Not a platform operator with MFA /v1/jit/grants: post: summary: Request JIT access to a customer tenant (platform operator with MFA) requestBody: required: true content: application/json: schema: type: object required: - tenantId - reason - durationMinutes properties: tenantId: type: string format: uuid reason: type: string minLength: 10 maxLength: 500 durationMinutes: type: integer minimum: 5 maximum: 240 responses: '201': description: Pending grant content: application/json: schema: $ref: '#/components/schemas/JitGrant' '400': description: Validation failed '403': description: Not a platform operator with MFA get: summary: List JIT grants for the operator console (platform operator with MFA, non-JIT session) operationId: listJitGrants parameters: - name: state in: query required: false schema: type: string enum: - pending - active - expired - name: tenantId in: query required: false schema: type: string format: uuid - name: days in: query required: false description: Requested within the last N days schema: type: integer minimum: 1 maximum: 365 default: 30 responses: '200': description: OK content: application/json: schema: type: array items: $ref: '#/components/schemas/JitGrant' '400': description: Unknown state '403': description: Not a platform operator session /v1/jit/grants/{id}/approve: post: summary: Approve a pending grant (a different platform operator, within 1 hour) parameters: - $ref: '#/components/parameters/GrantId' responses: '200': description: Approved content: application/json: schema: $ref: '#/components/schemas/JitGrant' '403': description: Not a platform operator with MFA '404': description: Unknown grant '409': description: Self-approval, not pending, or request expired /v1/jit/grants/{id}/token: post: summary: Exchange an approved grant for a tenant-scoped token (requester only, before expiry) parameters: - $ref: '#/components/parameters/GrantId' responses: '200': description: Token with tid=target tenant, role platform_operator and jit_grant claim content: application/json: schema: $ref: '#/components/schemas/TokenResponse' '403': description: Not approved, expired, or not the requester '404': description: Unknown grant /scim/v2/ServiceProviderConfig: get: summary: SCIM service provider configuration security: - scim: [] responses: '200': description: OK content: application/scim+json: schema: type: object /scim/v2/Users: get: summary: List users (filter userName eq / externalId eq; startIndex, count up to 200) security: - scim: [] parameters: - name: filter in: query schema: type: string - name: startIndex in: query schema: type: integer minimum: 1 - name: count in: query schema: type: integer minimum: 0 maximum: 200 responses: '200': $ref: '#/components/responses/ScimList' '400': $ref: '#/components/responses/ScimError' '401': $ref: '#/components/responses/ScimError' post: summary: Create user security: - scim: [] requestBody: $ref: '#/components/requestBodies/ScimResource' responses: '201': $ref: '#/components/responses/ScimResource' '400': $ref: '#/components/responses/ScimError' '409': $ref: '#/components/responses/ScimError' /scim/v2/Users/{id}: parameters: - $ref: '#/components/parameters/ScimId' get: summary: Get user security: - scim: [] responses: '200': $ref: '#/components/responses/ScimResource' '404': $ref: '#/components/responses/ScimError' put: summary: Replace user security: - scim: [] requestBody: $ref: '#/components/requestBodies/ScimResource' responses: '200': $ref: '#/components/responses/ScimResource' '400': $ref: '#/components/responses/ScimError' '404': $ref: '#/components/responses/ScimError' patch: summary: Patch user (PatchOp; active=false deactivates immediately) security: - scim: [] requestBody: $ref: '#/components/requestBodies/ScimResource' responses: '200': $ref: '#/components/responses/ScimResource' '400': $ref: '#/components/responses/ScimError' '404': $ref: '#/components/responses/ScimError' delete: summary: Deactivate user (users are never hard-deleted) security: - scim: [] responses: '204': description: Deactivated '404': $ref: '#/components/responses/ScimError' /scim/v2/Groups: get: summary: List groups (filter displayName eq / externalId eq) security: - scim: [] parameters: - name: filter in: query schema: type: string - name: startIndex in: query schema: type: integer minimum: 1 - name: count in: query schema: type: integer minimum: 0 maximum: 200 responses: '200': $ref: '#/components/responses/ScimList' '400': $ref: '#/components/responses/ScimError' post: summary: Create group (members must be users of the same tenant) security: - scim: [] requestBody: $ref: '#/components/requestBodies/ScimResource' responses: '201': $ref: '#/components/responses/ScimResource' '400': $ref: '#/components/responses/ScimError' '409': $ref: '#/components/responses/ScimError' /scim/v2/Groups/{id}: parameters: - $ref: '#/components/parameters/ScimId' get: summary: Get group security: - scim: [] responses: '200': $ref: '#/components/responses/ScimResource' '404': $ref: '#/components/responses/ScimError' put: summary: Replace group security: - scim: [] requestBody: $ref: '#/components/requestBodies/ScimResource' responses: '200': $ref: '#/components/responses/ScimResource' '404': $ref: '#/components/responses/ScimError' patch: summary: Patch group (add/remove/replace members, displayName) security: - scim: [] requestBody: $ref: '#/components/requestBodies/ScimResource' responses: '200': $ref: '#/components/responses/ScimResource' '400': $ref: '#/components/responses/ScimError' '404': $ref: '#/components/responses/ScimError' delete: summary: Delete group security: - scim: [] responses: '204': { description: Deleted } '404': { $ref: '#/components/responses/ScimError' } /v1/service-grants: get: summary: Services this tenant has allowed to act inside it (tenant admin) operationId: listServiceGrants responses: '200': description: OK content: application/json: schema: { type: array, items: { $ref: '#/components/schemas/ServiceGrant' } } /v1/service-grants/catalog: get: summary: Every service that can act for this tenant, what it may do there, and this tenant's consent (tenant admin) operationId: serviceConsentCatalog responses: '200': description: OK content: application/json: schema: { type: array, items: { $ref: '#/components/schemas/ServiceConsent' } } /v1/service-grants/{clientId}: parameters: - { name: clientId, in: path, required: true, schema: { type: string } } put: summary: Allow a registered service to obtain tenant-scoped tokens (for example scheduled reports) operationId: grantService requestBody: content: application/json: schema: { type: object, properties: { expiresAt: { type: [string, 'null'], format: date-time } } } responses: '200': description: Granted content: application/json: schema: { $ref: '#/components/schemas/ServiceGrant' } '400': { description: expiresAt in the past } '404': { description: 'Unknown service, or a service that never acts for tenants' } delete: summary: Revoke a service grant operationId: revokeServiceGrant responses: '204': { description: Revoked } '404': { description: No active grant } components: securitySchemes: bearer: type: http scheme: bearer bearerFormat: JWT description: Dexwize access token issued by this service scim: type: http scheme: bearer description: Per-tenant SCIM token (dxscim_...) from POST /v1/scim-token parameters: GrantId: name: id in: path required: true schema: type: string format: uuid ScimId: name: id in: path required: true schema: type: string UserId: name: id in: path required: true schema: type: string format: uuid requestBodies: ScimResource: required: true content: application/scim+json: schema: type: object application/json: schema: type: object responses: ScimResource: description: SCIM resource content: application/scim+json: schema: type: object ScimList: description: SCIM ListResponse content: application/scim+json: schema: type: object properties: schemas: type: array items: const: urn:ietf:params:scim:api:messages:2.0:ListResponse totalResults: type: integer startIndex: type: integer itemsPerPage: type: integer Resources: type: array items: type: object ScimError: description: SCIM error content: application/scim+json: schema: type: object properties: schemas: type: array items: const: urn:ietf:params:scim:api:messages:2.0:Error status: type: string detail: type: string scimType: type: string schemas: PersonRole: type: string enum: - tenant_admin - it_analyst - approver - auditor - executive_viewer - employee - partner_admin - partner_staff - platform_operator CreateUserRequest: type: object required: [email, displayName, roles] properties: email: { type: string, format: email, maxLength: 254 } displayName: { type: string, minLength: 1, maxLength: 256 } roles: type: array minItems: 1 items: $ref: '#/components/schemas/PersonRole' PortalUser: type: object required: [id, userName, active, directRoles, effectiveRoles, managedBy, signIn, canResetSignIn, createdAt] properties: id: { type: string, format: uuid } userName: { type: string } email: { type: [string, 'null'] } displayName: { type: [string, 'null'] } active: { type: boolean } directRoles: { type: array, items: { type: string } } effectiveRoles: type: array items: { type: string } description: Direct roles plus roles from group mappings that this organisation may hold managedBy: { type: string, enum: [portal, directory] } signIn: { type: string, enum: [managed, organisation] } canResetSignIn: type: boolean description: This organisation created the person's managed sign-in account and the person is active createdAt: { type: string, format: date-time } PortalUserList: type: object required: [signIn, adminRole, users] properties: signIn: { type: string, enum: [managed, organisation] } adminRole: $ref: '#/components/schemas/PersonRole' users: type: array items: $ref: '#/components/schemas/PortalUser' OneTimeCredentials: type: object description: Returned once; identity-service never stores or logs these values. required: [temporaryPassword, authenticatorKey, otpauthUri] properties: temporaryPassword: { type: string, description: Must be changed at first sign-in } authenticatorKey: { type: string, description: "TOTP key in base32 without padding (SHA1, 6 digits, 30 seconds)" } otpauthUri: { type: string } PortalUserResult: type: object required: [user] properties: user: $ref: '#/components/schemas/PortalUser' credentials: oneOf: - $ref: '#/components/schemas/OneTimeCredentials' - type: 'null' existingSignIn: { type: boolean, description: An existing managed sign-in account was linked and keeps its credentials } warning: type: [string, 'null'] enum: [sign_in_shared, sign_in_not_updated, null] description: The directory change succeeded but the sign-in account was left as it was UserProblem: type: object description: RFC 7807 problem; title is a stable code the portal translates. properties: title: type: string enum: - email_in_use - user_inactive - directory_required - directory_managed - self_change - last_admin - not_managed_sign_in - sign_in_not_owned - sign_in_shared detail: { type: string } status: { type: integer } userId: { type: string, format: uuid } ServiceConsent: type: object required: [clientId, tenantRoles, tenantAudiences, granted, active] properties: clientId: { type: string } tenantRoles: { type: array, items: { type: string }, description: Roles the service holds inside the tenant once granted } tenantAudiences: { type: array, items: { type: string }, description: Services it may call for the tenant } granted: { type: boolean } active: { type: boolean, description: Granted, not revoked and not expired } grantedAt: { type: [string, 'null'], format: date-time } grantedBy: { type: [string, 'null'] } expiresAt: { type: [string, 'null'], format: date-time } revokedAt: { type: [string, 'null'], format: date-time } ServiceGrant: type: object required: [clientId, tenantId, grantedBy, grantedAt, active] properties: clientId: { type: string } tenantId: { type: string, format: uuid } grantedBy: { type: string } grantedAt: { type: string, format: date-time } expiresAt: { type: [string, 'null'], format: date-time } active: { type: boolean } TokenResponse: type: object required: - access_token - issued_token_type - token_type - expires_in properties: access_token: type: string issued_token_type: const: urn:ietf:params:oauth:token-type:access_token token_type: const: Bearer expires_in: type: integer maximum: 900 Federation: type: object properties: issuer: type: string audience: type: string jwksUri: type: string format: uri subjectClaim: type: string matchOn: enum: - ExternalId - UserName updatedAt: type: string format: date-time RoleMappings: type: object properties: mappings: type: array items: type: object required: - group - roles properties: group: type: string maxLength: 256 roles: type: array minItems: 1 items: enum: - tenant_admin - it_analyst - approver - auditor - executive_viewer - employee - partner_admin - platform_operator JitGrant: type: object properties: id: type: string format: uuid tenantId: type: string format: uuid requestedBy: type: string reason: type: string durationMinutes: type: integer status: enum: - Pending - Approved approvedBy: type: - string - 'null' requestedAt: type: string format: date-time expiresAt: type: - string - 'null' format: date-time state: type: string enum: - Pending - Active - Expired