MATIH Platform is in active MVP development. Documentation reflects current implementation status.
6. Identity & Access Management
OAuth2 Endpoints

OAuth2 Endpoints

The OAuth2 endpoints manage OAuth2 client registration, retrieval, secret management, and deletion. These endpoints require ADMIN role or the oauth2:clients:* permissions. Served by OAuth2ClientController at /api/v1/oauth2/clients.


Endpoints

MethodEndpointDescriptionPermission
POST/api/v1/oauth2/clientsRegister new clientoauth2:clients:write
GET/api/v1/oauth2/clientsList all clientsoauth2:clients:read
GET/api/v1/oauth2/clients/:clientIdGet client detailsoauth2:clients:read
POST/api/v1/oauth2/clients/:clientId/regenerate-secretRegenerate client secretoauth2:clients:write
DELETE/api/v1/oauth2/clients/:clientIdDelete clientoauth2:clients:delete

POST /api/v1/oauth2/clients

Registers a new OAuth2 client application. The client secret is returned only once at creation time for confidential clients.

{
  "clientName": "BI Dashboard App",
  "clientType": "CONFIDENTIAL",
  "grantTypes": ["authorization_code", "refresh_token"],
  "redirectUris": ["https://bi.example.com/callback"],
  "scopes": ["openid", "profile", "data:read"],
  "tokenValiditySeconds": 3600,
  "refreshTokenValiditySeconds": 86400
}
StatusDescription
201Client created, secret included in response
400Invalid request parameters

OAuth2ClientResponse Structure

{
  "id": 1,
  "clientId": "matih-bi-dashboard-abc123",
  "clientSecret": "only-shown-once-at-creation",
  "clientName": "BI Dashboard App",
  "clientType": "CONFIDENTIAL",
  "grantTypes": ["authorization_code", "refresh_token"],
  "redirectUris": ["https://bi.example.com/callback"],
  "scopes": ["openid", "profile", "data:read"],
  "tokenValiditySeconds": 3600,
  "refreshTokenValiditySeconds": 86400,
  "active": true,
  "createdAt": "2026-02-01T10:00:00Z",
  "createdBy": "admin@example.com"
}

POST /api/v1/oauth2/clients/:clientId/regenerate-secret

Regenerates the client secret for a confidential client. The old secret is immediately invalidated. Public clients cannot have secrets regenerated.

StatusDescription
200New secret returned in response
400Cannot regenerate for public clients
404Client not found

DELETE /api/v1/oauth2/clients/:clientId

Deactivates the client and revokes all associated tokens. The client record is retained for audit purposes but marked as inactive.

StatusDescription
204Client deleted
404Client not found