GluuFederation / gluu4

The Gluu Server 4.x Monorepo . The Gluu Server is a container distribution of free open source software (FOSS) for identity and access management (IAM). SaaS, custom, open source and commercial web and mobile applications can leverage a Gluu Server for user authentication, identity information, and policy decisions
Apache License 2.0
7 stars 0 forks source link

feat(oxauth): jython script code does not recognize 3456 number #2

Open yuriyz opened 3 months ago

yuriyz commented 3 months ago

Describe the issue

Following jython code does not recognize 3456 number.

jsonWebResponse.getClaims().setClaimObject("accountNumber3", Long.valueOf("3456"), True)

Steps To Reproduce

Run jython script with long number 3456

Expected behavior

Long number is recognized and json is produced {"accountNumber3": 3456}

Actual behavior

2024-08-01 12:14:10,442 ERROR [qtp1714078840-20] [org.gluu.oxauth.service.external.ExternalUpdateTokenService] (ExternalUpdateTokenService.java:56) - Claim value is not suppor
ted, key: accountNumber3, value :3456
java.lang.UnsupportedOperationException: Claim value is not supported, key: accountNumber3, value :3456
        at org.gluu.oxauth.model.jwt.JwtClaimSet.setClaimObject(JwtClaimSet.java:217) ~[oxauth-model-4.5.6-SNAPSHOT.jar:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:207) ~[jython-standalone-2.7.3.jar:2.7.4a1-SNAPSHOT]
        at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:225) ~[jython-standalone-2.7.3.jar:2.7.4a1-SNAPSHOT]
        at org.python.core.PyObject.__call__(PyObject.java:512) ~[jython-standalone-2.7.3.jar:2.7.4a1-SNAPSHOT]
        at org.python.core.PyObject.__call__(PyObject.java:517) ~[jython-standalone-2.7.3.jar:2.7.4a1-SNAPSHOT]

Support: 11888

yuriyz commented 3 months ago

Issue can be workarounded with following code:

   parsed = JSONObject('{\"accountNumber\":7030934608, \"exp\":1722516607, \"iat\":1722513007}')
   jsonWebResponse.getClaims().load(parsed)

which results in correct json

{
  "accountNumber": 7030934608,
  "exp": 1722516607,
  "iat": 1722513007
}