Search in sources :

Example 1 with IntegrationType

use of com.epam.ta.reportportal.entity.integration.IntegrationType in project commons-dao by reportportal.

the class IntegrationRepositoryTest method shouldFindAllGlobalByIntegrationType.

@Test
void shouldFindAllGlobalByIntegrationType() {
    IntegrationType integrationType = integrationTypeRepository.findById(2L).get();
    List<Integration> globalEmailIntegrations = integrationRepository.findAllGlobalByType(integrationType);
    assertNotNull(globalEmailIntegrations);
    assertEquals(GLOBAL_EMAIL_INTEGRATIONS_COUNT, globalEmailIntegrations.size());
    globalEmailIntegrations.forEach(i -> assertNull(i.getProject()));
}
Also used : Integration(com.epam.ta.reportportal.entity.integration.Integration) IntegrationType(com.epam.ta.reportportal.entity.integration.IntegrationType) BaseTest(com.epam.ta.reportportal.BaseTest) Test(org.junit.jupiter.api.Test)

Example 2 with IntegrationType

use of com.epam.ta.reportportal.entity.integration.IntegrationType in project service-authorization by reportportal.

the class CreateAuthIntegrationHandlerImpl method createAuthIntegration.

@Override
public AbstractAuthResource createAuthIntegration(AuthIntegrationType type, UpdateAuthRQ request, ReportPortalUser user) {
    final IntegrationType integrationType = getIntegrationType(type);
    final AuthIntegrationStrategy authIntegrationStrategy = getAuthStragegy(type);
    final Integration integration = authIntegrationStrategy.createIntegration(integrationType, request, user.getUsername());
    return type.getToResourceMapper().apply(integration);
}
Also used : Integration(com.epam.ta.reportportal.entity.integration.Integration) AuthIntegrationStrategy(com.epam.reportportal.auth.integration.handler.impl.strategy.AuthIntegrationStrategy) AuthIntegrationType(com.epam.reportportal.auth.integration.AuthIntegrationType) IntegrationType(com.epam.ta.reportportal.entity.integration.IntegrationType)

Example 3 with IntegrationType

use of com.epam.ta.reportportal.entity.integration.IntegrationType in project service-authorization by reportportal.

the class CreateAuthIntegrationHandlerImpl method updateAuthIntegration.

@Override
public AbstractAuthResource updateAuthIntegration(AuthIntegrationType type, Long integrationId, UpdateAuthRQ request, ReportPortalUser user) {
    final IntegrationType integrationType = getIntegrationType(type);
    final AuthIntegrationStrategy authIntegrationStrategy = getAuthStragegy(type);
    final Integration integration = authIntegrationStrategy.updateIntegration(integrationType, integrationId, request);
    return type.getToResourceMapper().apply(integration);
}
Also used : Integration(com.epam.ta.reportportal.entity.integration.Integration) AuthIntegrationStrategy(com.epam.reportportal.auth.integration.handler.impl.strategy.AuthIntegrationStrategy) AuthIntegrationType(com.epam.reportportal.auth.integration.AuthIntegrationType) IntegrationType(com.epam.ta.reportportal.entity.integration.IntegrationType)

Example 4 with IntegrationType

use of com.epam.ta.reportportal.entity.integration.IntegrationType in project service-authorization by reportportal.

the class GetActiveDirectoryStrategy method getIntegration.

@Override
public ActiveDirectoryResource getIntegration() {
    IntegrationType adIntegrationType = integrationTypeRepository.findByName(AuthIntegrationType.ACTIVE_DIRECTORY.getName()).orElseThrow(() -> new ReportPortalException(ErrorType.AUTH_INTEGRATION_NOT_FOUND, AuthIntegrationType.ACTIVE_DIRECTORY.getName()));
    // or else empty integration with default 'enabled = false' flag
    ActiveDirectoryResource adResource = ActiveDirectoryConverter.TO_RESOURCE.apply(integrationRepository.findByNameAndTypeIdAndProjectIdIsNull(AuthIntegrationType.ACTIVE_DIRECTORY.getName(), adIntegrationType.getId()).orElseGet(Integration::new));
    adResource.setType(adIntegrationType.getName());
    return adResource;
}
Also used : ActiveDirectoryResource(com.epam.ta.reportportal.ws.model.integration.auth.ActiveDirectoryResource) ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) AuthIntegrationType(com.epam.reportportal.auth.integration.AuthIntegrationType) IntegrationType(com.epam.ta.reportportal.entity.integration.IntegrationType)

Example 5 with IntegrationType

use of com.epam.ta.reportportal.entity.integration.IntegrationType in project service-authorization by reportportal.

the class SamlProvidersReloadEventHandler method onApplicationEvent.

@Override
public void onApplicationEvent(SamlProvidersReloadEvent event) {
    final IntegrationType integrationType = event.getIntegrationType();
    final List<Integration> integrations = integrationRepository.findAllGlobalByType(integrationType);
    LocalServiceProviderConfiguration serviceProvider = samlConfiguration.getServiceProvider();
    serviceProvider.getProviders().clear();
    serviceProvider.getProviders().addAll(SamlConverter.TO_EXTERNAL_PROVIDER_CONFIG.apply(integrations));
}
Also used : Integration(com.epam.ta.reportportal.entity.integration.Integration) LocalServiceProviderConfiguration(org.springframework.security.saml.provider.service.config.LocalServiceProviderConfiguration) IntegrationType(com.epam.ta.reportportal.entity.integration.IntegrationType)

Aggregations

IntegrationType (com.epam.ta.reportportal.entity.integration.IntegrationType)13 Integration (com.epam.ta.reportportal.entity.integration.Integration)8 AuthIntegrationType (com.epam.reportportal.auth.integration.AuthIntegrationType)6 BaseTest (com.epam.ta.reportportal.BaseTest)5 Test (org.junit.jupiter.api.Test)5 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)4 AuthIntegrationStrategy (com.epam.reportportal.auth.integration.handler.impl.strategy.AuthIntegrationStrategy)2 AbstractUserReplicator (com.epam.reportportal.auth.integration.AbstractUserReplicator)1 SamlParameter (com.epam.reportportal.auth.integration.parameter.SamlParameter)1 CROP_DOMAIN (com.epam.reportportal.auth.util.AuthUtils.CROP_DOMAIN)1 ContentTypeResolver (com.epam.reportportal.commons.ContentTypeResolver)1 UserBinaryDataService (com.epam.ta.reportportal.binary.UserBinaryDataService)1 IntegrationRepository (com.epam.ta.reportportal.dao.IntegrationRepository)1 IntegrationTypeRepository (com.epam.ta.reportportal.dao.IntegrationTypeRepository)1 ProjectRepository (com.epam.ta.reportportal.dao.ProjectRepository)1 UserRepository (com.epam.ta.reportportal.dao.UserRepository)1 IntegrationTypeDetails (com.epam.ta.reportportal.entity.integration.IntegrationTypeDetails)1 Project (com.epam.ta.reportportal.entity.project.Project)1 User (com.epam.ta.reportportal.entity.user.User)1 UserRole (com.epam.ta.reportportal.entity.user.UserRole)1