Search in sources :

Example 11 with OathDeviceSettings

use of org.forgerock.openam.core.rest.devices.OathDeviceSettings in project OpenAM by OpenRock.

the class JsonConversionUtilsTest method shouldPerformRoundTripWithOathDeviceSettingsObject.

@Test
public void shouldPerformRoundTripWithOathDeviceSettingsObject() throws IOException {
    //Given
    OathDeviceSettings object = getOathDeviceSettingsObject("secret", "Device Name", 1431999532, 1, true, -1);
    //When
    JsonValue jsonValue = JsonConversionUtils.toJsonValue(object);
    OathDeviceSettings oathDeviceSettings = JsonConversionUtils.toOathDeviceSettingValue(jsonValue);
    //Then
    Assert.assertEquals(oathDeviceSettings, object, "Expected OathDeviceSettings objects to have same content.");
}
Also used : OathDeviceSettings(org.forgerock.openam.core.rest.devices.OathDeviceSettings) JsonValue(org.forgerock.json.JsonValue) Test(org.testng.annotations.Test)

Example 12 with OathDeviceSettings

use of org.forgerock.openam.core.rest.devices.OathDeviceSettings in project OpenAM by OpenRock.

the class JsonConversionUtilsTest method getOathDeviceSettingsObject.

private OathDeviceSettings getOathDeviceSettingsObject(String sharedSecret, String deviceName, long lastLogin, int counter, boolean checksumDigit, int truncationOffset) {
    OathDeviceSettings oathDeviceSettings = new OathDeviceSettings(sharedSecret, deviceName, lastLogin, counter);
    oathDeviceSettings.setChecksumDigit(checksumDigit);
    oathDeviceSettings.setTruncationOffset(truncationOffset);
    return oathDeviceSettings;
}
Also used : OathDeviceSettings(org.forgerock.openam.core.rest.devices.OathDeviceSettings)

Aggregations

OathDeviceSettings (org.forgerock.openam.core.rest.devices.OathDeviceSettings)12 Test (org.testng.annotations.Test)8 JsonValue (org.forgerock.json.JsonValue)3 InvalidPasswordException (com.sun.identity.authentication.spi.InvalidPasswordException)2 SSOException (com.iplanet.sso.SSOException)1 AuthLoginException (com.sun.identity.authentication.spi.AuthLoginException)1 IdRepoException (com.sun.identity.idm.IdRepoException)1 SMSException (com.sun.identity.sm.SMSException)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 NameCallback (javax.security.auth.callback.NameCallback)1 DecoderException (org.apache.commons.codec.DecoderException)1