Пример #1
0
 public boolean validateToken(String authToken) {
   try {
     Jwts.parser().setSigningKey(secretKey).parseClaimsJws(authToken);
     return true;
   } catch (SignatureException e) {
     log.info("Invalid JWT signature: " + e.getMessage());
     return false;
   }
 }
Пример #2
0
  private void printRecords(Store type) throws RemoteException, MonitorException {
    if (dataStorers == null || dataStorers.length == 0) {
      findStorers();
    }
    Map<Uuid, ObjectInfo> all;
    if (selectedDataStorer >= 0) {
      out.println(
          "From Data Storage: "
              + AttributesUtil.getProviderName(dataStorers[selectedDataStorer].attributeSets)
              + " at: "
              + AttributesUtil.getHostName(dataStorers[selectedDataStorer].attributeSets));
      //			all = ((StorageManagement) dataStorers[selectedDataStorer].service)
      //					.getMonitorableExertionInfo(type,
      //							NetworkShell.getPrincipal());

      Context cxt = null;
      try {
        store("test-only");
        out.println("XXXXXXXXXXXXX service item: " + dataStorers[selectedDataStorer]);
        out.println(
            "XXXXXXXXXXXXX service: " + (DatabaseStorer) dataStorers[selectedDataStorer].service);
        out.println(
            "XXXXXXXXXXXXX interfaces: "
                + Arrays.toString(
                    dataStorers[selectedDataStorer].service.getClass().getInterfaces()));
        out.println(
            "XXXXXXXXXXXXX name: "
                + ((Provider) dataStorers[selectedDataStorer].service).getProviderName());
        try {
          cxt =
              ((DatabaseStorer) dataStorers[selectedDataStorer].service)
                  .contextList(SdbUtil.getListContext(Store.object));
        } catch (MalformedURLException e) {
          e.printStackTrace();
        }
        out.println("XXXXXXXXXXXXX context: " + cxt);
        try {
          store("test-only");
          List<String> records = list(Store.object);
          out.println("XXXXXXXXXXXXX records; " + records);
        } catch (ExertionException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        } catch (SignatureException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
        out.println(cxt.getValue(DatabaseStorer.store_content_list));
        //			} catch (ExertionException e) {
        //				e.printStackTrace();
        //			} catch (SignatureException e) {
        //				e.printStackTrace();
      } catch (ContextException e) {
        e.printStackTrace();
      }

    } else {
      Map<Uuid, ObjectInfo> ri = null;
      all = new HashMap<Uuid, ObjectInfo>();
      for (int i = 0; i < dataStorers.length; i++) {
        out.println(
            "From Data Storage "
                + AttributesUtil.getProviderName(dataStorers[i].attributeSets)
                + " at: "
                + AttributesUtil.getHostName(dataStorers[i].attributeSets));

        DatabaseStorer emx = (DatabaseStorer) dataStorers[i].service;
        //				ri = emx.getMonitorableExertionInfo(type,
        //						NetworkShell.getPrincipal());
        if (ri != null && ri.size() > 0) {
          all.putAll(ri);
        }
        // populate exertion/EMX map
        dataStorerMap.clear();
        for (ObjectInfo ei : ri.values()) {
          dataStorerMap.put(ei.uuid, dataStorers[i]);
        }
      }
    }
    //		if (all.size() == 0) {
    //			out.println("No monitored exertions at this time.");
    //			return;
    //		}
    //		recordInfos = new RecordInfo[all.size()];
    //		all.values().toArray(recordInfos);
    //		printRecordInfos(recordInfos);
  }