@Test public void storeSecrets_secretTypeNull() { final TypedSecret typedSecret = new TypedSecret(); typedSecret.setSecret(HexUtils.toHexString("$3cr3t".getBytes())); final DbEncryptionKeyReference keyReference = new DbEncryptionKeyReference(); keyReference.setEncryptionProviderType(EncryptionProviderType.JRE); keyReference.setReference("keyReferenceString"); assertThatIllegalArgumentException().isThrownBy( () -> this.service.storeSecrets("SOME_DEVICE", Arrays.asList(typedSecret))); }
public void storeSecrets(final String deviceIdentification, final List<TypedSecret> secrets) { secrets.stream() .map(t -> this.validateSecret(deviceIdentification, t)) .map(s -> this.createEncrypted(deviceIdentification, s, this.getKey())) .forEach(this.secretRepository::save); }
SecretManagementService { public void storeSecrets(final String deviceIdentification, final List<TypedSecret> secrets) { secrets.stream() .map(t -> this.validateSecret(deviceIdentification, t)) .map(s -> this.createEncrypted(deviceIdentification, s, this.getKey())) .forEach(this.secretRepository::save); } }
SecretManagementService { public void storeSecrets(final String deviceIdentification, final List<TypedSecret> secrets) { secrets.stream() .map(t -> this.validateSecret(deviceIdentification, t)) .map(s -> this.createEncrypted(deviceIdentification, s, this.getKey())) .forEach(this.secretRepository::save); } SecretManagementService(
            @Qualifier("DefaultEncryptionDelegate") final EncryptionDelegate defaultEncryptionDelegate,
            final EncryptionProviderType encryptionProviderType, final DbEncryptedSecretRepository secretRepository,
            final DbEncryptionKeyRepository keyRepository); }
SecretManagementService { public void storeSecrets(final String deviceIdentification, final List<TypedSecret> secrets) { secrets.stream() .map(t -> this.validateSecret(deviceIdentification, t)) .map(s -> this.createEncrypted(deviceIdentification, s, this.getKey())) .forEach(this.secretRepository::save); } SecretManagementService(
            @Qualifier("DefaultEncryptionDelegate") final EncryptionDelegate defaultEncryptionDelegate,
            final EncryptionProviderType encryptionProviderType, final DbEncryptedSecretRepository secretRepository,
            final DbEncryptionKeyRepository keyRepository); void storeSecrets(final String deviceIdentification, final List<TypedSecret> secrets); List<TypedSecret> retrieveSecrets(final String deviceIdentification, final List<SecretType> secretTypes); Optional<TypedSecret> retrieveSecret(final String deviceIdentification, final SecretType secretType); }
SecretManagementService { public void storeSecrets(final String deviceIdentification, final List<TypedSecret> secrets) { secrets.stream() .map(t -> this.validateSecret(deviceIdentification, t)) .map(s -> this.createEncrypted(deviceIdentification, s, this.getKey())) .forEach(this.secretRepository::save); } SecretManagementService(
            @Qualifier("DefaultEncryptionDelegate") final EncryptionDelegate defaultEncryptionDelegate,
            final EncryptionProviderType encryptionProviderType, final DbEncryptedSecretRepository secretRepository,
            final DbEncryptionKeyRepository keyRepository); void storeSecrets(final String deviceIdentification, final List<TypedSecret> secrets); List<TypedSecret> retrieveSecrets(final String deviceIdentification, final List<SecretType> secretTypes); Optional<TypedSecret> retrieveSecret(final String deviceIdentification, final SecretType secretType);  }