use of se.inera.intyg.webcert.web.service.user.dto.WebCertUser in project webcert by sklintyg.
the class TermsFilterTest method buildWebCertUser.
private WebCertUser buildWebCertUser(String authScheme) {
Role role = AUTHORITIES_RESOLVER.getRole(AuthoritiesConstants.ROLE_LAKARE);
WebCertUser webCertUser = new WebCertUser();
webCertUser.setRoles(AuthoritiesResolverUtil.toMap(role));
webCertUser.setAuthorities(AuthoritiesResolverUtil.toMap(role.getPrivileges(), Privilege::getName));
webCertUser.setAuthenticationScheme(authScheme);
return webCertUser;
}
use of se.inera.intyg.webcert.web.service.user.dto.WebCertUser in project webcert by sklintyg.
the class ElegWebCertUserDetailsServiceTest method testSuccessfulLoginSekretessMarkerad.
@Test
public void testSuccessfulLoginSekretessMarkerad() {
reset(puService);
when(puService.getPerson(any(Personnummer.class))).thenReturn(buildPersonSvar(true, PersonSvar.Status.FOUND));
WebCertUser user = (WebCertUser) testee.loadUserBySAML(new SAMLCredential(mock(NameID.class), assertionPrivatlakare, REMOTE_ENTITY_ID, LOCAL_ENTITY_ID));
assertNotNull(user);
assertTrue(user.isSekretessMarkerad());
// WEBCERT-2028
verify(avtalService, times(1)).userHasApprovedLatestAvtal(anyString());
}
use of se.inera.intyg.webcert.web.service.user.dto.WebCertUser in project webcert by sklintyg.
the class ElegWebCertUserDetailsServiceTest method testSuccessfulLogin.
@Test
public void testSuccessfulLogin() {
WebCertUser user = (WebCertUser) testee.loadUserBySAML(new SAMLCredential(mock(NameID.class), assertionPrivatlakare, REMOTE_ENTITY_ID, LOCAL_ENTITY_ID));
assertNotNull(user);
assertFalse(user.isSekretessMarkerad());
assertEquals(expectedPreferences, user.getAnvandarPreference());
// WEBCERT-2028
verify(avtalService, times(1)).userHasApprovedLatestAvtal(anyString());
}
use of se.inera.intyg.webcert.web.service.user.dto.WebCertUser in project webcert by sklintyg.
the class AuthoritiesValidatorTest method testMustHaveFeatureFail.
@Test
public void testMustHaveFeatureFail() {
WebCertUser user = createDefaultUser();
assertFalse(validator.given(user, "fk7263").features(AuthoritiesConstants.FEATURE_ARBETSGIVARUTSKRIFT).isVerified());
thrown.expect(AuthoritiesException.class);
validator.given(user, "fk7263").features(AuthoritiesConstants.FEATURE_ARBETSGIVARUTSKRIFT).orThrow();
}
use of se.inera.intyg.webcert.web.service.user.dto.WebCertUser in project webcert by sklintyg.
the class AuthoritiesValidatorTest method testMusthaveOrigin.
@Test
public void testMusthaveOrigin() {
WebCertUser user = createDefaultUser();
assertTrue(validator.given(user).origins(UserOriginType.NORMAL).isVerified());
}
Aggregations