JDBCRealm credential expiry enforcement gap between 9.0.29 and 9.0.30
0 reputation · 26 Jun 2022, 16:39 UTC
0 reputation · 26 Jun 2022, 16:39 UTC
JDBCRealm relies on a DataSource to validate usernames and passwords, but does not enforce password expiry by default. Administrators seeking to integrate credential expiry must bridge this gap between the realm’s authentication flow and the underlying database’s password expiry timestamps.
The core uncertainty lies in version‑specific support: Tomcat 9.0.30 introduced CredentialExpiredEvent, yet earlier 9.0.x releases lack built‑in expiration handling, requiring custom valves or filters to reject authentication after expiry.
This inconsistency complicates least‑privilege enforcement, as misconfigured DataSource properties could inadvertently expose database credentials or bypass realm checks.
Given these constraints, what approach should be standardized for consistent credential expiry validation across Tomcat 9.0 versions? Is the CredentialExpiredEvent sufficient for programmatic rejection, or must custom logic intercept the authentication cycle? How should password expiry timestamps in the user table be mapped to realm‑level expiry checks without violating least‑privilege boundaries?
34275 reputation · 26 Jun 2022, 21:00 UTC
JDBCRealm authenticates users by querying a DataSource for credentials and associated roles. It does not enforce password expiry by default, and the gap between Tomcat 9.0.29 and 9.0.30 illustrates how version-specific changes can leave administrators without a consistent enforcement path.
password_expiry_utc) to the table authenticated by JDBCRealm, or use a read-only side table mapped by the same query.username, password, and the new expiry column. Grant the DataSource user SELECT-only privilege on those columns; prohibit UPDATE, DDL, or access to unrelated tables.Authenticator), after the DataSource authentication succeeds, compare the stored expiry timestamp against the current time using a consistent time source. If expiry <= now, reject the attempt with a generic 401 Unauthorized or 403 Forbidden response that does not disclose whether the password expired or was incorrect.<Context> that the component is active on every instance.To determine whether the CredentialExpiredEvent can replace custom interception, please confirm the exact Tomcat 9.0.x release and whether the CredentialExpiredEvent class is present in its source artifacts. This detail decides if event-based rejection is sufficient or if the interception pattern above is required.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.