Search in sources :

Example 1 with LdapResource

use of com.epam.ta.reportportal.ws.model.integration.auth.LdapResource in project service-authorization by reportportal.

the class GetLdapStrategy method getIntegration.

@Override
public AbstractLdapResource getIntegration() {
    IntegrationType ldapIntegrationType = integrationTypeRepository.findByName(AuthIntegrationType.LDAP.getName()).orElseThrow(() -> new ReportPortalException(ErrorType.AUTH_INTEGRATION_NOT_FOUND, AuthIntegrationType.LDAP.getName()));
    // or else empty integration with default 'enabled = false' flag
    LdapResource ldapResource = LdapConverter.TO_RESOURCE.apply(integrationRepository.findByNameAndTypeIdAndProjectIdIsNull(AuthIntegrationType.LDAP.getName(), ldapIntegrationType.getId()).orElseGet(Integration::new));
    ldapResource.setType(ldapIntegrationType.getName());
    return ldapResource;
}
Also used : ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) AbstractLdapResource(com.epam.ta.reportportal.ws.model.integration.auth.AbstractLdapResource) LdapResource(com.epam.ta.reportportal.ws.model.integration.auth.LdapResource) 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 AbstractLdapResource (com.epam.ta.reportportal.ws.model.integration.auth.AbstractLdapResource)1 LdapResource (com.epam.ta.reportportal.ws.model.integration.auth.LdapResource)1