Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Base64 away from Msebera #1812

Merged
merged 7 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,4 @@ public static String createHash(String msg) throws NoSuchAlgorithmException,
UnsupportedEncodingException {
return com.microsoft.identity.common.adal.internal.util.StringExtensions.createHash(msg);
}

public static String encodeBase64URLSafeString(final byte[] bytes)
throws UnsupportedEncodingException {
return com.microsoft.identity.common.adal.internal.util.StringExtensions.encodeBase64URLSafeString(bytes);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
package com.microsoft.aad.adal;

import android.content.Context;
import android.util.Base64;

import androidx.annotation.NonNull;

Expand All @@ -49,6 +50,7 @@

import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
Expand Down Expand Up @@ -656,7 +658,12 @@ private void addDeletionKeyForFRTIfRTValueIsStale(final List<String> keysToRemov
}

private String getUniqueIdentifierForCacheKey(final String userId, final String tenantId) {
return StringExtensions.base64UrlEncodeToString(userId) + "." + StringExtensions.base64UrlEncodeToString(tenantId);
return getEncodedStringForKey(userId) + "." + getEncodedStringForKey(tenantId);
}

private String getEncodedStringForKey(final String message) {
return Base64.encodeToString(message.getBytes(Charset.forName(AuthenticationConstants.ENCODING_UTF8)),
Base64.URL_SAFE | Base64.NO_WRAP);
}

private boolean isUserMisMatch(final String user, final TokenCacheItem tokenCacheItem) {
Expand Down
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
vNext
---------
- [PATCH] Migrate Base64 away from Msebera


Version 4.8.15
---------
- [PATCH] Update common @18.1.0
Expand Down
2 changes: 1 addition & 1 deletion common
Submodule common updated 57 files
+49 −0 ...piUtilities/src/main/com/microsoft/identity/labapi/utilities/authentication/LabApiAuthenticationClient.java
+21 −1 LabApiUtilities/src/main/com/microsoft/identity/labapi/utilities/client/LabClient.java
+8 −0 changelog.txt
+1 −1 common/build.gradle
+2 −24 common/src/main/java/com/microsoft/identity/common/adal/internal/util/StringExtensions.java
+57 −0 common/src/main/java/com/microsoft/identity/common/base64/AndroidBase64.kt
+2 −0 common/src/main/java/com/microsoft/identity/common/components/AndroidPlatformComponentsFactory.java
+1 −1 common/src/main/java/com/microsoft/identity/common/internal/broker/BrokerActivity.java
+1 −1 common/src/main/java/com/microsoft/identity/common/internal/cache/BaseActiveBrokerCache.kt
+1 −1 common/src/main/java/com/microsoft/identity/common/internal/cache/IActiveBrokerCache.kt
+0 −1 common/src/main/java/com/microsoft/identity/common/internal/cache/SharedPreferencesFileManager.java
+3 −9 common/src/main/java/com/microsoft/identity/common/internal/controllers/LocalMSALController.java
+11 −0 common/src/main/java/com/microsoft/identity/common/internal/providers/oauth2/WebViewAuthorizationFragment.java
+3 −9 common/src/test/java/com/microsoft/identity/common/MicrosoftStsAccountCredentialAdapterTest.java
+3 −1 common4j/build.gradle
+3 −8 common4j/src/main/com/microsoft/identity/common/java/authorities/Authority.java
+2 −4 common4j/src/main/com/microsoft/identity/common/java/authorities/AuthorityDeserializer.java
+171 −0 common4j/src/main/com/microsoft/identity/common/java/base64/Base64.kt
+25 −20 common4j/src/main/com/microsoft/identity/common/java/base64/Base64Flags.kt
+40 −0 common4j/src/main/com/microsoft/identity/common/java/base64/IBase64.kt
+4 −4 common4j/src/main/com/microsoft/identity/common/java/crypto/StorageEncryptionManager.java
+4 −3 common4j/src/main/com/microsoft/identity/common/java/crypto/key/AbstractSecretKeyLoader.java
+2 −6 common4j/src/main/com/microsoft/identity/common/java/crypto/key/KeyUtil.java
+2 −2 common4j/src/main/com/microsoft/identity/common/java/jwt/JwtUtils.java
+1 −2 common4j/src/main/com/microsoft/identity/common/java/logging/LibraryInfoHelper.java
+1 −1 common4j/src/main/com/microsoft/identity/common/java/nativeauth/providers/NativeAuthOAuth2Configuration.kt
+0 −4 common4j/src/main/com/microsoft/identity/common/java/opentelemetry/SpanName.java
+10 −12 common4j/src/main/com/microsoft/identity/common/java/platform/AbstractDevicePopManager.java
+1 −2 common4j/src/main/com/microsoft/identity/common/java/platform/Device.java
+7 −7 common4j/src/main/com/microsoft/identity/common/java/platform/JweResponse.java
+4 −3 common4j/src/main/com/microsoft/identity/common/java/providers/microsoft/MicrosoftAccount.java
+3 −3 .../main/com/microsoft/identity/common/java/providers/microsoft/azureactivedirectory/AzureActiveDirectory.java
+3 −2 common4j/src/main/com/microsoft/identity/common/java/providers/microsoft/azureactivedirectory/ClientInfo.java
+2 −2 common4j/src/main/com/microsoft/identity/common/java/providers/oauth2/AuthorizationRequest.java
+3 −4 common4j/src/main/com/microsoft/identity/common/java/providers/oauth2/PkceChallenge.java
+1 −1 common4j/src/main/com/microsoft/identity/common/java/result/LocalAuthenticationResult.java
+6 −4 common4j/src/main/com/microsoft/identity/common/java/util/CommonURIBuilder.java
+3 −3 common4j/src/main/com/microsoft/identity/common/java/util/JWSBuilder.java
+6 −53 common4j/src/main/com/microsoft/identity/common/java/util/StringUtil.java
+3 −4 common4j/src/main/com/microsoft/identity/common/java/util/UrlUtil.java
+2 −2 common4j/src/main/com/microsoft/identity/common/java/util/ported/ObjectUtils.java
+66 −0 common4j/src/test/com/microsoft/identity/common/java/MseberaBase64.kt
+2 −2 common4j/src/test/com/microsoft/identity/common/java/jwt/JwtUtilsTest.java
+1 −1 common4j/src/test/com/microsoft/identity/common/java/providers/Constants.java
+1 −1 .../microsoft/identity/common/java/providers/microsoft/microsoftsts/MicrosoftStsAuthorizationRequestTests.java
+24 −2 common4j/src/test/com/microsoft/identity/common/java/util/CommonURIBuilderTest.java
+2 −1 common4j/src/test/com/microsoft/identity/common/java/util/JwsBuilderTest.java
+0 −1 gradle/versions.gradle
+30 −51 keyvault/src/main/java/com/microsoft/identity/internal/test/keyvault/ApiClient.java
+4 −47 labapi/src/main/java/com/microsoft/identity/internal/test/labapi/ApiClient.java
+1 −0 testutils/build.gradle
+67 −0 testutils/src/main/java/com/microsoft/identity/internal/testutils/MseberaBase64.kt
+50 −24 testutils/src/main/java/com/microsoft/identity/internal/testutils/nativeauth/api/TemporaryEmailService.kt
+9 −5 uiautomationutilities/src/main/java/com/microsoft/identity/client/ui/automation/app/AzureSampleApp.java
+17 −4 uiautomationutilities/src/main/java/com/microsoft/identity/client/ui/automation/app/OutlookApp.java
+12 −9 uiautomationutilities/src/main/java/com/microsoft/identity/client/ui/automation/app/TeamsApp.java
+3 −12 uiautomationutilities/src/main/java/com/microsoft/identity/client/ui/automation/app/WordApp.java
1 change: 0 additions & 1 deletion gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ ext {
daggerVersion = "2.31.2"
daggerCompilerVersion = "2.31.2"
msal4jVersion = "1.10.0"
mseberaApacheHttpClientVersion = "4.5.8"
moshiVersion = "1.14.0"
moshiAdaptersVersion = "1.14.0"
openpojoVersion = "0.9.1"
Expand Down
Loading