Skip to content

Commit 3699125

Browse files
authored
Merge pull request #925 from AzureAD/avdunn/lombok-removal
Remove Lombok
2 parents a990b4a + cc28748 commit 3699125

File tree

62 files changed

+1993
-696
lines changed

Some content is hidden

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

62 files changed

+1993
-696
lines changed

msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/AADAuthority.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55

66
import java.net.URL;
77

8-
import lombok.AccessLevel;
9-
import lombok.Getter;
10-
import lombok.experimental.Accessors;
11-
12-
@Accessors(fluent = true)
13-
@Getter(AccessLevel.PACKAGE)
148
class AADAuthority extends Authority {
159

1610
private final static String TENANTLESS_TENANT_NAME = "common";

msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/AadInstanceDiscoveryResponse.java

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,10 @@
77
import com.azure.json.JsonSerializable;
88
import com.azure.json.JsonToken;
99
import com.azure.json.JsonWriter;
10-
import lombok.AccessLevel;
11-
import lombok.Getter;
12-
import lombok.experimental.Accessors;
1310

1411
import java.io.IOException;
1512
import java.util.List;
1613

17-
@Accessors(fluent = true)
18-
@Getter(AccessLevel.PACKAGE)
1914
class AadInstanceDiscoveryResponse implements JsonSerializable<AadInstanceDiscoveryResponse> {
2015

2116
private String tenantDiscoveryEndpoint;
@@ -70,4 +65,28 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
7065
jsonWriter.writeEndObject();
7166
return jsonWriter;
7267
}
68+
69+
String tenantDiscoveryEndpoint() {
70+
return this.tenantDiscoveryEndpoint;
71+
}
72+
73+
List<InstanceDiscoveryMetadataEntry> metadata() {
74+
return this.metadata;
75+
}
76+
77+
String errorDescription() {
78+
return this.errorDescription;
79+
}
80+
81+
List<Long> errorCodes() {
82+
return this.errorCodes;
83+
}
84+
85+
String error() {
86+
return this.error;
87+
}
88+
89+
String correlationId() {
90+
return this.correlationId;
91+
}
7392
}

msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/AbstractApplicationBase.java

Lines changed: 56 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,13 @@
33

44
package com.microsoft.aad.msal4j;
55

6-
import lombok.AccessLevel;
7-
import lombok.Getter;
8-
import lombok.experimental.Accessors;
96
import org.slf4j.Logger;
107

