use of com.okta.authn.sdk.resource.FactorType in project cerberus by Nike-Inc.
the class AbstractOktaStateHandlerTest method getDeviceNameGoogleTotp.
@Test
public void getDeviceNameGoogleTotp() {
FactorProvider provider = FactorProvider.GOOGLE;
FactorType type = FactorType.TOKEN_SOFTWARE_TOTP;
DefaultFactor factor = mock(DefaultFactor.class);
when(factor.getType()).thenReturn(type);
when(factor.getProvider()).thenReturn(provider);
String result = this.abstractOktaStateHandler.getDeviceName(factor);
assertEquals("Google Authenticator", result);
}
use of com.okta.authn.sdk.resource.FactorType in project cerberus by Nike-Inc.
the class AbstractOktaStateHandlerTest method getDeviceNameOktaPush.
@Test
public void getDeviceNameOktaPush() {
FactorProvider provider = FactorProvider.OKTA;
FactorType type = FactorType.PUSH;
DefaultFactor factor = mock(DefaultFactor.class);
when(factor.getType()).thenReturn(type);
when(factor.getProvider()).thenReturn(provider);
String result = this.abstractOktaStateHandler.getDeviceName(factor);
assertEquals("Okta Verify Push", result);
}
use of com.okta.authn.sdk.resource.FactorType in project cerberus by Nike-Inc.
the class AbstractOktaStateHandlerTest method getDeviceNameOktaCall.
@Test
public void getDeviceNameOktaCall() {
FactorProvider provider = FactorProvider.OKTA;
FactorType type = FactorType.CALL;
DefaultFactor factor = mock(DefaultFactor.class);
when(factor.getType()).thenReturn(type);
when(factor.getProvider()).thenReturn(provider);
String result = this.abstractOktaStateHandler.getDeviceName(factor);
assertEquals("Okta Voice Call", result);
}
use of com.okta.authn.sdk.resource.FactorType in project cerberus by Nike-Inc.
the class AbstractOktaStateHandlerTest method getDeviceNameOktaTotp.
@Test
public void getDeviceNameOktaTotp() {
FactorProvider provider = FactorProvider.OKTA;
FactorType type = FactorType.TOKEN_SOFTWARE_TOTP;
DefaultFactor factor = mock(DefaultFactor.class);
when(factor.getType()).thenReturn(type);
when(factor.getProvider()).thenReturn(provider);
String result = this.abstractOktaStateHandler.getDeviceName(factor);
assertEquals("Okta Verify TOTP", result);
}
use of com.okta.authn.sdk.resource.FactorType in project cerberus by Nike-Inc.
the class InitialLoginStateHandlerTest method handleMfaRequired.
// ///////////////////////
// Test Methods
// ///////////////////////
@Test
public void handleMfaRequired() throws Exception {
String email = "email";
String id = "id";
AuthStatus expectedStatus = AuthStatus.MFA_REQUIRED;
FactorProvider provider = FactorProvider.OKTA;
FactorType type = FactorType.TOKEN_SOFTWARE_TOTP;
String deviceId = "device id";
String status = "status";
AuthenticationResponse expectedResponse = mock(AuthenticationResponse.class);
User user = mock(User.class);
when(user.getId()).thenReturn(id);
when(user.getLogin()).thenReturn(email);
when(expectedResponse.getUser()).thenReturn(user);
DefaultFactor factor = mock(DefaultFactor.class);
when(factor.getType()).thenReturn(type);
when(factor.getProvider()).thenReturn(provider);
when(factor.getStatus()).thenReturn(status);
when(factor.getId()).thenReturn(deviceId);
when(expectedResponse.getFactors()).thenReturn(Lists.newArrayList(factor));
// do the call
initialLoginStateHandler.handleMfaRequired(expectedResponse);
AuthResponse actualResponse = authenticationResponseFuture.get(1, TimeUnit.SECONDS);
// verify results
assertEquals(id, actualResponse.getData().getUserId());
assertEquals(email, actualResponse.getData().getUsername());
assertEquals(expectedStatus, actualResponse.getStatus());
}
Aggregations