use of com.microsoft.identity.common.internal.providers.oauth2.TokenResponse in project microsoft-authentication-library-common-for-android by AzureAD.
the class ObjectMapperTest method test_JsonToObjectMSResponseNumbersAndStuff.
// Here we're leaving off everything that isn't a string, for now.
@Test
public void test_JsonToObjectMSResponseNumbersAndStuff() {
TokenResponse tr = ObjectMapper.deserializeJsonStringToObject(JSON_TOKEN_REQUEST_OTHER_VALUE, TokenResponse.class);
Assert.assertEquals("idtokenval", tr.getIdToken());
final Iterator<Map.Entry<String, String>> iterator = tr.getExtraParameters().iterator();
Map.Entry<String, String> param = iterator.next();
Assert.assertEquals("client_id", param.getKey());
Assert.assertEquals(CLIENT_ID, param.getValue());
Assert.assertFalse(iterator.hasNext());
}
use of com.microsoft.identity.common.internal.providers.oauth2.TokenResponse in project microsoft-authentication-library-common-for-android by AzureAD.
the class ObjectMapperTest method test_JsonToObjectMSResponse.
@Test
public void test_JsonToObjectMSResponse() {
TokenResponse tr = ObjectMapper.deserializeJsonStringToObject(JSON_TOKEN_REQUEST, TokenResponse.class);
Assert.assertEquals("idtokenval", tr.getIdToken());
final Iterator<Map.Entry<String, String>> iterator = tr.getExtraParameters().iterator();
Map.Entry<String, String> param = iterator.next();
Assert.assertEquals("client_id", param.getKey());
Assert.assertEquals(CLIENT_ID, param.getValue());
param = iterator.next();
Assert.assertEquals("other_param", param.getKey());
Assert.assertEquals("other_value", param.getValue());
Assert.assertFalse(iterator.hasNext());
}
use of com.microsoft.identity.common.internal.providers.oauth2.TokenResponse in project microsoft-authentication-library-common-for-android by AzureAD.
the class ObjectMapperTest method test_JsonToObjectMSResponseArray.
@Test(expected = JsonParseException.class)
public void test_JsonToObjectMSResponseArray() {
TokenResponse tr = ObjectMapper.deserializeJsonStringToObject(JSON_TOKEN_REQUEST_ARRAY, TokenResponse.class);
Assert.assertEquals("idtokenval", tr.getIdToken());
final Iterator<Map.Entry<String, String>> iterator = tr.getExtraParameters().iterator();
Map.Entry<String, String> param = iterator.next();
Assert.assertEquals("client_id", param.getKey());
Assert.assertEquals(CLIENT_ID, param.getValue());
param = iterator.next();
Assert.assertEquals("other_param", param.getKey());
Assert.assertEquals("other_value", param.getValue());
Assert.assertFalse(iterator.hasNext());
}
use of com.microsoft.identity.common.internal.providers.oauth2.TokenResponse in project microsoft-authentication-library-common-for-android by AzureAD.
the class MockDelayedResponseStrategy method getTokenResult.
public TokenResult getTokenResult() {
final TokenResponse tokenResponse = MockTokenResponse.getMockSuccessTokenResponse();
final TokenResult tokenResult = new TokenResult(tokenResponse);
return tokenResult;
}
use of com.microsoft.identity.common.internal.providers.oauth2.TokenResponse in project microsoft-authentication-library-common-for-android by AzureAD.
the class MockDelayedResponseStrategy method performTokenRequest.
@Override
protected HttpResponse performTokenRequest(final MicrosoftStsTokenRequest tokenRequest) {
final TokenResult tokenResult = getTokenResult();
final TokenResponse tokenResponse = tokenResult.getTokenResponse();
try {
Thread.sleep(RESPONSE_DELAY);
} catch (InterruptedException e) {
e.printStackTrace();
}
final HttpResponse httpResponse = makeHttpResponseFromResponseObject(tokenResponse);
return httpResponse;
}
Aggregations