use of org.springframework.security.saml.SAMLCredential 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 org.springframework.security.saml.SAMLCredential in project webcert by sklintyg.
the class ElegWebCertUserDetailsServiceTest method testNotFoundInHSAThrowsException.
@Test
public void testNotFoundInHSAThrowsException() {
reset(ppService);
when(ppService.validatePrivatePractitioner(any(), any(), any())).thenReturn(true);
when(ppService.getPrivatePractitioner(any(), any(), any())).thenReturn(null);
thrown.expect(HsaServiceException.class);
testee.loadUserBySAML(new SAMLCredential(mock(NameID.class), assertionPrivatlakare, REMOTE_ENTITY_ID, LOCAL_ENTITY_ID));
}
use of org.springframework.security.saml.SAMLCredential in project webcert by sklintyg.
the class ElegWebCertUserDetailsServiceTest method testNotValidPrivatePractitionerThrowsException.
@Test
public void testNotValidPrivatePractitionerThrowsException() {
reset(ppService);
when(ppService.validatePrivatePractitioner(any(), any(), any())).thenReturn(false);
thrown.expect(PrivatePractitionerAuthorizationException.class);
testee.loadUserBySAML(new SAMLCredential(mock(NameID.class), assertionPrivatlakare, REMOTE_ENTITY_ID, LOCAL_ENTITY_ID));
}
use of org.springframework.security.saml.SAMLCredential in project webcert by sklintyg.
the class ElegWebCertUserDetailsServiceTest method testLoginPUErrorThrowsException.
@Test
public void testLoginPUErrorThrowsException() {
reset(puService);
when(puService.getPerson(any(Personnummer.class))).thenReturn(buildPersonSvar(true, PersonSvar.Status.ERROR));
thrown.expect(HsaServiceException.class);
testee.loadUserBySAML(new SAMLCredential(mock(NameID.class), assertionPrivatlakare, REMOTE_ENTITY_ID, LOCAL_ENTITY_ID));
}
use of org.springframework.security.saml.SAMLCredential 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());
}
Aggregations