118
import javax.net.ssl.SSLSocketFactory;
12-
import java.net.MalformedURLException;
139
import java.net.Proxy;
1410
import java.net.URL;
1511
import java.util.HashMap;
1612
import java.util.List;
17-
import java.util.Set;
1813
import java.util.concurrent.CompletableFuture;
1914
import java.util.concurrent.ExecutorService;
2015
import java.util.function.Consumer;
@@ -30,63 +25,22 @@ public abstract class AbstractApplicationBase implements IApplicationBase {
3025

3126
protected Logger log;
3227
protected Authority authenticationAuthority;
33-
34-
@Accessors(fluent = true)
35-
@Getter
3628
private String correlationId;
37-
38-
@Accessors(fluent = true)
39-
@Getter
4029
private boolean logPii;
41-
42-
@Accessors(fluent = true)
43-
@Getter
4430
private Proxy proxy;
45-
46-
@Accessors(fluent = true)
47-
@Getter
4831
private SSLSocketFactory sslSocketFactory;
49-
50-
@Accessors(fluent = true)
51-
@Getter
5232
private IHttpClient httpClient;
53-
54-
@Accessors(fluent = true)
55-
@Getter
5633
private Integer connectTimeoutForDefaultHttpClient;
57-
58-
@Accessors(fluent = true)
59-
@Getter
6034
private Integer readTimeoutForDefaultHttpClient;
61-
62-
@Accessors(fluent = true)
63-
@Getter(AccessLevel.PACKAGE)
6435
String tenant;
6536

6637
//The following fields are set in only some applications and/or set internally by the library. To avoid excessive
6738
// type casting throughout the library they are defined here as package-private, but will not be part of this class's Builder
68-
@Accessors(fluent = true)
69-
@Getter(AccessLevel.PACKAGE)
7039
private boolean validateAuthority;
71-
72-
@Accessors(fluent = true)
73-
@Getter(AccessLevel.PACKAGE)
7440
private String clientId;
75-
76-
@Accessors(fluent = true)
77-
@Getter(AccessLevel.PACKAGE)
7841
private String authority;
79-
80-
@Accessors(fluent = true)
81-
@Getter(AccessLevel.PACKAGE)
8242
ServiceBundle serviceBundle;
83-
84-
@Accessors(fluent = true)
85-
@Getter(AccessLevel.PACKAGE)
8643
Consumer<List<HashMap<String, String>>> telemetryConsumer;
87-
88-
@Accessors(fluent = true)
89-
@Getter(AccessLevel.PACKAGE)
9044
protected TokenCache tokenCache;
9145

9246
CompletableFuture<IAuthenticationResult> executeRequest(
@@ -168,6 +122,62 @@ private AuthenticationResultSupplier getAuthenticationResultSupplier(MsalRequest
168122
return supplier;
169123
}
170124

125+
public String correlationId() {
126+
return this.correlationId;
127+
}
128+
129+
public boolean logPii() {
130+
return this.logPii;
131+
}
132+
133+
public Proxy proxy() {
134+
return this.proxy;
135+
}
136+
137+
public SSLSocketFactory sslSocketFactory() {
138+
return this.sslSocketFactory;
139+
}
140+
141+
public IHttpClient httpClient() {
142+
return this.httpClient;
143+
}
144+
145+
public Integer connectTimeoutForDefaultHttpClient() {
146+
return this.connectTimeoutForDefaultHttpClient;
147+
}
148+
149+
public Integer readTimeoutForDefaultHttpClient() {
150+
return this.readTimeoutForDefaultHttpClient;
151+
}
152+
153+
String tenant() {
154+
return this.tenant;
155+
}
156+
157+
boolean validateAuthority() {
158+
return this.validateAuthority;
159+
}
160+
161+
String clientId() {
162+
return this.clientId;
163+
}
164+
165+
String authority() {
166+
return this.authority;
167+
}
168+
169+
ServiceBundle serviceBundle() {
170+
return this.serviceBundle;
171+
}
172+
173+
Consumer<List<HashMap<String, String>>> telemetryConsumer() {
174+
return this.telemetryConsumer;
175+
}
176+
177+
TokenCache tokenCache() {
178+
return this.tokenCache;
179+
}
180+
171181
public abstract static class Builder<T extends Builder<T>> {
172182
// Optional parameters - initialized to default values
173183
private String correlationId;

msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/AbstractClientApplicationBase.java

Lines changed: 60 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
package com.microsoft.aad.msal4j;
55

66
import com.nimbusds.oauth2.sdk.auth.ClientAuthentication;
7-
import lombok.Getter;
8-
import lombok.experimental.Accessors;
97

108
import javax.net.ssl.SSLSocketFactory;
119
import java.net.MalformedURLException;
@@ -25,46 +23,16 @@
2523
*/
2624
public abstract class AbstractClientApplicationBase extends AbstractApplicationBase implements IClientApplicationBase {
2725

28-
@Accessors(fluent = true)
29-
@Getter
3026
private String clientId;
31-
32-
@Accessors(fluent = true)
33-
@Getter
3427
private String authority;
35-
36-
@Accessors(fluent = true)
37-
@Getter
3828
private boolean validateAuthority;
39-
40-
@Accessors(fluent = true)
41-
@Getter
4229
private String applicationName;
43-
44-
@Accessors(fluent = true)
45-
@Getter
4630
private String applicationVersion;
47-
48-
@Accessors(fluent = true)
49-
@Getter
5031
private AadInstanceDiscoveryResponse aadAadInstanceDiscoveryResponse;
51-
5232
protected abstract ClientAuthentication clientAuthentication();
53-
54-
@Accessors(fluent = true)
55-
@Getter
5633
private String clientCapabilities;
57-
58-
@Accessors(fluent = true)
59-
@Getter
6034
private boolean autoDetectRegion;
61-
62-
@Accessors(fluent = true)
63-
@Getter
6435
protected String azureRegion;
65-
66-
@Accessors(fluent = true)
67-
@Getter
6836
private boolean instanceDiscovery;
6937

7038
@Override
@@ -187,6 +155,49 @@ public URL getAuthorizationRequestUrl(AuthorizationRequestUrlParameters paramete
187155
parameters.requestParameters());
188156
}
189157

158+
@Override
159+
public String clientId() {
160+
return this.clientId;
161+
}
162+
163+
@Override
164+
public String authority() {
165+
return this.authority;
166+
}
167+
168+
@Override
169+
public boolean validateAuthority() {
170+
return this.validateAuthority;
171+
}
172+
173+
public String applicationName() {
174+
return this.applicationName;
175+
}
176+
177+
public String applicationVersion() {
178+
return this.applicationVersion;
179+
}
180+
181+
public AadInstanceDiscoveryResponse aadAadInstanceDiscoveryResponse() {
182+
return this.aadAadInstanceDiscoveryResponse;
183+
}
184+
185+
public String clientCapabilities() {
186+
return this.clientCapabilities;
187+
}
188+
189+
public boolean autoDetectRegion() {
190+
return this.autoDetectRegion;
191+
}
192+
193+
public String azureRegion() {
194+
return this.azureRegion;
195+
}
196+
197+
public boolean instanceDiscovery() {
198+
return this.instanceDiscovery;
199+
}
200+
190201
public abstract static class Builder<T extends Builder<T>> extends AbstractApplicationBase.Builder<T> {
191202
// Required parameters
192203
private String clientId;
@@ -253,11 +264,11 @@ public T authority(String val) throws MalformedURLException {
253264

254265
/**
255266
* Set URL of the authenticating B2C authority from which MSAL will acquire tokens
256-
*
267+
* <p>
257268
* Valid B2C authorities should look like: https://&lt;something.b2clogin.com/&lt;tenant&gt;/&lt;policy&gt;
258-
*
269+
* <p>
259270
* MSAL Java also supports a legacy B2C authority format, which looks like: https://&lt;host&gt;/tfp/&lt;tenant&gt;/&lt;policy&gt;
260-
*
271+
* <p>
261272
* However, MSAL Java will eventually stop supporting the legacy format. See here for information on how to migrate to the new format: https://aka.ms/msal4j-b2c
262273
*
263274
* @param val a boolean value for validateAuthority
@@ -393,10 +404,10 @@ public T clientCapabilities(Set<String> capabilities) {
393404
* Indicates that the library should attempt to discover the Azure region the application is running in when
394405
* fetching the instance discovery metadata. Regions can only be detected when running in an Azure environment,
395406
* such as an Azure VM or other service, or if the environment has environment variable named REGION_NAME configured.
396-
*
407+
* <p>
397408
* Although you can enable both autodetection here and a specific region with {@link AbstractClientApplicationBase#azureRegion} at the same time,
398409
* the region set with {@link AbstractClientApplicationBase#azureRegion} will take priority if there is a mismatch.
399-
*
410+
* <p>
400411
* See here for more information about supported scenarios: https://aka.ms/msal4j-azure-regions
401412
*
402413
* @param val boolean (default is false)
@@ -410,13 +421,13 @@ public T autoDetectRegion(boolean val) {
410421
/**
411422
* Set the region that the library will use to format authorities in token requests. If given a valid Azure region,
412423
* the library will attempt to make token requests at a regional ESTS-R endpoint rather than the global ESTS endpoint.
413-
*
424+
* <p>
414425
* Regions must be valid Azure regions and their short names should be used, such as 'westus' for the West US Azure region,
415426
* 'centralus' for the Central US Azure region, etc.
416-
*
427+
* <p>
417428
* Although you can set a specific region here and enable autodetection with {@link AbstractClientApplicationBase#autoDetectRegion} at the same time
418429
* the specific region set here will take priority over the autodetected region if there is a mismatch.
419-
*
430+
* <p>
420431
* See here for more information about supported scenarios: https://aka.ms/msal4j-azure-regions
421432
*
422433
* @param val String region name
@@ -427,13 +438,15 @@ public T azureRegion(String val) {
427438
return self();
428439
}
429440

430-
/** Historically, MSAL would connect to a central endpoint located at
431-
``https://login.microsoftonline.com`` to acquire some metadata, especially when using an unfamiliar authority.
432-
This behavior is known as Instance Discovery.
433-
This parameter defaults to true, which enables the Instance Discovery.
434-
If you do not know some authorities beforehand,
435-
yet still want MSAL to accept any authority that you will provide,
436-
you can use a ``False`` to unconditionally disable Instance Discovery. */
441+
/**
442+
* Historically, MSAL would connect to a central endpoint located at
443+
* ``https://login.microsoftonline.com`` to acquire some metadata, especially when using an unfamiliar authority.
444+
* This behavior is known as Instance Discovery.
445+
* This parameter defaults to true, which enables the Instance Discovery.
446+
* If you do not know some authorities beforehand,
447+
* yet still want MSAL to accept any authority that you will provide,
448+
* you can use a ``False`` to unconditionally disable Instance Discovery.
449+
*/
437450
public T instanceDiscovery(boolean val) {
438451
isInstanceDiscoveryEnabled = val;
439452
return self();

0 commit comments

Comments
 (0)