コード例 #1
0
 public void addUpdate(UserCredential userCredential) {
   configManager.updateXML(
       USER_CREDENTIALS_CONFIG, newAddUpdateUserCredentialsDocumentAlteration(userCredential));
   if (userCredential.getServiceKey() != null) {
     usersWithServiceKey.add(userCredential.getUsername());
   }
 }
コード例 #2
0
 public String getUserCredentialByServiceKey(String serviceKey) {
   for (String usernameWithServiceKey : usersWithServiceKey) {
     UserCredential userCredential = getUserCredential(usernameWithServiceKey);
     if (userCredential != null && serviceKey.equals(userCredential.getServiceKey())) {
       return userCredential.getUsername();
     }
   }
   return null;
 }
コード例 #3
0
 public String getServiceKeyByToken(String token) {
   for (String usernameWithServiceKey : usersWithServiceKey) {
     UserCredential userCredential = getUserCredential(usernameWithServiceKey);
     if (userCredential.getTokens().containsKey(token)
         && !userCredential.getTokens().get(token).isBefore(new LocalDateTime())) {
       return userCredential.getServiceKey();
     }
   }
   return null;
 }