private String extractUserId ( String studentId , ResponseEntity < String > response ) { Configuration config = Configuration . builder ( ) . options ( Option . DEFAULT_PATH_LEAF_TO_NULL ) . build ( ) ; ReadContext readContext = JsonPath . using ( config ) . parse ( response . getBody ( ) ) ; String success = readContext . read ( SUCCESS_QUERY ) ; // SSP passes this as a string... if ( ! "true" . equalsIgnoreCase ( success ) ) { return null ; } int count = readContext . read ( RESULTS_QUERY , Integer . class ) ; if ( count != 1 ) { // couldn't find a single unique result. Bail now... log . warn ( "Expected a single unique result for " + studentId + ". Found " + count ) ; return null ; } String id = readContext . read ( STUDENT_ID_QUERY ) ; return id ; }
Parse the person lookup response from SSP .