Skip to content

Unable to increase OIDC userinfo cache TTL #2252

Closed

Description

@mjnaderi

I believe the default OIDC userinfo cache TTL (10 seconds) is too short, and I’d like to increase it.

According to the documentation, the PROXY_OIDC_USERINFO_CACHE_TTL environment variable is only applied when the access token does not have an expiration time. What is the reasoning behind this restriction? In our setup, the access token does have an expiration, which means we cannot increase the userinfo cache TTL at all.

We have two concrete reasons for wanting to increase the TTL:

1. Random user logouts
We are experiencing the same issue described in #1493, where users get logged out seemingly at random. One suggested workaround to mitigate this problem is increasing the OIDC userinfo cache TTL via PROXY_OIDC_USERINFO_CACHE_TTL, but this is not possible in our case due to the restriction mentioned above.

2. Excessive requests to the IdP userinfo endpoint
With a TTL of only 10 seconds, OpenCloud sends a large number of requests to the IdP’s userinfo endpoint. Our external IdP enforces rate limiting, and when many users are active at the same time, the userinfo endpoint starts returning 429 Too Many Requests, which negatively impacts user sessions.

Given these issues, it would be very helpful to understand the logic behind tying the userinfo cache TTL to the absence of an access token expiration, and whether this behavior could be reconsidered or made configurable.

Here is the configuration related to our external IdP:

---
services:
  opencloud:
    environment:
      FRONTEND_READONLY_USER_ATTRIBUTES: "user.onPremisesSamAccountName,user.displayName,user.mail,user.passwordProfile,user.accountEnabled" # noqa yaml[line-length]
      PROXY_OIDC_REWRITE_WELLKNOWN: "true"
      WEB_OIDC_CLIENT_ID: ${OC_OIDC_CLIENT_ID:-web}
      PROXY_ROLE_ASSIGNMENT_DRIVER: "default"
      OC_OIDC_ISSUER: ${IDP_ISSUER_URL}
      # Start all services except idp. It is replaced by external service.
      OC_EXCLUDE_RUN_SERVICES: idp
      # IdP specific configuration for auto-provisioning
      OC_LDAP_SERVER_WRITE_ENABLED: "true"
      PROXY_AUTOPROVISION_ACCOUNTS: "true"
      # Use the `sub` claim from the IdP for the user ID
      # It must be a unique and stable identifier that doesn’t change over time.
      # Most IdPs use the internal user ID as the `sub` claim
      PROXY_USER_OIDC_CLAIM: "sub"
      # Set the username from "preferred_username" claim
      PROXY_AUTOPROVISION_CLAIM_USERNAME: "preferred_username"
      # Our IdP does not use JWT for access token.
      # https://github.com/opencloud-eu/opencloud/issues/1578#issuecomment-3346426680
      PROXY_OIDC_ACCESS_TOKEN_VERIFY_METHOD: "none"
      # Our IdP may return usernames starting with digits, but OpenCloud
      # does not by default accept usernames starting by a digit.
      # Disable OpenCloud's default restrictions on allowed characters in usernames.
      GRAPH_USERNAME_MATCH: "none"
      # We need to set the IDP_DOMAIN to allow the CSP rules to be set correctly
      IDP_DOMAIN: ${IDP_DOMAIN}
      # The openCloud users need to be able to edit their account in the externa IdP
      WEB_OPTION_ACCOUNT_EDIT_LINK_HREF: ${IDP_ACCOUNT_URL}

Activity

  1. rhafer commented on Feb 2, 2026

    @rhafer
    Member

    I believe the default OIDC userinfo cache TTL (10 seconds) is too short, and I’d like to increase it.

    According to the documentation, the PROXY_OIDC_USERINFO_CACHE_TTL environment variable is only applied when the access token does not have an expiration time.

    Could you please point me to the docs. I guess we need to make them a bit more precise about when PROXY_OIDC_USERINFO_CACHE_TTL is actually used.

    What is the reasoning behind this restriction? In our setup, the access token does have an expiration, which means we cannot increase the userinfo cache TTL at all.

    If I understand you config correctly the access tokens issued by your IDP are not JWT tokens (at least you set: PROXY_OIDC_ACCESS_TOKEN_VERIFY_METHOD: "none"). In that case OpenCloud is not able to extract the token expiration from your access tokens (opencloud does currently no support token introspection) and it should fall back to PROXY_OIDC_USERINFO_CACHE_TTL.

    I guess the documentation is a bit missleading there. So to summarize:

    • When OpenCloud is able to extract the exipration time from the access token (currently only when the IDP issues JWT encoded access tokens and PROXY_OIDC_ACCESS_TOKEN_VERIFY_METHOD=jwt) it will use that expiration time as the ttl for the userinfo cache.
    • When OpenCloud is not able to extract the expiration time it will fallback to the value set via PROXY_OIDC_USERINFO_CACHE_TTL

    Given these issues, it would be very helpful to understand the logic behind tying the userinfo cache TTL to the absence of an access token expiration, and whether this behavior could be reconsidered or made configurable.

    As it's not really clear to me from the report: Have you already tried increasing PROXY_OIDC_USERINFO_CACHE_TTL and found it didn't work? Or didn't you even try because the docs are somewhat unclear.

  2. mjnaderi commented on Feb 2, 2026

    @mjnaderi
    Author

    Thanks for the detailed explanation. That clears things up.

    Could you please point me to the docs. I guess we need to make them a bit more precise about when PROXY_OIDC_USERINFO_CACHE_TTL is actually used.

    Here is the documentation URL: https://docs.opencloud.eu/docs/dev/server/services/proxy/environment-variables/

    If I understand you config correctly the access tokens issued by your IDP are not JWT tokens

    Yes, your understanding is correct. In our setup, the access tokens issued by the IdP are not JWTs.

    Have you already tried increasing PROXY_OIDC_USERINFO_CACHE_TTL and found it didn't work? Or didn't you even try because the docs are somewhat unclear.

    I had tried setting PROXY_OIDC_USERINFO_CACHE_TTL in the past, but at that time it didn’t seem to have any effect. Based on your reply, I revisited this and tried again.

    It turns out the issue was on my side: previously, I was setting the value as a plain integer (e.g. 60 for one minute). When I set it explicitly as a duration (e.g. 5m), it worked as expected. With PROXY_OIDC_USERINFO_CACHE_TTL=5m, OpenCloud does not send any requests to the userinfo endpoint during that period.

    So the behavior is now clear and working correctly for us. Thanks for the clarification and quick feedback.

  3. added 2 commits that reference this issue on Feb 3, 2026
    2471a9c
    0639304
  4. added a commit that references this issue on Oct 13, 2026
    7b4284b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions