Search in sources :

Example 11 with SAMLCredential

use of org.springframework.security.saml.SAMLCredential in project webcert by sklintyg.

the class ElegAuthenticationAttributeHelperTest method testReadUnknownAttribute.

@Test(expected = IllegalArgumentException.class)
public void testReadUnknownAttribute() {
    testee = new ElegAuthenticationAttributeHelperImpl();
    SAMLCredential cred = buildLandstingslakareSamlCredential();
    testee.getAttribute(cred, CgiElegAssertion.PERSON_ID_ATTRIBUTE);
}
Also used : SAMLCredential(org.springframework.security.saml.SAMLCredential) BaseSAMLCredentialTest(se.inera.intyg.webcert.web.auth.common.BaseSAMLCredentialTest) Test(org.junit.Test)

Example 12 with SAMLCredential

use of org.springframework.security.saml.SAMLCredential in project webcert by sklintyg.

the class ElegWebCertUserDetailsServiceTest method testLoginPUNotFoundThrowsException.

@Test
public void testLoginPUNotFoundThrowsException() {
    reset(puService);
    when(puService.getPerson(any(Personnummer.class))).thenReturn(buildPersonSvar(true, PersonSvar.Status.NOT_FOUND));
    thrown.expect(HsaServiceException.class);
    testee.loadUserBySAML(new SAMLCredential(mock(NameID.class), assertionPrivatlakare, REMOTE_ENTITY_ID, LOCAL_ENTITY_ID));
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) SAMLCredential(org.springframework.security.saml.SAMLCredential) BaseSAMLCredentialTest(se.inera.intyg.webcert.web.auth.common.BaseSAMLCredentialTest) Test(org.junit.Test)

Aggregations

SAMLCredential (org.springframework.security.saml.SAMLCredential)12 Test (org.junit.Test)8 BaseSAMLCredentialTest (se.inera.intyg.webcert.web.auth.common.BaseSAMLCredentialTest)8 NameID (org.opensaml.saml2.core.NameID)4 Personnummer (se.inera.intyg.schemas.contract.Personnummer)3 Assertion (org.opensaml.saml2.core.Assertion)2 AttributeStatement (org.opensaml.saml2.core.AttributeStatement)2 AssertionBuilder (org.opensaml.saml2.core.impl.AssertionBuilder)2 AttributeStatementBuilder (org.opensaml.saml2.core.impl.AttributeStatementBuilder)2 NameIDBuilder (org.opensaml.saml2.core.impl.NameIDBuilder)2 ExpiringUsernameAuthenticationToken (org.springframework.security.providers.ExpiringUsernameAuthenticationToken)2 WebCertUser (se.inera.intyg.webcert.web.service.user.dto.WebCertUser)2 BaseSakerhetstjanstAssertion (se.inera.intyg.infra.security.siths.BaseSakerhetstjanstAssertion)1 FakeCredentials (se.inera.intyg.webcert.web.auth.fake.FakeCredentials)1