src/main/java/app/coronawarn/verification/service/AppSessionService.java
/**
   * This method generates a registration Token by a guid .
   *
   * @param hashedGuid the hashed guid
   * @return an {@link ResponseEntity}
   */
This method generates a registration Token by a guid .
@param hashedGuid the hashed guid
@return an  ResponseEntity
This method generates a registration Token by a guid . @param hashedGuid the hashed guid @return an ResponseEntity
public ResponseEntity<RegistrationToken> generateRegistrationTokenByGuid(
    String hashedGuid, String hashedGuidDob, String fake) {
    if (checkRegistrationTokenAlreadyExistsForGuid(hashedGuid)) {
      log.warn("The registration token already exists for the hashed guid.");
      return ResponseEntity.badRequest().build();
    }
    if (hashedGuidDob != null && checkRegistrationTokenAlreadyExistsForGuid(hashedGuidDob)) {
      log.warn("The registration token already exists for the hashed guid dob.");
      return ResponseEntity.badRequest().build();
    }
    log.info("Start generating a new registration token for the given hashed guid.");
    String registrationToken = generateRegistrationToken();
    VerificationAppSession appSession = generateAppSession(registrationToken);
    appSession.setHashedGuid(hashedGuid);
    appSession.setHashedGuidDob(hashedGuidDob);
    appSession.setSourceOfTrust(AppSessionSourceOfTrust.HASHED_GUID);
    saveAppSession(appSession);
    log.info("Returning the successfully created registration token.");
    return ResponseEntity.status(HttpStatus.CREATED).body(
      getBackwardCompatibleRegistrationToken(registrationToken, fake));
  }
public ResponseEntity < RegistrationToken > generateRegistrationTokenByGuid ( String hashedGuid , String hashedGuidDob , String fake ) { if ( checkRegistrationTokenAlreadyExistsForGuid ( hashedGuid ) ) { log . warn ( "The registration token already exists for the hashed guid." ) ; return ResponseEntity . badRequest ( ) . build ( ) ; } if ( hashedGuidDob != null && checkRegistrationTokenAlreadyExistsForGuid ( hashedGuidDob ) ) { log . warn ( "The registration token already exists for the hashed guid dob." ) ; return ResponseEntity . badRequest ( ) . build ( ) ; } log . info ( "Start generating a new registration token for the given hashed guid." ) ; String registrationToken = generateRegistrationToken ( ) ; VerificationAppSession appSession = generateAppSession ( registrationToken ) ; appSession . setHashedGuid ( hashedGuid ) ; appSession . setHashedGuidDob ( hashedGuidDob ) ; appSession . setSourceOfTrust ( AppSessionSourceOfTrust . HASHED_GUID ) ; saveAppSession ( appSession ) ; log . info ( "Returning the successfully created registration token." ) ; return ResponseEntity . status ( HttpStatus . CREATED ) . body ( getBackwardCompatibleRegistrationToken ( registrationToken , fake ) ) ; }
This method generates a registration Token by a guid .
This method generates a registration Token by a guid .