Uploaded image for project: 'OpenId Connect'
  1. OpenId Connect
  2. OIDC-331

OAuth2 tokens longer than 768 characters cannot be stored

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • None
    • 2.29.1
    • None
    • None
    • Unknown

    Description

      The accessToken and refreshToken properties of XWiki.OAuth2.TokenClass are Password properties, which are stored as short strings, limited to 768 characters by the database schema. Some providers issue longer tokens: Jira Cloud's OAuth 2.0 access tokens, for example, are JWTs over that limit. Saving such a token fails, so the authorization cannot complete.

      Steps to reproduce

      1. Configure an OAuth2 client for a provider that issues tokens longer than 768 characters (e.g. Jira Cloud)
      2. Authorize XWiki against that provider

      Result

      The token document cannot be saved. With HSQLDB:

      Caused by: org.hsqldb.HsqlException: data exception: string data, right truncation ; size limit: 768 table: XWIKISTRINGS column: XWS_VALUE
      

      The other databases have the same limit and fail the same way.

      Expected

      The token is stored, whatever its length. The OAuth 2.0 specification does not limit the token size, so the properties should be stored as large strings and still be hidden like passwords. The values already stored should be migrated to the new property type.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rbancescu Rares-Emil Bancescu
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: