Search in sources :

Example 1 with Project

use of com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project in project so by onap.

the class AuthenticationMethodFactory method getAuthenticationForV3ByName.

public final com.woorea.openstack.keystone.v3.model.Authentication getAuthenticationForV3ByName(CloudIdentity cloudIdentity, String name) {
    Identity identity = new Identity();
    Password password = new Password();
    User user = new User();
    Domain userDomain = new Domain();
    Scope scope = new Scope();
    Project project = new Project();
    Project.Domain projectDomain = new Project.Domain();
    userDomain.setName(cloudIdentity.getUserDomainName());
    projectDomain.setName(cloudIdentity.getAdminProjectDomainName());
    user.setName(cloudIdentity.getMsoId());
    user.setPassword(CryptoUtils.decryptCloudConfigPassword(cloudIdentity.getMsoPass()));
    user.setDomain(userDomain);
    password.setUser(user);
    project.setDomain(projectDomain);
    project.setName(name);
    scope.setProject(project);
    identity.setPassword(password);
    identity.setMethods(Collections.singletonList("password"));
    com.woorea.openstack.keystone.v3.model.Authentication v3Auth = new com.woorea.openstack.keystone.v3.model.Authentication();
    v3Auth.setIdentity(identity);
    v3Auth.setScope(scope);
    return v3Auth;
}
Also used : User(com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User) Project(com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project) Scope(com.woorea.openstack.keystone.v3.model.Authentication.Scope) RackspaceAuthentication(org.onap.so.cloud.authentication.models.RackspaceAuthentication) Authentication(com.woorea.openstack.keystone.model.Authentication) CloudIdentity(org.onap.so.db.catalog.beans.CloudIdentity) Identity(com.woorea.openstack.keystone.v3.model.Authentication.Identity) Domain(com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain) UsernamePassword(com.woorea.openstack.keystone.model.authentication.UsernamePassword) Password(com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password)

Example 2 with Project

use of com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project 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());
    }
}
Also used : Authentication(com.woorea.openstack.keystone.v3.model.Authentication)

Example 3 with Project

use of com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project in project so by onap.

the class AuthenticationMethodFactory method getAuthenticationForV3.

public final com.woorea.openstack.keystone.v3.model.Authentication getAuthenticationForV3(CloudIdentity cloudIdentity, String tenantId) {
    Identity identity = new Identity();
    Password password = new Password();
    User user = new User();
    Domain userDomain = new Domain();
    Scope scope = new Scope();
    Project project = new Project();
    Project.Domain projectDomain = new Project.Domain();
    userDomain.setName(cloudIdentity.getUserDomainName());
    projectDomain.setName(cloudIdentity.getProjectDomainName());
    user.setName(cloudIdentity.getMsoId());
    user.setPassword(CryptoUtils.decryptCloudConfigPassword(cloudIdentity.getMsoPass()));
    user.setDomain(userDomain);
    password.setUser(user);
    project.setDomain(projectDomain);
    project.setId(tenantId);
    scope.setProject(project);
    identity.setPassword(password);
    identity.setMethods(Collections.singletonList("password"));
    com.woorea.openstack.keystone.v3.model.Authentication v3Auth = new com.woorea.openstack.keystone.v3.model.Authentication();
    v3Auth.setIdentity(identity);
    v3Auth.setScope(scope);
    return v3Auth;
}
Also used : User(com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User) Project(com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project) Scope(com.woorea.openstack.keystone.v3.model.Authentication.Scope) RackspaceAuthentication(org.onap.so.cloud.authentication.models.RackspaceAuthentication) Authentication(com.woorea.openstack.keystone.model.Authentication) CloudIdentity(org.onap.so.db.catalog.beans.CloudIdentity) Identity(com.woorea.openstack.keystone.v3.model.Authentication.Identity) Domain(com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain) UsernamePassword(com.woorea.openstack.keystone.model.authentication.UsernamePassword) Password(com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password)

Aggregations

Authentication (com.woorea.openstack.keystone.model.Authentication)2 UsernamePassword (com.woorea.openstack.keystone.model.authentication.UsernamePassword)2 Identity (com.woorea.openstack.keystone.v3.model.Authentication.Identity)2 Password (com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password)2 User (com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User)2 Domain (com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain)2 Scope (com.woorea.openstack.keystone.v3.model.Authentication.Scope)2 Project (com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project)2 RackspaceAuthentication (org.onap.so.cloud.authentication.models.RackspaceAuthentication)2 CloudIdentity (org.onap.so.db.catalog.beans.CloudIdentity)2 Authentication (com.woorea.openstack.keystone.v3.model.Authentication)1