Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ MSAL Wiki : https://github.com/AzureAD/microsoft-authentication-library-for-andr

vNext
----------
-[MINOR] Add suberror for network errors (#2218)

Version 5.8.2
----------
Expand Down
2 changes: 1 addition & 1 deletion common
Submodule common updated 43 files
+2 −2 ...piUtilities/src/main/com/microsoft/identity/labapi/utilities/authentication/LabApiAuthenticationClient.java
+8 −0 changelog.txt
+1 −2 common/src/main/java/com/microsoft/identity/common/internal/broker/BrokerResult.java
+2 −1 common/src/main/java/com/microsoft/identity/common/internal/migration/AdalMigrationAdapter.java
+1 −1 common/src/main/java/com/microsoft/identity/common/internal/result/AdalBrokerResultAdapter.java
+6 −6 common/src/main/java/com/microsoft/identity/common/internal/result/MsalBrokerResultAdapter.java
+36 −0 common/src/test/java/com/microsoft/identity/common/MsalCppOAuth2TokenCacheTest.java
+2 −2 ...on/src/test/java/com/microsoft/identity/common/internal/authorities/AzureActiveDirectoryAuthorityTests.java
+3 −13 common4j/src/main/com/microsoft/identity/common/java/authorities/Authority.java
+1 −2 common4j/src/main/com/microsoft/identity/common/java/authorities/AzureActiveDirectoryAuthority.java
+10 −1 common4j/src/main/com/microsoft/identity/common/java/cache/MsalCppOAuth2TokenCache.java
+7 −2 common4j/src/main/com/microsoft/identity/common/java/cache/MsalOAuth2TokenCache.java
+3 −9 common4j/src/main/com/microsoft/identity/common/java/commands/parameters/SilentTokenCommandParameters.java
+3 −3 common4j/src/main/com/microsoft/identity/common/java/controllers/ExceptionAdapter.java
+15 −2 common4j/src/main/com/microsoft/identity/common/java/exception/BaseException.java
+2 −1 common4j/src/main/com/microsoft/identity/common/java/exception/ClientException.java
+56 −0 common4j/src/main/com/microsoft/identity/common/java/exception/ConnectionError.kt
+7 −0 common4j/src/main/com/microsoft/identity/common/java/exception/IErrorInformation.java
+0 −18 common4j/src/main/com/microsoft/identity/common/java/exception/ServiceException.java
+6 −0 common4j/src/main/com/microsoft/identity/common/java/exception/TerminalException.java
+3 −12 ...crosoft/identity/common/java/nativeauth/commands/parameters/AcquireTokenNoFixedScopesCommandParameters.java
+13 −14 common4j/src/main/com/microsoft/identity/common/java/net/AbstractHttpClient.java
+21 −24 common4j/src/main/com/microsoft/identity/common/java/net/HttpClient.java
+4 −3 common4j/src/main/com/microsoft/identity/common/java/net/IRetryPolicy.java
+3 −1 common4j/src/main/com/microsoft/identity/common/java/net/NoRetryPolicy.java
+4 −3 common4j/src/main/com/microsoft/identity/common/java/net/StatusCodeAndExceptionRetry.java
+41 −37 common4j/src/main/com/microsoft/identity/common/java/net/UrlConnectionHttpClient.java
+2 −0 common4j/src/main/com/microsoft/identity/common/java/opentelemetry/SpanName.java
+15 −8 .../main/com/microsoft/identity/common/java/providers/microsoft/azureactivedirectory/AzureActiveDirectory.java
+1 −1 common4j/src/main/com/microsoft/identity/common/java/providers/oauth2/OAuth2Strategy.java
+3 −1 common4j/src/main/com/microsoft/identity/common/java/providers/oauth2/OpenIdProviderConfigurationClient.java
+19 −0 common4j/src/main/com/microsoft/identity/common/java/util/UrlUtil.java
+2 −0 common4j/src/test/com/microsoft/identity/common/java/net/HttpUrlConnectionFactoryTest.java
+29 −27 common4j/src/test/com/microsoft/identity/common/java/net/UrlConnectionHttpClientTest.java
+2 −1 common4j/src/testFixtures/java/com/microsoft/identity/http/HttpRequestExaminer.java
+3 −2 common4j/src/testFixtures/java/com/microsoft/identity/http/HttpRequestInterceptor.java
+2 −1 common4j/src/testFixtures/java/com/microsoft/identity/http/HttpRequestRewriter.java
+2 −1 common4j/src/testFixtures/java/com/microsoft/identity/http/HttpResponseRewriter.java
+2 −1 common4j/src/testFixtures/java/com/microsoft/identity/http/InterceptedHttpClient.java
+4 −3 common4j/src/testFixtures/java/com/microsoft/identity/http/MockHttpClient.java
+10 −9 common4j/src/testFixtures/java/com/microsoft/identity/shadow/ShadowHttpClient.java
+1 −1 common4j/versioning/version.properties
+1 −1 versioning/version.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1647,7 +1647,7 @@ private MsalException baseExceptionToMsalException(@NonNull final BaseException
);
}

