Search in sources :

Example 1 with AzureActiveDirectoryAuthorizationErrorResponse

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

the class AzureActiveDirectoryAuthorizationResultFactoryTest method testUrlWithError.

@Test
public void testUrlWithError() {
    Intent intent = new Intent();
    Bundle bundle = new Bundle();
    String responseUrl = REDIRECT_URI + "?error=" + ERROR_MESSAGE + "&error_description=" + ERROR_DESCRIPTION + "&error_codes=" + ERROR_CODES;
    bundle.putString(AuthenticationConstants.Browser.RESPONSE_FINAL_URL, responseUrl);
    intent.putExtras(bundle);
    AzureActiveDirectoryAuthorizationResult result = mAuthorizationResultFactory.createAuthorizationResult(AuthenticationConstants.UIResponse.BROWSER_CODE_COMPLETE, intent, getAADRequest());
    assertNotNull(result);
    assertNull(result.getAuthorizationResponse());
    assertEquals(AuthorizationStatus.FAIL, result.getAuthorizationStatus());
    AzureActiveDirectoryAuthorizationErrorResponse errorResponse = result.getAuthorizationErrorResponse();
    assertNotNull(errorResponse);
    assertEquals(ERROR_MESSAGE, errorResponse.getError());
    assertEquals(ERROR_DESCRIPTION, errorResponse.getErrorDescription());
    assertEquals(ERROR_CODES, errorResponse.getErrorCodes());
}
Also used : AzureActiveDirectoryAuthorizationResult(com.microsoft.identity.common.internal.providers.microsoft.azureactivedirectory.AzureActiveDirectoryAuthorizationResult) AzureActiveDirectoryAuthorizationErrorResponse(com.microsoft.identity.common.internal.providers.microsoft.azureactivedirectory.AzureActiveDirectoryAuthorizationErrorResponse) Bundle(android.os.Bundle) Intent(android.content.Intent) Test(org.junit.Test)

Aggregations

Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 AzureActiveDirectoryAuthorizationErrorResponse (com.microsoft.identity.common.internal.providers.microsoft.azureactivedirectory.AzureActiveDirectoryAuthorizationErrorResponse)1 AzureActiveDirectoryAuthorizationResult (com.microsoft.identity.common.internal.providers.microsoft.azureactivedirectory.AzureActiveDirectoryAuthorizationResult)1 Test (org.junit.Test)1