Skip to content

Commit 70fc909

Browse files
authored
Merge pull request #116 from AzureAD/sagonzal/MakeBuilderPrivate
Make Builder constructor private
2 parents ecbc892 + e924319 commit 70fc909

16 files changed

+36
-49
lines changed

src/integrationtest/java/com.microsoft.aad.msal4j/AcquireTokenSilentIT.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void acquireTokenSilent_LabAuthority_TokenNotRefreshed() throws Exception
5151
String password = labUserProvider.getUserPassword(labResponse.getUser());
5252
String labAuthority = TestConstants.MICROSOFT_AUTHORITY_HOST + labResponse.getUser().getTenantId();
5353

54-
PublicClientApplication pca = new PublicClientApplication.Builder(
54+
PublicClientApplication pca = PublicClientApplication.builder(
5555
labResponse.getAppId()).
5656
authority(labAuthority).
5757
build();
@@ -85,7 +85,7 @@ public void acquireTokenSilent_ForceRefresh() throws Exception {
8585
false);
8686
String password = labUserProvider.getUserPassword(labResponse.getUser());
8787

88-
PublicClientApplication pca = new PublicClientApplication.Builder(
88+
PublicClientApplication pca = PublicClientApplication.builder(
8989
labResponse.getAppId()).
9090
authority(TestConstants.ORGANIZATIONS_AUTHORITY).
9191
build();
@@ -158,7 +158,7 @@ private IPublicClientApplication getPublicClientApplicationWithTokensInCache()
158158
false);
159159
String password = labUserProvider.getUserPassword(labResponse.getUser());
160160

161-
PublicClientApplication pca = new PublicClientApplication.Builder(
161+
PublicClientApplication pca = PublicClientApplication.builder(
162162
labResponse.getAppId()).
163163
authority(TestConstants.ORGANIZATIONS_AUTHORITY).
164164
build();
@@ -194,7 +194,7 @@ void acquireTokenSilent_returnCachedTokens(String authority) throws Exception {
194194
false);
195195
String password = labUserProvider.getUserPassword(labResponse.getUser());
196196

197-
PublicClientApplication pca = new PublicClientApplication.Builder(
197+
PublicClientApplication pca = PublicClientApplication.builder(
198198
labResponse.getAppId()).
199199
authority(authority).
200200
build();

src/integrationtest/java/com.microsoft.aad.msal4j/ClientCredentialsIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void acquireTokenClientCredentials_ClientSecret() throws Exception{
4141
}
4242

4343
private void assertAcquireTokenCommon(String clientId, IClientCredential credential) throws Exception{
44-
ConfidentialClientApplication cca = new ConfidentialClientApplication.Builder(
44+
ConfidentialClientApplication cca = ConfidentialClientApplication.builder(
4545
clientId, credential).
4646
authority(TestConstants.MICROSOFT_AUTHORITY).
4747
build();

src/integrationtest/java/com.microsoft.aad.msal4j/DeviceCodeIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void DeviceCodeFlowTest() throws Exception {
4242
false);
4343
labUserProvider.getUserPassword(labResponse.getUser());
4444

45-
PublicClientApplication pca = new PublicClientApplication.Builder(
45+
PublicClientApplication pca = PublicClientApplication.builder(
4646
labResponse.getAppId()).
4747
authority(TestConstants.ORGANIZATIONS_AUTHORITY).
4848
build();

src/integrationtest/java/com.microsoft.aad.msal4j/NationalCloudIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ private void assertAcquireTokenCommon(NationalCloud cloud) throws Exception{
4141
false);
4242
String password = labUserProvider.getUserPassword(labResponse.getUser());
4343

44-
PublicClientApplication pca = new PublicClientApplication.Builder(
44+
PublicClientApplication pca = PublicClientApplication.builder(
4545
labResponse.getAppId()).
4646
authority(TestConstants.ORGANIZATIONS_AUTHORITY).
4747
build();

src/integrationtest/java/com.microsoft.aad.msal4j/RefreshTokenIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void setUp() throws Exception {
2626
NationalCloud.AZURE_CLOUD,
2727
false);
2828
String password = labUserProvider.getUserPassword(labResponse.getUser());
29-
pca = new PublicClientApplication.Builder(
29+
pca = PublicClientApplication.builder(
3030
labResponse.getAppId()).
3131
authority(TestConstants.ORGANIZATIONS_AUTHORITY).
3232
build();

src/integrationtest/java/com.microsoft.aad.msal4j/TokenCacheIT.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void singleAccountInCache_RemoveAccountTest() throws Exception {
3030
false);
3131
String password = labUserProvider.getUserPassword(labResponse.getUser());
3232

33-
PublicClientApplication pca = new PublicClientApplication.Builder(
33+
PublicClientApplication pca = PublicClientApplication.builder(
3434
labResponse.getAppId()).
3535
authority(TestConstants.ORGANIZATIONS_AUTHORITY).
3636
build();
@@ -62,7 +62,7 @@ public void twoAccountsInCache_RemoveAccountTest() throws Exception{
6262
false);
6363
String password = labUserProvider.getUserPassword(labResponse1.getUser());
6464

65-
PublicClientApplication pca = new PublicClientApplication.Builder(
65+
PublicClientApplication pca = PublicClientApplication.builder(
6666
labResponse1.getAppId()).
6767
authority(TestConstants.ORGANIZATIONS_AUTHORITY).
6868
build();
@@ -125,7 +125,7 @@ public void twoAccountsInCache_SameUserDifferentTenants_RemoveAccountTest() thro
125125
ITokenCacheAccessAspect persistenceAspect = new TokenPersistence(dataToInitCache);
126126

127127
// acquire tokens for home tenant, and serialize cache
128-
PublicClientApplication pca = new PublicClientApplication.Builder(
128+
PublicClientApplication pca = PublicClientApplication.builder(
129129
labResponse.getAppId()).
130130
authority(TestConstants.ORGANIZATIONS_AUTHORITY)
131131
.setTokenCacheAccessAspect(persistenceAspect)
@@ -141,7 +141,7 @@ public void twoAccountsInCache_SameUserDifferentTenants_RemoveAccountTest() thro
141141
String guestTenantAuthority = TestConstants.MICROSOFT_AUTHORITY_HOST + labResponse.getUser().getTenantId();
142142

143143
// initialize pca with tenant where user is guest, deserialize cache, and acquire second token
144-
PublicClientApplication pca2 = new PublicClientApplication.Builder(
144+
PublicClientApplication pca2 = PublicClientApplication.builder(
145145
labResponse.getAppId()).
146146
authority(guestTenantAuthority).
147147
setTokenCacheAccessAspect(persistenceAspect).

src/integrationtest/java/com.microsoft.aad.msal4j/UsernamePasswordIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public void acquireTokenWithUsernamePassword_ADFSv2() throws Exception{
7575

7676
public void assertAcquireTokenCommon(LabResponse labResponse, String password)
7777
throws Exception{
78-
PublicClientApplication pca = new PublicClientApplication.Builder(
78+
PublicClientApplication pca = PublicClientApplication.builder(
7979
labResponse.getAppId()).
8080
authority(TestConstants.ORGANIZATIONS_AUTHORITY).
8181
build();
@@ -103,7 +103,7 @@ public void acquireTokenWithUsernamePassword_B2C_CustomAuthority() throws Except
103103
String b2CAppId = "e3b9ad76-9763-4827-b088-80c7a7888f79";
104104
String password = labUserProvider.getUserPassword(labResponse.getUser());
105105

106-
PublicClientApplication pca = new PublicClientApplication.Builder(
106+
PublicClientApplication pca = PublicClientApplication.builder(
107107
b2CAppId).
108108
b2cAuthority(TestConstants.B2C_AUTHORITY_ROPC).
109109
build();
@@ -129,7 +129,7 @@ public void acquireTokenWithUsernamePassword_B2C_LoginMicrosoftOnline() throws E
129129
String b2CAppId = "e3b9ad76-9763-4827-b088-80c7a7888f79";
130130
String password = labUserProvider.getUserPassword(labResponse.getUser());
131131

132-
PublicClientApplication pca = new PublicClientApplication.Builder(
132+
PublicClientApplication pca = PublicClientApplication.builder(
133133
b2CAppId).
134134
b2cAuthority(TestConstants.B2C_MICROSOFTLOGIN_ROPC).
135135
build();

src/main/java/com/microsoft/aad/msal4j/ConfidentialClientApplication.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,7 @@ public static class Builder extends ClientApplicationBase.Builder<Builder> {
109109

110110
private IClientCredential clientCredential;
111111

112-
/**
113-
* Constructor to create instance of Builder of ConfidentialClientApplication
114-
*
115-
* @param clientId Client ID (Application ID) of the application as registered
116-
* in the application registration portal (portal.azure.com)
117-
* @param clientCredential The client credential to use for token acquisition.
118-
*/
119-
Builder(String clientId, IClientCredential clientCredential) {
112+
private Builder(String clientId, IClientCredential clientCredential) {
120113
super(clientId);
121114
this.clientCredential = clientCredential;
122115
}

src/main/java/com/microsoft/aad/msal4j/PublicClientApplication.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,7 @@ public static Builder builder(String clientId) {
9797

9898
public static class Builder extends ClientApplicationBase.Builder<Builder> {
9999

100-
/**
101-
* Constructor to create instance of Builder of PublicClientApplication
102-
*
103-
* @param clientId Client ID (Application ID) of the application as registered
104-
* in the application registration portal (portal.azure.com)
105-
*/
106-
Builder(String clientId) {
100+
private Builder(String clientId) {
107101
super(clientId);
108102
}
109103

src/test/java/com/microsoft/aad/msal4j/CacheFormatTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public void tokenCacheEntitiesFormatTest(String folder) throws URISyntaxExceptio
126126

127127
String tokenResponse = getTokenResponse(folder);
128128

129-
PublicClientApplication app = new PublicClientApplication.Builder(CLIENT_ID).build();
129+
PublicClientApplication app = PublicClientApplication.builder(CLIENT_ID).build();
130130

131131
AuthorizationCodeParameters parameters =
132132
AuthorizationCodeParameters.builder

0 commit comments

Comments
 (0)