Search in sources :

Example 1 with ActiveDirectoryResource

use of com.epam.ta.reportportal.ws.model.integration.auth.ActiveDirectoryResource 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)

Aggregations

AuthIntegrationType (com.epam.reportportal.auth.integration.AuthIntegrationType)1 IntegrationType (com.epam.ta.reportportal.entity.integration.IntegrationType)1 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)1 ActiveDirectoryResource (com.epam.ta.reportportal.ws.model.integration.auth.ActiveDirectoryResource)1