Search in sources :

Example 1 with Privilege

use of se.inera.intyg.infra.security.common.model.Privilege 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 Privilege

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

the class AuthoritiesValidatorTest method createPrivilege.

private Privilege createPrivilege(String name, List<String> intygsTyper, List<RequestOrigin> requestOrigins) {
    Privilege p = new Privilege();
    p.setName(name);
    p.setIntygstyper(intygsTyper);
    p.setRequestOrigins(requestOrigins);
    return p;
}
Also used : Privilege(se.inera.intyg.infra.security.common.model.Privilege)

Example 3 with Privilege

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

the class AuthoritiesValidatorTest method createUser.

private WebCertUser createUser(String roleName, Privilege p, Map<String, Feature> features, String origin) {
    WebCertUser user = new WebCertUser();
    HashMap<String, Privilege> pMap = new HashMap<>();
    pMap.put(p.getName(), p);
    user.setAuthorities(pMap);
    user.setOrigin(origin);
    user.setFeatures(features);
    HashMap<String, Role> rMap = new HashMap<>();
    Role role = new Role();
    role.setName(roleName);
    rMap.put(roleName, role);
    user.setRoles(rMap);
    return user;
}
Also used : Role(se.inera.intyg.infra.security.common.model.Role) HashMap(java.util.HashMap) Privilege(se.inera.intyg.infra.security.common.model.Privilege) WebCertUser(se.inera.intyg.webcert.web.service.user.dto.WebCertUser)

Example 4 with Privilege

use of se.inera.intyg.infra.security.common.model.Privilege 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 5 with Privilege

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

the class TakServiceImplTest method createPrivilege.

private Privilege createPrivilege(String name, List<String> intygsTyper, List<RequestOrigin> requestOrigins) {
    Privilege p = new Privilege();
    p.setName(name);
    p.setIntygstyper(intygsTyper);
    p.setRequestOrigins(requestOrigins);
    return p;
}
Also used : Privilege(se.inera.intyg.infra.security.common.model.Privilege)

Aggregations

Privilege (se.inera.intyg.infra.security.common.model.Privilege)17 RequestOrigin (se.inera.intyg.infra.security.common.model.RequestOrigin)8 WebCertUser (se.inera.intyg.webcert.web.service.user.dto.WebCertUser)7 Role (se.inera.intyg.infra.security.common.model.Role)5 HashMap (java.util.HashMap)4 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)3 IntegrationParameters (se.inera.intyg.webcert.web.web.controller.integration.dto.IntegrationParameters)3 Test (org.junit.Test)2 Feature (se.inera.intyg.infra.security.common.model.Feature)2 IOException (java.io.IOException)1 List (java.util.List)1 Vardenhet (se.inera.intyg.infra.integration.hsa.model.Vardenhet)1 Vardgivare (se.inera.intyg.infra.integration.hsa.model.Vardgivare)1 AuthoritiesConfiguration (se.inera.intyg.infra.security.authorities.AuthoritiesConfiguration)1 IntygUser (se.inera.intyg.infra.security.common.model.IntygUser)1 Title (se.inera.intyg.infra.security.common.model.Title)1 TitleCode (se.inera.intyg.infra.security.common.model.TitleCode)1 Personnummer (se.inera.intyg.schemas.contract.Personnummer)1 PrepareRedirectToIntyg (se.inera.intyg.webcert.web.web.controller.integration.dto.PrepareRedirectToIntyg)1