use of com.google.inject.Provides in project keywhiz by square.
the class CryptoModule method baseDerivationKey.
@Provides
@Derivation
@Singleton
SecretKey baseDerivationKey(@Derivation Provider provider) {
String alias = keyStoreConfig.alias();
char[] password = keyStoreConfig.resolvedPassword().toCharArray();
KeyStore keyStore;
try (InputStream inputStream = keyStoreConfig.openPath()) {
keyStore = KeyStore.getInstance(keyStoreConfig.type(), provider);
keyStore.load(inputStream, password);
return (SecretKey) keyStore.getKey(alias, password);
} catch (CertificateException | IOException | KeyStoreException | NoSuchAlgorithmException | UnrecoverableKeyException e) {
logger.error("Error loading base derivation key: {}", e.getMessage(), e);
throw Throwables.propagate(e);
}
}
use of com.google.inject.Provides in project EventHub by Codecademy.
the class UserStorageModule method getIdMap.
@Provides
public IdMap getIdMap(@Named("eventhub.userstorage.directory") String userStorageDirectory) throws IOException {
String filename = userStorageDirectory + "/id_map.db";
//noinspection ResultOfMethodCallIgnored
new File(userStorageDirectory).mkdirs();
Options options = new Options();
options.createIfMissing(true);
return IdMap.create(new DB(JniDBFactory.factory.open(new File(filename), options)));
}
use of com.google.inject.Provides in project EventHub by Codecademy.
the class PropertiesIndexModule method getPropertiesIndex.
@Provides
public PropertiesIndex getPropertiesIndex(@Named("eventhub.directory") String eventIndexDirectory) throws IOException {
//noinspection ResultOfMethodCallIgnored
new File(eventIndexDirectory).mkdirs();
Options options = new Options();
options.createIfMissing(true);
return new PropertiesIndex(new DB(JniDBFactory.factory.open(new File(eventIndexDirectory + "/properties_index.db"), options)));
}
use of com.google.inject.Provides in project OpenAM by OpenRock.
the class CoreRestGuiceModule method getSessionResourceAuthzModule.
@Provides
@Inject
public AnyOfAuthzModule getSessionResourceAuthzModule(SSOTokenManager ssoTokenManager, PrivilegeAuthzModule privilegeAuthzModule, AdminOnlyAuthzModule adminOnlyAuthzModule) {
SessionResourceAuthzModule sessionResourceAuthzModule = new SessionResourceAuthzModule(ssoTokenManager);
List<CrestAuthorizationModule> authzList = new ArrayList<>(3);
authzList.add(adminOnlyAuthzModule);
authzList.add(privilegeAuthzModule);
authzList.add(sessionResourceAuthzModule);
return new AnyOfAuthzModule(authzList);
}
use of com.google.inject.Provides in project OpenAM by OpenRock.
the class CoreRestGuiceModule method getServerAttributeTitles.
@Provides
@Singleton
@Named("ServerAttributeTitles")
public Properties getServerAttributeTitles() throws IOException {
Properties titleProperties = new Properties();
titleProperties.load(getClass().getClassLoader().getResourceAsStream("amConsole.properties"));
return titleProperties;
}
Aggregations