use of se.inera.intyg.infra.security.common.model.Role in project webcert by sklintyg.
the class TakServiceImplTest method createUser.
private IntygUser createUser(String roleName, Privilege p, Map<String, Feature> features, String origin) {
IntygUser user = new IntygUser(HSAID_OK);
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;
}
use of se.inera.intyg.infra.security.common.model.Role in project webcert by sklintyg.
the class IntygServiceRevokeTest method buildWebCertUser.
private WebCertUser buildWebCertUser(HoSPersonal person) {
Role role = AUTHORITIES_RESOLVER.getRole(AuthoritiesConstants.ROLE_LAKARE);
WebCertUser user = new WebCertUser();
user.setRoles(AuthoritiesResolverUtil.toMap(role));
user.setOrigin(UserOriginType.DJUPINTEGRATION.name());
user.setParameters(new IntegrationParameters(USER_REFERENCE, "", "", "", "", "", "", "", "", false, false, false, true));
user.setAuthorities(AuthoritiesResolverUtil.toMap(role.getPrivileges(), Privilege::getName));
user.setNamn(person.getFullstandigtNamn());
user.setHsaId(person.getPersonId());
return user;
}
use of se.inera.intyg.infra.security.common.model.Role in project webcert by sklintyg.
the class IntygServiceSendTest method createUser.
private WebCertUser createUser() {
Role role = AUTHORITIES_RESOLVER.getRole(AuthoritiesConstants.ROLE_LAKARE);
WebCertUser user = new WebCertUser();
user.setOrigin(UserOriginType.DJUPINTEGRATION.name());
user.setParameters(new IntegrationParameters("", "", "", "", "", "", "", "", "", false, false, false, true));
user.setRoles(AuthoritiesResolverUtil.toMap(role));
user.setAuthorities(AuthoritiesResolverUtil.toMap(role.getPrivileges(), Privilege::getName));
return user;
}
use of se.inera.intyg.infra.security.common.model.Role in project webcert by sklintyg.
the class LogServiceImplTest method createUser.
private WebCertUser createUser() {
Role role = AUTHORITIES_RESOLVER.getRole(AuthoritiesConstants.ROLE_LAKARE);
Vardenhet ve = new Vardenhet("VARDENHET_ID", "Vårdenheten");
Vardgivare vg = new Vardgivare("VARDGIVARE_ID", "Vårdgivaren");
vg.setVardenheter(Collections.singletonList(ve));
WebCertUser user = new WebCertUser();
user.setRoles(AuthoritiesResolverUtil.toMap(role));
user.setAuthorities(AuthoritiesResolverUtil.toMap(role.getPrivileges(), Privilege::getName));
user.setHsaId("HSAID");
user.setNamn("Markus Gran");
user.setVardgivare(Collections.singletonList(vg));
user.changeValdVardenhet("VARDENHET_ID");
user.setTitel("Överläkare");
user.setMiuNamnPerEnhetsId(buildMiUMap());
return user;
}
use of se.inera.intyg.infra.security.common.model.Role in project webcert by sklintyg.
the class GrpCollectPollerTest method buildAuthentication.
private SecurityContext buildAuthentication() {
Role role = AUTHORITIES_RESOLVER.getRole(AuthoritiesConstants.ROLE_LAKARE);
WebCertUser user = new WebCertUser();
user.setRoles(AuthoritiesResolverUtil.toMap(role));
user.setAuthorities(AuthoritiesResolverUtil.toMap(role.getPrivileges(), Privilege::getName));
user.setPersonId(PERSON_ID);
Authentication authentication = new TestingAuthenticationToken(user, null);
SecurityContext securityContext = new SecurityContextImpl();
securityContext.setAuthentication(authentication);
return securityContext;
}
Aggregations