use of se.inera.intyg.infra.security.common.model.AuthenticationMethod in project webcert by sklintyg.
the class ElegAuthenticationMethodResolverTest method testMobiltBankID.
@Test
public void testMobiltBankID() {
when(elegAuthenticationAttributeHelper.getAttribute(any(SAMLCredential.class), anyString())).thenReturn(MOBILT_BANK_ID_LOGIN_METHOD);
AuthenticationMethod authMetod = testee.resolveAuthenticationMethod(buildPrivatlakareSamlCredential());
assertEquals(AuthenticationMethod.MOBILT_BANK_ID, authMetod);
}
use of se.inera.intyg.infra.security.common.model.AuthenticationMethod in project webcert by sklintyg.
the class CommonFakeAuthenticationProvider method applyAuthenticationMethod.
private void applyAuthenticationMethod(Authentication token, Object details) {
if (details instanceof IntygUser) {
if (token.getCredentials() != null && ((FakeCredentials) token.getCredentials()).getOrigin() != null) {
String authenticationMethod = ((FakeCredentials) token.getCredentials()).getAuthenticationMethod();
try {
if (authenticationMethod != null && !authenticationMethod.isEmpty()) {
IntygUser user = (IntygUser) details;
AuthenticationMethod newAuthMethod = AuthenticationMethod.valueOf(authenticationMethod);
user.setAuthenticationMethod(newAuthMethod);
}
} catch (IllegalArgumentException e) {
String allowedTypes = Arrays.asList(AuthenticationMethod.values()).stream().map(val -> val.name()).collect(Collectors.joining(", "));
throw new AuthoritiesException("Could not set authenticationMethod '" + authenticationMethod + "'. Unknown, allowed types are " + allowedTypes);
}
}
}
}
use of se.inera.intyg.infra.security.common.model.AuthenticationMethod in project webcert by sklintyg.
the class ElegAuthenticationMethodResolverTest method testNetID.
@Test
public void testNetID() {
when(elegAuthenticationAttributeHelper.getAttribute(any(SAMLCredential.class), anyString())).thenReturn(NET_ID_LOGIN_METHOD);
AuthenticationMethod authMetod = testee.resolveAuthenticationMethod(buildPrivatlakareSamlCredential());
assertEquals(AuthenticationMethod.NET_ID, authMetod);
}
use of se.inera.intyg.infra.security.common.model.AuthenticationMethod in project webcert by sklintyg.
the class ElegAuthenticationMethodResolverTest method testBankID.
@Test
public void testBankID() {
when(elegAuthenticationAttributeHelper.getAttribute(any(SAMLCredential.class), anyString())).thenReturn(BANK_ID_LOGIN_METHOD);
AuthenticationMethod authMetod = testee.resolveAuthenticationMethod(buildPrivatlakareSamlCredential());
assertEquals(AuthenticationMethod.BANK_ID, authMetod);
}
Aggregations