IAV-1027/feat(integration): add optional credential expiration date (expiresAt) support
Summary
This MR introduces support for an optional expiration date (expiresAt) on credentials created through the integration flow. The field propagates cleanly from the API surface down to the core-n8n-service credential creation call.
Changes
CredentialDTO
- Added
private Date expiresAtfield - Used to carry the expiration date when calling
core-n8n-service
CreateAgentIntegrationRequestDTO
- Added
private Date expiresAtfield - Passed into
CredentialDTOinsidecreateCredentialInN8n()
CreateUserIntegrationRequestDTO
- Added
private Date expiresAtfield - Forwarded to
CreateAgentIntegrationRequestDTObuilder inUserIntegrationServiceImpl.createUserIntegration()andcreateUserIntegrationWithStateToken()
AgentIntegrationServiceImpl
-
createCredentialInN8n(): passesrequest.getExpiresAt()toCredentialDTO
UserIntegrationServiceImpl
-
createUserIntegration(): includesexpiresAtin theCreateAgentIntegrationRequestDTObuilder - No change needed for
createUserIntegrationWithStateToken()as it uses a pre-confirmed OAuth credential (expiry managed by OAuth provider)
Propagation Chain
POST /user-integrations
└── CreateUserIntegrationRequestDTO.expiresAt
└── CreateAgentIntegrationRequestDTO.expiresAt
└── CredentialDTO.expiresAt
└── core-n8n-service /credentials
Behavior
-
expiresAtis optional — ifnull, the credential does not expire (existing behavior preserved) - No breaking change to existing API consumers
- No database schema change required — expiry is managed entirely in
core-n8n-service
Testing Checklist
-
Create integration with expiresAtset — verify it is forwarded tocore-n8n-service -
Create integration without expiresAt— verify null is handled gracefully (no NPE) -
OAuth flow ( createUserIntegrationWithStateToken) — verify no regression -
Replicate integration — verify expiresAtis not required / does not break replication
Related Issues
Closes IAV-1027