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

MFA Policies

Production - MfaPolicyController - 7 endpoints at /api/v1/mfa-policies

MFA policies define per-tenant rules for when and how MFA is enforced. Policies can require MFA for all users, specific roles, or conditionally based on risk signals like new devices, unfamiliar IPs, or high-risk operations.


6.3.7Policy Types

TypeDescription
REQUIREMFA is mandatory for all targeted users
CONDITIONALMFA is required only when risk conditions are met
EXEMPTTargeted users are exempt from MFA requirements

Target Scopes

ScopeDescription
ALL_USERSPolicy applies to all users in the tenant
SPECIFIC_ROLESPolicy applies to users with specific roles
SPECIFIC_GROUPSPolicy applies to users in specific groups
SPECIFIC_USERSPolicy applies to specific named users

6.3.8Policy Management

Create Policy

curl -X POST http://localhost:8081/api/v1/mfa-policies \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <admin-token>" \
  -H "X-Tenant-ID: 550e8400-e29b-41d4-a716-446655440000" \
  -d '{
    "name": "Admin MFA Required",
    "description": "Require MFA for all admin users",
    "policyType": "REQUIRE",
    "targetScope": "SPECIFIC_ROLES",
    "priority": 10,
    "enrollmentGraceDays": 3
  }'

List Policies

curl -X GET http://localhost:8081/api/v1/mfa-policies \
  -H "Authorization: Bearer <admin-token>" \
  -H "X-Tenant-ID: 550e8400-e29b-41d4-a716-446655440000"

Evaluate MFA Requirement

Check whether MFA is required for a specific context:

curl -X POST http://localhost:8081/api/v1/mfa-policies/evaluate \
  -H "Authorization: Bearer <admin-token>" \
  -H "X-Tenant-ID: 550e8400-e29b-41d4-a716-446655440000" \
  -d 'userId=42&ipAddress=203.0.113.50&riskScore=75&operation=admin_action'

6.3.9Conditional MFA Signals

Conditional policies evaluate these risk signals:

SignalRequest ParameterDescription
New DevicedeviceFingerprintDevice not seen before
New IP AddressipAddressIP not in user's history
New LocationDerived from IPGeographic location anomaly
High Risk ScoreriskScoreRisk score exceeds threshold
Sensitive OperationoperationOperation type requires elevation

Default Policies

The POST /api/v1/mfa-policies/templates/default endpoint creates two default policies for new tenants:

  1. Admin MFA Required (priority 10): Requires MFA for all admin users with a 3-day enrollment grace period
  2. Conditional MFA (priority 100): Requires MFA on new devices, new IPs, new locations, and high-risk operations (risk threshold: 50) with a 7-day enrollment grace period

Error Codes

CodeHTTP StatusDescription
RESOURCE_NOT_FOUND404Policy not found
ACCESS_DENIED403Insufficient permissions