Search in sources :

Example 1 with RequestOrigin

use of se.inera.intyg.infra.security.common.model.RequestOrigin in project webcert by sklintyg.

the class BaseCreateDraftCertificateValidatorTest method createPrivilege.

protected Privilege createPrivilege(String privilege, List<String> intygstyper) {
    Privilege priv = new Privilege();
    priv.setName(privilege);
    RequestOrigin requestOrigin = new RequestOrigin();
    requestOrigin.setName(UserOriginType.DJUPINTEGRATION.name());
    requestOrigin.setIntygstyper(intygstyper);
    priv.setRequestOrigins(Arrays.asList(requestOrigin));
    priv.setIntygstyper(intygstyper);
    return priv;
}
Also used : RequestOrigin(se.inera.intyg.infra.security.common.model.RequestOrigin) Privilege(se.inera.intyg.infra.security.common.model.Privilege)

Example 2 with RequestOrigin

use of se.inera.intyg.infra.security.common.model.RequestOrigin in project webcert by sklintyg.

the class AuthoritiesValidatorTest method createRequestOrigin.

private RequestOrigin createRequestOrigin(String name, List<String> intygstyper) {
    RequestOrigin o = new RequestOrigin();
    o.setName(name);
    o.setIntygstyper(intygstyper);
    return o;
}
Also used : RequestOrigin(se.inera.intyg.infra.security.common.model.RequestOrigin)

Example 3 with RequestOrigin

use of se.inera.intyg.infra.security.common.model.RequestOrigin in project webcert by sklintyg.

the class SecurityConfigurationLoaderTest method loadConfigurationAndAssertTypeOfObjects.

@Test
public void loadConfigurationAndAssertTypeOfObjects() {
    AuthoritiesConfiguration configuration = loader.getAuthoritiesConfiguration();
    assertEquals(4, configuration.getRequestOrigins().size());
    assertEquals(9, configuration.getPrivileges().size());
    assertEquals(4, configuration.getRoles().size());
    assertEquals(2, configuration.getTitles().size());
    assertEquals(4, configuration.getTitleCodes().size());
    // Assert that lists are of specific types
    try {
        List<RequestOrigin> requestOrigins = (List<RequestOrigin>) configuration.getRequestOrigins();
        List<Privilege> privileges = (List<Privilege>) configuration.getPrivileges();
        List<Role> roles = (List<Role>) configuration.getRoles();
        List<Title> titles = (List<Title>) configuration.getTitles();
        List<TitleCode> titleCodes = (List<TitleCode>) configuration.getTitleCodes();
    } catch (Exception e) {
        fail(e.getMessage());
    }
}
Also used : RequestOrigin(se.inera.intyg.infra.security.common.model.RequestOrigin) Title(se.inera.intyg.infra.security.common.model.Title) AuthoritiesConfiguration(se.inera.intyg.infra.security.authorities.AuthoritiesConfiguration) IOException(java.io.IOException) Role(se.inera.intyg.infra.security.common.model.Role) TitleCode(se.inera.intyg.infra.security.common.model.TitleCode) List(java.util.List) Privilege(se.inera.intyg.infra.security.common.model.Privilege) Test(org.junit.Test)

Example 4 with RequestOrigin

use of se.inera.intyg.infra.security.common.model.RequestOrigin in project webcert by sklintyg.

the class UtkastApiControllerTest method setupUser.

private void setupUser(String privilegeString, String intygType, String... features) {
    WebCertUser user = new WebCertUser();
    user.setAuthorities(new HashMap<>());
    user.getFeatures().putAll(Stream.of(features).collect(Collectors.toMap(Function.identity(), s -> {
        Feature feature = new Feature();
        feature.setName(s);
        feature.setIntygstyper(Arrays.asList(intygType));
        feature.setGlobal(true);
        return feature;
    })));
    Privilege privilege = new Privilege();
    privilege.setIntygstyper(Arrays.asList(intygType));
    RequestOrigin requestOrigin = new RequestOrigin();
    requestOrigin.setName("NORMAL");
    requestOrigin.setIntygstyper(privilege.getIntygstyper());
    privilege.setRequestOrigins(Arrays.asList(requestOrigin));
    user.getAuthorities().put(privilegeString, privilege);
    user.setOrigin("NORMAL");
    user.setValdVardenhet(buildVardenhet());
    user.setValdVardgivare(buildVardgivare());
    when(webcertUserService.getUser()).thenReturn(user);
}
Also used : RequestOrigin(se.inera.intyg.infra.security.common.model.RequestOrigin) Privilege(se.inera.intyg.infra.security.common.model.Privilege) Feature(se.inera.intyg.infra.security.common.model.Feature) WebCertUser(se.inera.intyg.webcert.web.service.user.dto.WebCertUser)

Example 5 with RequestOrigin

use of se.inera.intyg.infra.security.common.model.RequestOrigin in project webcert by sklintyg.

the class IntygIntegrationControllerTest method createRequestOrigin.

private RequestOrigin createRequestOrigin(String name, List<String> intygstyper) {
    RequestOrigin o = new RequestOrigin();
    o.setName(name);
    o.setIntygstyper(intygstyper);
    return o;
}
Also used : RequestOrigin(se.inera.intyg.infra.security.common.model.RequestOrigin)

Aggregations

RequestOrigin (se.inera.intyg.infra.security.common.model.RequestOrigin)12 Privilege (se.inera.intyg.infra.security.common.model.Privilege)8 WebCertUser (se.inera.intyg.webcert.web.service.user.dto.WebCertUser)3 Feature (se.inera.intyg.infra.security.common.model.Feature)2 IntegrationParameters (se.inera.intyg.webcert.web.web.controller.integration.dto.IntegrationParameters)2 IOException (java.io.IOException)1 List (java.util.List)1 Test (org.junit.Test)1 AuthoritiesConfiguration (se.inera.intyg.infra.security.authorities.AuthoritiesConfiguration)1 Role (se.inera.intyg.infra.security.common.model.Role)1 Title (se.inera.intyg.infra.security.common.model.Title)1 TitleCode (se.inera.intyg.infra.security.common.model.TitleCode)1