Uploaded image for project: 'WildFly Elytron'
  1. WildFly Elytron
  2. ELY-2714

Attempting to read address data from an OIDC id token causes ClassCastException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.4.0.CR1
    • 1.19.1.Final
    • None
    • None
    • Hide
      1. Obtain an OidcSecurityContext from the Servlet context or equivalent.
      2. Get the id token: IDToken idToken = oidcContext.getIDToken();
      3. Get the address claim set: AddressClaimSet addr = idToken.getAddress();
      4. Get an address field, e.g. "locality": String locality = addr.getLocality();

      Expected result:
      The value of the locality field should be returned.

      Actual Result:
      A ClassCastException is thrown.

      ...
      Caused by: java.lang.ClassCastException: class org.glassfish.json.JsonStringImpl cannot be cast to class java.lang.String (org.glassfish.json.JsonStringImpl is in unnamed module of loader 'org.glassfish.jakarta.json@1.1.6' @396f6598; java.lang.String is in module java.base of loader 'bootstrap')
      2024-01-23T17:41:45.095451000Z     at org.wildfly.security.elytron-http-oidc@1.19.1.Final//org.wildfly.security.http.oidc.AddressClaimSet.getLocality(AddressClaimSet.java:59)
      ...

       

      Show
      Obtain an OidcSecurityContext from the Servlet context or equivalent. Get the id token: IDToken idToken = oidcContext.getIDToken(); Get the address claim set: AddressClaimSet addr = idToken.getAddress(); Get an address field, e.g. "locality": String locality = addr.getLocality(); Expected result: The value of the locality field should be returned. Actual Result: A ClassCastException is thrown. ... Caused by: java.lang.ClassCastException: class org.glassfish.json.JsonStringImpl cannot be cast to class java.lang.String (org.glassfish.json.JsonStringImpl is in unnamed module of loader 'org.glassfish.jakarta.json@1.1.6' @396f6598; java.lang.String is in module java.base of loader 'bootstrap') 2024-01-23T17:41:45.095451000Z     at org.wildfly.security.elytron-http-oidc@1.19.1.Final//org.wildfly.security.http.oidc.AddressClaimSet.getLocality(AddressClaimSet.java:59) ...  

      Attempting to read any address data from an OIDC IDToken causes a ClassCastException.

              dvilkola@redhat.com Diana Krepinska (Inactive)
              bnazare Bruno Gonçalves (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: