[OPENAM-15687] Session endpoint is searching for a long value in CTS that is stored as a string Created: 14/Nov/19  Updated: 12/Mar/20  Resolved: 06/Jan/20

Status: Resolved
Project: OpenAM
Component/s: Amster, CTS, rest
Affects Version/s: 6.5.2.1
Fix Version/s: 6.0.1, 5.5.2, 7.0.0, 6.5.3

Type: Bug Priority: Major
Reporter: Abel Hoxeng Assignee: Lawrence Yarham
Resolution: Fixed Votes: 0
Labels: EDISON
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to OPENAM-15778 Amster query session command filter s... Open
Sprint: AM Sustaining Sprint 70
Story Points: 2
Support Ticket IDs:
Needs QA verification:
No
Functional tests:
No
Are the reproduction steps defined?:
Yes and I used the same an in the description, Yes but I used my own steps. (If so, please add them in a new comment)

 Description   

Bug description

When using amster to query sessions, Amster makes a a REST call to the sessions endpoint to iterate through CTS sessions.  The CTS entries of type OAUTH2_STATELESS_GRANT have the oauth2 client_id as the value of coreTokenString04.   When looking at this attribute, AM is trying to parse out a long value from an attribute that is stored as string causing a NumberFormatException.

How to reproduce the issue

 

  1. Create Oauth2 client
  2. Run Amster command query Sessions --realm / --filter 'realm eq "/"'
  3. Observe error "{"code":400,"reason":"Bad Request","message":"For input string: \"test-client\""}"
Expected behaviour
sessions should be returned with no error
Current behaviour
400 bad request is returned

 

Code analysis

 

CtsPartialSessionsFactory.java
} else if (field.equals(SessionTokenField.LATEST_ACCESS_TIME.getField())) {

Generated at Tue Oct 27 00:51:42 UTC 2020 using Jira 7.13.12#713012-sha1:6e07c38070d5191bbf7353952ed38f111754533a.