this.userService = userService;
this.container = container;
this.domain = domain;
if (encryptionKey.startsWith(EMBEDDED_KEY_PREFIX)) {
this.blobCrypter = new BasicBlobCrypter(encryptionKey.substring(EMBEDDED_KEY_PREFIX.length()));
} else if (encryptionKey.startsWith(CLASSPATH_KEY_PREFIX)) {
try {
File file = new ClassPathResource(encryptionKey.substring(CLASSPATH_KEY_PREFIX.length())).getFile();
this.blobCrypter = new BasicBlobCrypter(FileUtils.readFileToString(file, "UTF-8"));
} catch (IOException e) {
throw new SecurityException("Unable to load encryption key from classpath resource: " + encryptionKey);
}
} else {
try {
File file = new File(encryptionKey);
this.blobCrypter = new BasicBlobCrypter(FileUtils.readFileToString(file, "UTF-8"));
} catch (IOException e) {
throw new SecurityException("Unable to load encryption key from file: " + encryptionKey);
}
}
}