Search in sources :

Example 6 with JSONSerialisation

use of org.forgerock.openam.cts.utils.JSONSerialisation in project OpenAM by OpenRock.

the class OAuthAdapterTest method shouldNotDeserialiseATokenWhichDoesntContainAMap.

@Test
public void shouldNotDeserialiseATokenWhichDoesntContainAMap() {
    // Given
    JSONSerialisation serialisation = new JSONSerialisation(new ObjectMapper());
    OAuthAdapter adapter = generateOAuthAdapter();
    Token token = new Token("", TokenType.OAUTH);
    token.setBlob(serialisation.serialise("badger").getBytes());
    // When
    JsonValue fromToken = adapter.fromToken(token);
    // Then
    assertThat(fromToken).isNull();
}
Also used : JSONSerialisation(org.forgerock.openam.cts.utils.JSONSerialisation) JsonValue(org.forgerock.json.JsonValue) Token(org.forgerock.openam.cts.api.tokens.Token) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.testng.annotations.Test)

Aggregations

JSONSerialisation (org.forgerock.openam.cts.utils.JSONSerialisation)6 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 Token (org.forgerock.openam.cts.api.tokens.Token)4 Test (org.testng.annotations.Test)4 TokenIdFactory (org.forgerock.openam.cts.api.tokens.TokenIdFactory)3 TokenBlobUtils (org.forgerock.openam.cts.utils.blob.TokenBlobUtils)3 JsonValue (org.forgerock.json.JsonValue)2 InternalSession (com.iplanet.dpro.session.service.InternalSession)1 ArrayList (java.util.ArrayList)1 Calendar (java.util.Calendar)1 HashMap (java.util.HashMap)1 CoreTokenConfig (org.forgerock.openam.cts.CoreTokenConfig)1 OAuthTokenField (org.forgerock.openam.cts.api.fields.OAuthTokenField)1 SAMLToken (org.forgerock.openam.cts.api.tokens.SAMLToken)1 KeyConversion (org.forgerock.openam.cts.utils.KeyConversion)1 BeforeMethod (org.testng.annotations.BeforeMethod)1