use of com.woorea.openstack.keystone.v3.model.Authentication in project ovirt-engine by oVirt.
the class KeystoneV3TokenProviderTest method verifyAuthentication.
private void verifyAuthentication(boolean hasProject) {
verify(tokenProvider).requestToken(authenticationCaptor.capture());
Authentication authentication = authenticationCaptor.getValue();
assertThat(authentication, notNullValue());
Authentication.Identity.Password.User user = authentication.getIdentity().getPassword().getUser();
assertThat(user, notNullValue());
assertThat(user.getPassword(), is(PASSWORD));
assertThat(user.getName(), is(USERNAME));
Authentication.Identity.Password.User.Domain domain = user.getDomain();
assertThat(domain, notNullValue());
assertThat(domain.getName(), is(USER_DOMAIN_NAME));
if (hasProject) {
Authentication.Scope.Project project = authentication.getScope().getProject();
assertThat(project, notNullValue());
assertThat(project.getName(), is(PROJECT_NAME));
Authentication.Scope.Project.Domain projectDomain = project.getDomain();
assertThat(projectDomain, notNullValue());
assertThat(projectDomain.getName(), is(PROJECT_DOMAIN_NAME));
} else {
assertNull(authentication.getScope());
}
}
use of com.woorea.openstack.keystone.v3.model.Authentication in project ovirt-engine by oVirt.
the class KeystoneV3TokenProvider method createToken.
private String createToken() {
OpenStackProviderProperties providerProperties = provider.getAdditionalProperties();
Authentication auth = new Authentication();
auth.setIdentity(Authentication.Identity.password(providerProperties.getUserDomainName(), provider.getUsername(), provider.getPassword()));
if (StringUtils.isNotEmpty(providerProperties.getProjectName())) {
auth.setScope(Authentication.Scope.project(providerProperties.getProjectDomainName(), providerProperties.getProjectName()));
}
return getTokenId(requestToken(auth));
}
use of com.woorea.openstack.keystone.v3.model.Authentication in project so by onap.
the class KeystoneV3Authentication method getToken.
public KeystoneAuthHolder getToken(CloudSite cloudSite, String tenantId, String type) throws MsoException {
String cloudId = cloudSite.getId();
String region = cloudSite.getRegionId();
CloudIdentity cloudIdentity = cloudSite.getIdentityService();
MsoTenantUtils tenantUtils = tenantUtilsFactory.getTenantUtilsByServerType(cloudIdentity.getIdentityServerType());
String keystoneUrl = tenantUtils.getKeystoneUrl(cloudId, cloudIdentity);
Keystone keystoneTenantClient = new Keystone(keystoneUrl);
Authentication v3Credentials = authenticationMethodFactory.getAuthenticationForV3(cloudIdentity, tenantId);
OpenStackRequest<Token> v3Request = keystoneTenantClient.tokens().authenticate(v3Credentials);
return makeRequest(v3Request, type, region);
}
Aggregations