return new MsalClientException(exception.getErrorCode(), exception.getMessage());
return MsalExceptionAdapter.msalExceptionFromBaseException(exception);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ public final class MsalUiRequiredException extends MsalException {
*/
public static final String NO_ACCOUNT_FOUND = ErrorStrings.NO_ACCOUNT_FOUND;

@Getter
@Accessors(prefix = "m")
@Nullable
private String mOauthSubErrorCode;
public String getOauthSubErrorCode(){
return super.getSubErrorCode();
}

/**
* Constructor of MsalUiRequiredException.
Expand Down Expand Up @@ -90,15 +89,4 @@ public MsalUiRequiredException(final String errorCode, final String errorMessage
public MsalUiRequiredException(final String errorCode, final String errorMessage, final Throwable throwable) {
super(errorCode, errorMessage, throwable);
}

/**
* Constructor of MsalUiRequiredException.
* @param errorCode String
* @param oauthSubErrorCode String
* @param errorMessage String
*/
public MsalUiRequiredException(final String errorCode, @Nullable final String oauthSubErrorCode, final String errorMessage) {
super(errorCode, errorMessage);
mOauthSubErrorCode = oauthSubErrorCode;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
public class MsalExceptionAdapter {

public static MsalException msalExceptionFromBaseException(final BaseException e) {
final MsalException result = msalExceptionFromBaseExceptionInternal(e);
result.setSubErrorCode(e.getSubErrorCode());
return result;
}

private static MsalException msalExceptionFromBaseExceptionInternal(final BaseException e) {
if (e instanceof MsalException) {
return (MsalException) e;
}
Expand Down Expand Up @@ -69,8 +75,8 @@ public static MsalException msalExceptionFromBaseException(final BaseException e
final UiRequiredException uiRequiredException = ((UiRequiredException) e);
return new MsalUiRequiredException(
uiRequiredException.getErrorCode(),
uiRequiredException.getOAuthSubErrorCode(),
uiRequiredException.getMessage()
uiRequiredException.getMessage(),
uiRequiredException
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ public HttpResponse performIntercept(
@NonNull HttpClient.HttpMethod httpMethod,
@NonNull URL requestUrl,
@NonNull Map<String, String> requestHeaders,
@Nullable byte[] requestContent) throws IOException {
throw new IOException("Sending requests to server has been disabled for mocked unit tests");
@Nullable byte[] requestContent) throws ClientException {
throw new ClientException("Sending requests to server has been disabled for mocked unit tests");
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import com.microsoft.identity.common.java.eststelemetry.PublicApiId;
import com.microsoft.identity.common.java.eststelemetry.EstsTelemetry;
import com.microsoft.identity.common.java.eststelemetry.SchemaConstants;
import com.microsoft.identity.common.java.exception.ClientException;
import com.microsoft.identity.common.java.net.HttpClient;
import com.microsoft.identity.common.java.net.HttpResponse;
import com.microsoft.identity.http.HttpRequestInterceptor;
Expand Down Expand Up @@ -110,7 +111,7 @@ public HttpResponse performIntercept(
@NonNull HttpClient.HttpMethod httpMethod,
@NonNull URL requestUrl,
@NonNull Map<String, String> requestHeaders,
@Nullable byte[] requestContent) throws IOException {
@Nullable byte[] requestContent) throws ClientException {
final String correlationId = requestHeaders.get("client-request-id");

AcquireTokenMockedTelemetryTest.addCorrelationId(correlationId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.microsoft.identity.client.claims.ClaimsRequest;
import com.microsoft.identity.client.e2e.shadows.ShadowMockAuthority;
import com.microsoft.identity.client.e2e.shadows.ShadowOpenIdProviderConfigurationClient;
import com.microsoft.identity.common.java.exception.ClientException;
import com.microsoft.identity.common.java.net.HttpClient;
import com.microsoft.identity.common.java.net.HttpResponse;
import com.microsoft.identity.http.HttpRequestInterceptor;
Expand Down Expand Up @@ -83,8 +84,8 @@ public HttpResponse performIntercept(
@NonNull HttpClient.HttpMethod httpMethod,
@NonNull URL requestUrl,
@NonNull Map<String, String> requestHeaders,
@Nullable byte[] requestContent) throws IOException {
throw new IOException("Sending requests to server has been disabled for mocked unit tests");
@Nullable byte[] requestContent) throws ClientException {
throw new ClientException("Sending requests to server has been disabled for mocked unit tests");
}
});

Expand Down
Loading