Search in sources :

Example 1 with MicrosoftTokenResponse

use of com.microsoft.identity.common.internal.providers.microsoft.MicrosoftTokenResponse in project microsoft-authentication-library-common-for-android by AzureAD.

the class MockServerResponse method getMockTokenSuccessResponse.

public static HttpResponse getMockTokenSuccessResponse(final String localAccountId, final String tenant, final String issuer, final String rawClientInfo, final String accessToken) {
    final MicrosoftTokenResponse mockTokenResponse = new MicrosoftTokenResponse();
    mockTokenResponse.setTokenType("Bearer");
    mockTokenResponse.setScope("User.Read");
    mockTokenResponse.setExpiresIn(defaultTokenExpiryInSec);
    mockTokenResponse.setExtExpiresIn(defaultTokenExpiryInSec);
    mockTokenResponse.setAccessToken(accessToken);
    mockTokenResponse.setRefreshToken("6b80f5b5-d53c-4c46-992d-66c5dcd4cfb1");
    mockTokenResponse.setIdToken(MockTokenCreator.createMockIdTokenWithObjectIdTenantIdAndIssuer(localAccountId, tenant, issuer));
    mockTokenResponse.setClientInfo(rawClientInfo);
    final String mockResponse = ObjectMapper.serializeObjectToJsonString(mockTokenResponse);
    return new HttpResponse(200, mockResponse, new HashMap<>());
}
Also used : MicrosoftTokenResponse(com.microsoft.identity.common.internal.providers.microsoft.MicrosoftTokenResponse) HttpResponse(com.microsoft.identity.common.internal.net.HttpResponse)

Example 2 with MicrosoftTokenResponse

use of com.microsoft.identity.common.internal.providers.microsoft.MicrosoftTokenResponse in project microsoft-authentication-library-common-for-android by AzureAD.

the class MockServerResponse method getMockTokenSuccessResponse.

public static HttpResponse getMockTokenSuccessResponse() {
    final MicrosoftTokenResponse mockTokenResponse = new MicrosoftTokenResponse();
    mockTokenResponse.setTokenType("Bearer");
    mockTokenResponse.setScope("User.Read");
    mockTokenResponse.setExpiresIn(defaultTokenExpiryInSec);
    mockTokenResponse.setExtExpiresIn(defaultTokenExpiryInSec);
    mockTokenResponse.setAccessToken("b06d0810-12ff-4a4e-850b-4bda1540d895");
    mockTokenResponse.setRefreshToken("6b80f5b5-d53c-4c46-992d-66c5dcd4cfb1");
    mockTokenResponse.setIdToken(MockTokenCreator.createMockIdToken());
    mockTokenResponse.setClientInfo(MockTokenCreator.createMockRawClientInfo());
    final String mockResponse = ObjectMapper.serializeObjectToJsonString(mockTokenResponse);
    return new HttpResponse(200, mockResponse, new HashMap<>());
}
Also used : MicrosoftTokenResponse(com.microsoft.identity.common.internal.providers.microsoft.MicrosoftTokenResponse) HttpResponse(com.microsoft.identity.common.internal.net.HttpResponse)

Aggregations

HttpResponse (com.microsoft.identity.common.internal.net.HttpResponse)2 MicrosoftTokenResponse (com.microsoft.identity.common.internal.providers.microsoft.MicrosoftTokenResponse)2