use of alien4cloud.model.secret.SecretAuthResponse in project alien4cloud by alien4cloud.
the class SecretProviderService method internalGenerateToken.
/**
* Generate a token wrapped in an instance of SecretProviderConfigurationAndCredentials by authenticating the credentials (username, password) with ldap
*
* @param locationConfiguration
* @param credentials
* @return SecretProviderConfigurationAndCredentials wrapping a token
*/
private SecretProviderConfigurationAndCredentials internalGenerateToken(SecretProviderConfiguration locationConfiguration, Object credentials) {
// Instead of saving the credentials username and password, we transform the username and password to a client token
ISecretProvider secretProvider = this.getPluginBean(locationConfiguration.getPluginName());
Object configuration = this.getPluginConfiguration(locationConfiguration.getPluginName(), locationConfiguration.getConfiguration());
SecretAuthResponse authResponse = secretProvider.auth(configuration, this.getCredentials(locationConfiguration.getPluginName(), configuration, credentials));
SecretProviderConfigurationAndCredentials result = new SecretProviderConfigurationAndCredentials();
SecretProviderConfiguration secretProviderConfiguration = new SecretProviderConfiguration();
secretProviderConfiguration.setPluginName(locationConfiguration.getPluginName());
secretProviderConfiguration.setConfiguration(authResponse.getConfiguration());
result.setSecretProviderConfiguration(secretProviderConfiguration);
result.setCredentials(authResponse.getCredentials());
return result;
}
Aggregations