Skip to content

Commit ca53774

Browse files
Brian Melton-Graceshahzaibjtanmaymanolkar1kreedulakreedula
authored
Release MSAL 1.6.0 (#1108)
* Add UI Tests in MSAL (#1047) * Initial commit for msal automation app * Updates to msal automation app * Initial commit for ui autmation tests * Updates to ui automation * Add more ui automator tests * Fix bugs in ui tests * Add msal automated test, remove unused files * Automate msal us gov sov cloud test plan * Move ui test utilities to its own module * Add ui automator versions to versions.gradle * Add ui automation utilities to msal project * Remove stale test code * Remove stale code from setup * Update submodule * Rename packages * Remove ignored tests * Remove test application id; fix comment * Refactor test setup logic * Add mising license * Remove acquire token btn from automation app * Remove redundant username variable * Disable test toast temporarily * Update submodule * Address comments * Add comments with test descriptions * Update submodule * Remove mockito from automation test app deps * Update submodule * Update submodule * Add correlation id to Authentication Result * Update submodule * Add new line at end of IAuthenticationResult.java * Address comments * Add unit tests for command parameters and correlation id * Add unit tests for Authentication Result and correlation id * Update submodule * Address comments * Update submodule * changes * Add single account overload tests (#1070) * Add single account pca overload network tests * Add mocked tests for single account overloads * Remove unused code * Update submodule * Add back private * Update submodule * Update submodule to latest (#1073) * Add basic b2c ui tests * Add b2c tests for idlab siso policy * Update submodule * Update snapshot * removed extra line * Clean up b2c test code * Update submodule * Update submodule * Update submodule to latest (#1082) * Closes #1084 - Load properties via withInputStream syntax to auto-close (#1085) * Closes #1084 * Goovier syntax * Hotfix Release 1.5.4 - Merge to Master (#1083) (#1087) * Hotfix Release 1.5.4 - Merge to Master (#1083) * Update submodule to [email protected] * Update version to 1.5.4 * Update gradle deps to 2.0.12 * Update changelog * Fix merge issue * Update common sumbodule. * Document the process. * Update the documentation for comments. * Add enums for cloud instance and audience * Add authority overloads to Token Parameters * Add tests for token parameters authority * Add javadoc to enum constants * Throw error if tenant specified but audience not My Org * Remove unused method * Fix #1092 * Fix #1096 * Update submodule * Add Locale.ROOT to toLowerCase calls * Post 1.5.5 Deployment Merge to Dev (#1106) * Hotfix Release 1.5.4 - Merge to Master (#1083) * Update submodule to [email protected] * Update version to 1.5.4 * Update gradle deps to 2.0.12 * Update changelog * MSAL Release 1.5.5 (#1104) * Update submodule pointer to [email protected] * Update version.properties * Update changelog * Update dependencies * Update common submodule pointer to [email protected] * Update changelog for hf versioning * Update dependency for [email protected] * Update snapshot, dist to 2.0.14 versions * Update submodule pointer to [email protected] * Update changelog for 1.6.0 * Update version.properties for 1.6.0-RC1 * Update build.gradle deps for 2.0.15-RC1 * Set submodule pointer to common@master (2.0.15) * Set version.properties to 1.6.0 * Update build.gradle for [email protected] * Update changelog for 1.6.0 Co-authored-by: Shahzaib <[email protected]> Co-authored-by: shahzaibj <[email protected]> Co-authored-by: Tanmay Manolkar <[email protected]> Co-authored-by: tanmaymanolkar1 <[email protected]> Co-authored-by: kreedula <[email protected]> Co-authored-by: Krishna Eedula <[email protected]> Co-authored-by: Adam Johnson <[email protected]> Co-authored-by: AdamBJohnsonx <[email protected]> Co-authored-by: Shane Oatman <[email protected]>
1 parent e71e751 commit ca53774

File tree

94 files changed

+4898
-29
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+4898
-29
lines changed

changelog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
MSAL Wiki : https://github.com/AzureAD/microsoft-authentication-library-for-android/wiki
22

3+
Version 1.6.0
4+
-----------
5+
- Introduces new AadAuthorityAudience enum to support new syntax for specifying cloud + audience
6+
- Adds new property to IAuthenticationResult: correlation_id
7+
- Fix for String encoding issue affecting devices with Turkish locale
8+
- Fix for #1092: (Single Account Mode) getCurrentAccount() does not return MSA accounts if broker is installed
9+
- Fix for #1096: (Single Account Mode) signOut() doesn't remove MSA accounts if broker is installed
10+
11+
312
Version 1.5.5
413
-----------
514
- Picks up fixes in [email protected]

common

Submodule common updated 73 files

docs/submodule-update.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
In order to update the common submodule, we need to pull the latest version.
3+
4+
In this flow, you may want to use a branch that isn't dev, since we may
5+
be using code that is experimental, or represents a fix or a patch. In
6+
that event, you should checkout whatever branch is appropriate.
7+
8+
```
9+
cd common
10+
git checkout dev
11+
git pull
12+
cd ..
13+
git add common
14+
git commit
15+
```

gradle/versions.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ ext {
1212
androidMavenGradlePluginVersion = "1.4.1"
1313

1414
// Libraries
15+
androidxTestRunnerVersion = "1.2.0"
16+
androidxTestOrchestratorVersion = "1.2.0"
17+
androidxTestMonitorVersion = "1.2.0"
1518
androidxTestCoreVersion = "1.2.0"
1619
androidxJunitVersion = "1.1.1"
1720
annotationVersion = "1.0.0"
@@ -33,6 +36,7 @@ ext {
3336
runnerVersion = "1.2.0"
3437
rulesVersion = "1.2.0"
3538
robolectricVersion = "4.3.1"
39+
uiAutomatorVersion = "2.2.0"
3640

3741
// TODO: adal automation test app.
3842
supportLibraryVersion = "27.1.+"

msal/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ dependencies {
148148
transitive = false
149149
}
150150

151-
snapshotApi(group: 'com.microsoft.identity', name: 'common', version: '2.0.12-hf1', changing: true)
151+
snapshotApi(group: 'com.microsoft.identity', name: 'common', version: '2.0.15-SNAPSHOT', changing: true)
152152

153-
distApi("com.microsoft.identity:common:2.0.12-hf1") {
153+
distApi("com.microsoft.identity:common:2.0.15") {
154154
transitive = false
155155
}
156156
}
@@ -208,8 +208,8 @@ publishing {
208208

209209
// Description
210210
asNode().appendNode(
211-
'description',
212-
'Microsoft Identity library for Android gives you the ability to add authentication to your application with just a few lines of additional code. Using our MSAL SDKs you can quickly and easily extend your existing application to all the employees that use MSA, B2C, Azure AD and Active Directory on-premises using Active Directory Federation Services, including Office365 customers.'
211+
'description',
212+
'Microsoft Identity library for Android gives you the ability to add authentication to your application with just a few lines of additional code. Using our MSAL SDKs you can quickly and easily extend your existing application to all the employees that use MSA, B2C, Azure AD and Active Directory on-premises using Active Directory Federation Services, including Office365 customers.'
213213
)
214214

215215
// URL
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// All rights reserved.
3+
//
4+
// This code is licensed under the MIT License.
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files(the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions :
12+
//
13+
// The above copyright notice and this permission notice shall be included in
14+
// all copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
// THE SOFTWARE.
23+
package com.microsoft.identity.client;
24+
25+
import androidx.annotation.Nullable;
26+
27+
/**
28+
* The audiences that can be used for Authority when making token requests in MSAL
29+
*/
30+
public enum AadAuthorityAudience {
31+
32+
/**
33+
* Users with a personal Microsoft account, or a work or school account in any organization’s
34+
* Azure AD tenant. Maps to https://[instance]/common/
35+
*/
36+
AzureAdAndPersonalMicrosoftAccount("common"),
37+
38+
/**
39+
* Users with a Microsoft work or school account in any organization’s Azure AD tenant
40+
* (i.e. multi-tenant). Maps to https://[instance]/organizations/
41+
*/
42+
AzureAdMultipleOrgs("organizations"),
43+
44+
/**
45+
* Users with a personal Microsoft account. Maps to https://[instance]/consumers/
46+
*/
47+
PersonalMicrosoftAccount("consumers"),
48+
49+
/**
50+
* Users with a Microsoft work or school account in my organization’s Azure AD tenant
51+
* (i.e. single tenant). Maps to https://[instance]/[tenantId]
52+
*/
53+
AzureAdMyOrg(null);
54+
55+
@Nullable
56+
private String audienceValue;
57+
58+
AadAuthorityAudience(@Nullable String audienceValue) {
59+
this.audienceValue = audienceValue;
60+
}
61+
62+
@Nullable
63+
public String getAudienceValue() {
64+
return audienceValue;
65+
}
66+
67+
}

msal/src/main/java/com/microsoft/identity/client/AuthenticationResult.java

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,19 @@
2222
// THE SOFTWARE.
2323
package com.microsoft.identity.client;
2424

25+
import android.text.TextUtils;
26+
2527
import androidx.annotation.NonNull;
2628
import androidx.annotation.Nullable;
2729

2830
import com.microsoft.identity.common.internal.authscheme.TokenAuthenticationScheme;
2931
import com.microsoft.identity.common.internal.cache.ICacheRecord;
3032
import com.microsoft.identity.common.internal.dto.AccessTokenRecord;
33+
import com.microsoft.identity.common.internal.logging.Logger;
3134

3235
import java.util.Date;
3336
import java.util.List;
37+
import java.util.UUID;
3438
import java.util.concurrent.TimeUnit;
3539

3640
/**
@@ -39,15 +43,20 @@
3943
*/
4044
public final class AuthenticationResult implements IAuthenticationResult {
4145

46+
private static final String TAG = AuthenticationResult.class.getSimpleName();
47+
4248
private final String mTenantId;
4349
private final AccessTokenRecord mAccessToken;
4450
private final IAccount mAccount;
51+
private final UUID mCorrelationId;
4552

46-
AuthenticationResult(@NonNull final List<ICacheRecord> cacheRecords) {
53+
AuthenticationResult(@NonNull final List<ICacheRecord> cacheRecords,
54+
@Nullable final String correlationId) {
4755
final ICacheRecord mostRecentlyAuthorized = cacheRecords.get(0);
4856
mAccessToken = mostRecentlyAuthorized.getAccessToken();
4957
mTenantId = mostRecentlyAuthorized.getAccount().getRealm();
5058
mAccount = AccountAdapter.adapt(cacheRecords).get(0);
59+
mCorrelationId = sanitizeCorrelationId(correlationId);
5160
}
5261

5362
@Override
@@ -108,4 +117,27 @@ public IAccount getAccount() {
108117
public String[] getScope() {
109118
return mAccessToken.getTarget().split("\\s");
110119
}
120+
121+
@Nullable
122+
@Override
123+
public UUID getCorrelationId() {
124+
return mCorrelationId;
125+
}
126+
127+
@Nullable
128+
private UUID sanitizeCorrelationId(@Nullable final String correlationId) {
129+
final String methodName = "sanitizeCorrelationId";
130+
131+
if (TextUtils.isEmpty(correlationId)) {
132+
Logger.warn(TAG + methodName, "Correlation id was empty, returning null.");
133+
return null;
134+
}
135+
136+
try {
137+
return UUID.fromString(correlationId);
138+
} catch (IllegalArgumentException e) {
139+
Logger.error(TAG + methodName, "Correlation id is not a valid UUID.", e);
140+
return null;
141+
}
142+
}
111143
}

msal/src/main/java/com/microsoft/identity/client/AuthenticationResultAdapter.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import java.util.Arrays;
3333
import java.util.HashSet;
3434
import java.util.List;
35+
import java.util.Locale;
3536
import java.util.Set;
3637

3738
class AuthenticationResultAdapter {
@@ -40,7 +41,8 @@ class AuthenticationResultAdapter {
4041

4142
static IAuthenticationResult adapt(@NonNull final ILocalAuthenticationResult localAuthenticationResult) {
4243
final IAuthenticationResult authenticationResult = new AuthenticationResult(
43-
localAuthenticationResult.getCacheRecordWithTenantProfileData()
44+
localAuthenticationResult.getCacheRecordWithTenantProfileData(),
45+
localAuthenticationResult.getCorrelationId()
4446
);
4547
return authenticationResult;
4648
}
@@ -86,14 +88,14 @@ static List<String> getDeclinedScopes(@NonNull final List<String> grantedScopes,
8688

8789
// Add each granted scope to the Set
8890
for (final String grantedScope : grantedScopes) {
89-
grantedScopesSet.add(grantedScope.toLowerCase());
91+
grantedScopesSet.add(grantedScope.toLowerCase(Locale.ROOT));
9092
}
9193

9294
final Set<String> requestedScopesSet = new HashSet<>();
9395

9496
// Add each requested scope to the Set
9597
for (final String requestedScope : requestedScopes) {
96-
requestedScopesSet.add(requestedScope.toLowerCase());
98+
requestedScopesSet.add(requestedScope.toLowerCase(Locale.ROOT));
9799
}
98100

99101
final List<String> declinedScopes = new ArrayList<>();
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// All rights reserved.
3+
//
4+
// This code is licensed under the MIT License.
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files(the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions :
12+
//
13+
// The above copyright notice and this permission notice shall be included in
14+
// all copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
// THE SOFTWARE.
23+
package com.microsoft.identity.client;
24+
25+
/**
26+
* The clouds that can be used for Authority when making token requests in MSAL
27+
*/
28+
public enum AzureCloudInstance {
29+
30+
/**
31+
* Microsoft Azure public cloud. Maps to https://login.microsoftonline.com
32+
*/
33+
AzurePublic("https://login.microsoftonline.com"),
34+
35+
/**
36+
* Microsoft Chinese national cloud. Maps to https://login.partner.microsoftonline.cn
37+
*/
38+
AzureChina("https://login.partner.microsoftonline.cn"),
39+
40+
/**
41+
* Microsoft German national cloud (“Black Forest”). Maps to https://login.microsoftonline.de
42+
*/
43+
AzureGermany("https://login.microsoftonline.de"),
44+
45+
/**
46+
* US Government cloud. Maps to https://login.microsoftonline.us
47+
*/
48+
AzureUsGov("https://login.microsoftonline.us");
49+
50+
private String cloudInstanceUri;
51+
52+
AzureCloudInstance(String cloudInstanceUri) {
53+
this.cloudInstanceUri = cloudInstanceUri;
54+
}
55+
56+
public String getCloudInstanceUri() {
57+
return cloudInstanceUri;
58+
}
59+
}

msal/src/main/java/com/microsoft/identity/client/IAuthenticationResult.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import androidx.annotation.Nullable;
2727

2828
import java.util.Date;
29+
import java.util.UUID;
2930

3031
public interface IAuthenticationResult {
3132

@@ -81,4 +82,13 @@ public interface IAuthenticationResult {
8182
*/
8283
@NonNull
8384
String[] getScope();
84-
}
85+
86+
/**
87+
* Gets the correlation id used during the acquire token request. Could be null if an error
88+
* occurs when parsing from String or if not set.
89+
*
90+
* @return a UUID representing a correlation id
91+
*/
92+
@Nullable
93+
UUID getCorrelationId(); // this should never actually be null for MSAL
94+
}

0 commit comments

Comments
 (0)