What are Secure Links?
Secure Links are time-limited, access-controlled URLs that provide secure sharing of content. Each link is identified by a uniqueshortCode and can be configured with various security constraints including expiration times, view limits, and password protection.
Link Types
The system supports two distinct link types, defined in theLinkType enum:
REDIRECT Links
Redirect links forward users to a target URL after validation. These are created via the/api/links endpoint.
Use Cases
- Sharing external resources with access controls
- Creating temporary marketing campaign URLs
- Distributing time-sensitive partner links
DOWNLOAD Links
Download links serve files from server storage. These are created via the/api/links/upload endpoint with file upload.
Use Cases
- Sharing confidential documents securely
- Distributing time-limited software releases
- Temporary file sharing with clients
Link Lifecycle
Every secure link progresses through a defined lifecycle from creation to eventual expiration or revocation.Creation
When a link is created:- A unique
shortCodeis generated (seeCodeUtils.java:23) - Initial status is set to
ACTIVE viewCountis initialized to0- Optional security constraints are applied (password, expiration, max views)
Active Usage
WhileACTIVE, the link:
- Accepts access requests that pass validation
- Increments
viewCounton each successful access - Validates security constraints before granting access
Expiration
A link automatically expires when:- Current time exceeds
expiresAttimestamp viewCountreachesmaxViewslimit
SecureLink.java:79-88
Revocation
Links can be manually revoked via the/api/links/{shortCode}/revoke endpoint, immediately denying all access.
Link Status States
TheLinkStatus enum defines three possible states:
ACTIVE
ACTIVE
The link is operational and accepts access requests. All new links start in this state.Characteristics:
- Accepts access attempts
- Validates against security constraints
- Increments view count on successful access
EXPIRED
EXPIRED
The link has reached its expiration condition and denies all access.Triggers:
- Current time exceeds
expiresAt - View count reaches
maxViews
- Returns
AccessResult.EXPIREDorAccessResult.VIEW_LIMIT_REACHED - HTTP 410 Gone status
- Access attempt is logged in audit trail
REVOKED
REVOKED
The link has been manually disabled by an administrator.Characteristics:
- Permanent state (cannot be reversed)
- Returns
AccessResult.REVOKED - HTTP 410 Gone status
- All access attempts logged
Domain Model
TheSecureLink entity contains all link metadata:
SecureLink.java:23-127
Either
targetUrl (REDIRECT) or filePath (DOWNLOAD) must be set, but never both.Key Methods
Status Checking
Status Transitions
Status transitions are one-way. Once a link is EXPIRED or REVOKED, it cannot return to ACTIVE.
Next Steps
Access Control
Learn about expiration rules, view limits, and password protection
Audit Tracking
Understand how access attempts are logged and monitored
