public void readSecurityToken(BaseGenericIdEntity<?> resultEntity){
  if (BaseEntityInternalAccess.getSecurityToken(resultEntity) == null) {
    return;
  }
  BaseEntityInternalAccess.setFilteredData(resultEntity,null);
  Cipher cipher=getCipher(Cipher.DECRYPT_MODE);
  try {
    byte[] decrypted=cipher.doFinal(BaseEntityInternalAccess.getSecurityToken(resultEntity));
    String json=new String(decrypted,StandardCharsets.UTF_8);
    JSONObject jsonObject=new JSONObject(json);
    for (    Object key : jsonObject.keySet()) {
      String elementName=String.valueOf(key);
      JSONArray jsonArray=jsonObject.getJSONArray(elementName);
      for (int i=0; i < jsonArray.length(); i++) {
        String id=jsonArray.getString(i);
        addFiltered(resultEntity,elementName,UUID.fromString(id));
      }
    }
  }
 catch (  Exception e) {
    throw new RuntimeException("An error occurred while reading security token",e);
  }
}

public void readSecurityToken ( BaseGenericIdEntity < ? > resultEntity ) { if ( BaseEntityInternalAccess . getSecurityToken ( resultEntity ) == null ) { return ; } BaseEntityInternalAccess . setFilteredData ( resultEntity , null ) ; Cipher cipher = getCipher ( Cipher . DECRYPT_MODE ) ; try { byte [ ] decrypted = cipher . doFinal ( BaseEntityInternalAccess . getSecurityToken ( resultEntity ) ) ; String json = new String ( decrypted , StandardCharsets . UTF_8 ) ; JSONObject jsonObject = new JSONObject ( json ) ; for ( Object key : jsonObject . keySet ( ) ) { String elementName = String . valueOf ( key ) ; JSONArray jsonArray = jsonObject . getJSONArray ( elementName ) ; for ( int i = 0 ; i < jsonArray . length ( ) ; i ++ ) { String id = jsonArray . getString ( i ) ; addFiltered ( resultEntity , elementName , UUID . fromString ( id ) ) ; } } } catch ( Exception e ) { throw new RuntimeException ( "An error occurred while reading security token" , e ) ; } }
decrypt security token and read filtered data
