Search in sources :

Example 1 with UserDetails

use of com.venafi.vcert.sdk.connectors.cloud.domain.UserDetails in project vcert-java by Venafi.

the class CloudConnectorTest method setUp.

@BeforeEach
void setUp() {
    classUnderTest = new CloudConnector(cloud);
    userDetails = new UserDetails().user(new User()).company(new Company());
    when(cloud.authorize(anyString())).thenReturn(userDetails);
}
Also used : Company(com.venafi.vcert.sdk.connectors.cloud.domain.Company) UserDetails(com.venafi.vcert.sdk.connectors.cloud.domain.UserDetails) User(com.venafi.vcert.sdk.connectors.cloud.domain.User) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with UserDetails

use of com.venafi.vcert.sdk.connectors.cloud.domain.UserDetails in project vcert-java by Venafi.

the class CloudConnectorUtils method createAppForCit.

private static void createAppForCit(CertificateIssuingTemplate cit, String appName, String apiKey, Cloud cloud) throws VCertException {
    UserDetails userDetails = cloud.authorize(apiKey);
    String userId = userDetails.user().id();
    Application application = new Application();
    Application.OwnerIdsAndType ownerIdsAndType = new Application.OwnerIdsAndType();
    ownerIdsAndType.ownerId(userId);
    ownerIdsAndType.ownerType("USER");
    List<Application.OwnerIdsAndType> ownerIdsAndTypes = new ArrayList<>();
    ownerIdsAndTypes.add(ownerIdsAndType);
    Map<String, String> citAliasIdMap = new HashMap<>();
    citAliasIdMap.put(cit.name(), cit.id());
    application.name(appName);
    application.ownerIdsAndTypes(ownerIdsAndTypes);
    application.certificateIssuingTemplateAliasIdMap(citAliasIdMap);
    cloud.createApplication(application, apiKey);
}
Also used : UserDetails(com.venafi.vcert.sdk.connectors.cloud.domain.UserDetails) Application(com.venafi.vcert.sdk.connectors.cloud.domain.Application)

Aggregations

UserDetails (com.venafi.vcert.sdk.connectors.cloud.domain.UserDetails)2 Application (com.venafi.vcert.sdk.connectors.cloud.domain.Application)1 Company (com.venafi.vcert.sdk.connectors.cloud.domain.Company)1 User (com.venafi.vcert.sdk.connectors.cloud.domain.User)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1