use of com.microsoft.identity.common.internal.providers.oauth2.AuthorizationResult in project microsoft-authentication-library-common-for-android by AzureAD.
the class MicrosoftStsAuthorizationResultFactoryTest method testUrlWithInvalidParams.
@Test
public void testUrlWithInvalidParams() {
Intent intent = new Intent();
intent.putExtra(AUTHORIZATION_FINAL_URL, REDIRECT_URI + "?some_random_error=accessdenied");
AuthorizationResult result = mAuthorizationResultFactory.createAuthorizationResult(AuthenticationConstants.UIResponse.BROWSER_CODE_COMPLETE, intent, getMstsAuthorizationRequest());
assertNotNull(result);
assertNull(result.getAuthorizationResponse());
assertEquals(AuthorizationStatus.FAIL, result.getAuthorizationStatus());
AuthorizationErrorResponse errorResponse = result.getAuthorizationErrorResponse();
assertNotNull(errorResponse);
assertEquals(MicrosoftAuthorizationErrorResponse.AUTHORIZATION_FAILED, errorResponse.getError());
assertEquals(MicrosoftAuthorizationErrorResponse.AUTHORIZATION_SERVER_INVALID_RESPONSE, errorResponse.getErrorDescription());
}
use of com.microsoft.identity.common.internal.providers.oauth2.AuthorizationResult in project microsoft-authentication-library-common-for-android by AzureAD.
the class AzureActiveDirectoryAuthorizationResultFactoryTest method testNullUrl.
@Test
public void testNullUrl() {
Intent intent = new Intent();
intent.putExtras(new Bundle());
AuthorizationResult result = mAuthorizationResultFactory.createAuthorizationResult(AuthenticationConstants.UIResponse.BROWSER_CODE_COMPLETE, intent, getAADRequest());
assertNotNull(result);
assertNull(result.getAuthorizationResponse());
assertEquals(AuthorizationStatus.FAIL, result.getAuthorizationStatus());
AuthorizationErrorResponse errorResponse = result.getAuthorizationErrorResponse();
assertNotNull(errorResponse);
assertEquals(MicrosoftAuthorizationErrorResponse.AUTHORIZATION_FAILED, errorResponse.getError());
assertEquals(MicrosoftAuthorizationErrorResponse.AUTHORIZATION_SERVER_INVALID_RESPONSE, errorResponse.getErrorDescription());
}
use of com.microsoft.identity.common.internal.providers.oauth2.AuthorizationResult in project microsoft-authentication-library-common-for-android by AzureAD.
the class AzureActiveDirectoryAuthorizationResultFactoryTest method testBrowserCodeError.
@Test
public void testBrowserCodeError() {
Intent intent = new Intent();
AuthorizationResult result = mAuthorizationResultFactory.createAuthorizationResult(AuthenticationConstants.UIResponse.BROWSER_CODE_ERROR, intent, getAADRequest());
assertNotNull(result);
assertNull(result.getAuthorizationResponse());
assertEquals(AuthorizationStatus.FAIL, result.getAuthorizationStatus());
assertNotNull(result.getAuthorizationErrorResponse());
}
use of com.microsoft.identity.common.internal.providers.oauth2.AuthorizationResult in project microsoft-authentication-library-common-for-android by AzureAD.
the class AzureActiveDirectoryAuthorizationResultFactoryTest method testBrowserCodeCancel.
@Test
public void testBrowserCodeCancel() {
Intent intent = new Intent();
intent.putExtras(new Bundle());
AuthorizationResult result = mAuthorizationResultFactory.createAuthorizationResult(AuthenticationConstants.UIResponse.BROWSER_CODE_CANCEL, intent, getAADRequest());
assertNotNull(result);
assertNull(result.getAuthorizationResponse());
assertEquals(AuthorizationStatus.USER_CANCEL, result.getAuthorizationStatus());
AuthorizationErrorResponse errorResponse = result.getAuthorizationErrorResponse();
assertNotNull(errorResponse);
assertEquals(MicrosoftAuthorizationErrorResponse.USER_CANCEL, errorResponse.getError());
assertEquals(MicrosoftAuthorizationErrorResponse.USER_CANCELLED_FLOW, errorResponse.getErrorDescription());
}
use of com.microsoft.identity.common.internal.providers.oauth2.AuthorizationResult in project microsoft-authentication-library-common-for-android by AzureAD.
the class AzureActiveDirectoryAuthorizationResultFactoryTest method testNoMatchingResultCode.
@Test
public void testNoMatchingResultCode() {
Intent intent = new Intent();
intent.putExtras(new Bundle());
AuthorizationResult result = mAuthorizationResultFactory.createAuthorizationResult(0, intent, getAADRequest());
assertNotNull(result);
assertNull(result.getAuthorizationResponse());
assertEquals(AuthorizationStatus.FAIL, result.getAuthorizationStatus());
AuthorizationErrorResponse errorResponse = result.getAuthorizationErrorResponse();
assertNotNull(errorResponse);
assertEquals(MicrosoftAuthorizationErrorResponse.UNKNOWN_ERROR, errorResponse.getError());
assertNotNull(errorResponse.getErrorDescription());
}
Aggregations