Skip to content

Commit a9fc520

Browse files
committed
taking suggestions
1 parent 6b6236a commit a9fc520

File tree

5 files changed

+14
-74
lines changed

5 files changed

+14
-74
lines changed

common/src/main/java/com/microsoft/identity/common/internal/request/MsalBrokerRequestAdapter.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
import com.microsoft.identity.common.java.commands.parameters.DeviceCodeFlowCommandParameters;
6161
import com.microsoft.identity.common.java.commands.parameters.GenerateShrCommandParameters;
6262
import com.microsoft.identity.common.java.commands.parameters.GetAadDeviceIdCommandParameters;
63-
import com.microsoft.identity.common.java.commands.parameters.IHasExtraTokenBodyParameters;
6463
import com.microsoft.identity.common.java.commands.parameters.InteractiveTokenCommandParameters;
6564
import com.microsoft.identity.common.java.commands.parameters.RemoveAccountCommandParameters;
6665
import com.microsoft.identity.common.java.commands.parameters.ResourceAccountCommandParameters;
@@ -212,12 +211,10 @@ public BrokerRequest brokerRequestFromSilentOperationParameters(@NonNull final S
212211
.traceFlags(SpanExtension.current().getSpanContext().getTraceFlags().asByte())
213212
.build()
214213
);
215-
if (parameters instanceof IHasExtraTokenBodyParameters) {
216-
final List<Map.Entry<String, String>> extraTokenBodyParams = ((IHasExtraTokenBodyParameters) parameters).getExtraTokenBodyParameters();
217-
final String extraTokenBodyParameters = extraTokenBodyParams != null ?
218-
QueryParamsAdapter._toJson(extraTokenBodyParams) : null;
219-
brokerRequestBuilder.extraTokenBodyParameter(extraTokenBodyParameters);
220-
}
214+
final List<Map.Entry<String, String>> extraTokenBodyParams = parameters.getExtraTokenBodyParameters();
215+
final String extraTokenBodyParameters = extraTokenBodyParams != null ?
216+
QueryParamsAdapter._toJson(extraTokenBodyParams) : null;
217+
brokerRequestBuilder.extraTokenBodyParameter(extraTokenBodyParameters);
221218
return brokerRequestBuilder.build();
222219
}
223220

common4j/src/main/com/microsoft/identity/common/java/commands/parameters/BrokerSilentTokenCommandParameters.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,14 @@
2929
import com.microsoft.identity.common.java.request.BrokerRequestType;
3030
import com.microsoft.identity.common.java.util.StringUtil;
3131

32-
import java.util.ArrayList;
33-
import java.util.List;
34-
import java.util.Map;
35-
3632
import lombok.EqualsAndHashCode;
3733
import lombok.Getter;
3834
import lombok.experimental.SuperBuilder;
3935

4036
@Getter
4137
@SuperBuilder(toBuilder = true)
4238
@EqualsAndHashCode(callSuper = true)
43-
public class BrokerSilentTokenCommandParameters
44-
extends SilentTokenCommandParameters
45-
implements IHasExtraTokenBodyParameters, IBrokerTokenCommandParameters {
39+
public class BrokerSilentTokenCommandParameters extends SilentTokenCommandParameters implements IBrokerTokenCommandParameters {
4640

4741
@Expose
4842
private final int callerUid;
@@ -61,9 +55,6 @@ public class BrokerSilentTokenCommandParameters
6155
@Expose
6256
private final String negotiatedBrokerProtocolVersion;
6357

64-
// Only put in the token request body
65-
private final List<Map.Entry<String, String>> extraTokenBodyParameters;
66-
6758
// If this flag is true, we will send the x-ms-PKeyAuth Header to the token endpoint.
6859
// Note: this flag is transferred to a MicrosoftTokenRequest in BaseController.
6960
@Expose
@@ -83,11 +74,6 @@ public boolean isRequestForResourceAccount() {
8374
return false;
8475
}
8576

86-
@Override
87-
public List<Map.Entry<String, String>> getExtraTokenBodyParameters() {
88-
return this.extraTokenBodyParameters == null ? null : new ArrayList<>(this.extraTokenBodyParameters);
89-
}
90-
9177
@Override
9278
public void validate() throws ArgumentException {
9379
if (callerUid == 0) {

common4j/src/main/com/microsoft/identity/common/java/commands/parameters/IHasExtraTokenBodyParameters.java

Lines changed: 0 additions & 41 deletions
This file was deleted.

common4j/src/main/com/microsoft/identity/common/java/commands/parameters/InteractiveTokenCommandParameters.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
@Getter
4242
@EqualsAndHashCode(callSuper = true)
4343
@SuperBuilder(toBuilder = true)
44-
public class InteractiveTokenCommandParameters extends TokenCommandParameters
45-
implements IHasExtraTokenBodyParameters {
44+
public class InteractiveTokenCommandParameters extends TokenCommandParameters {
4645

4746
private final transient List<BrowserDescriptor> browserSafeList;
4847

@@ -71,9 +70,6 @@ public class InteractiveTokenCommandParameters extends TokenCommandParameters
7170

7271
private final List<Map.Entry<String, String>> extraQueryStringParameters;
7372

74-
// Only put in the token request body
75-
private final List<Map.Entry<String, String>> extraTokenBodyParameters;
76-
7773
@Expose()
7874
private final List<String> extraScopesToConsent;
7975

@@ -95,11 +91,6 @@ public List<Map.Entry<String, String>> getExtraQueryStringParameters() {
9591
return this.extraQueryStringParameters == null ? null : new ArrayList<>(this.extraQueryStringParameters);
9692
}
9793

98-
@Override
99-
public List<Map.Entry<String, String>> getExtraTokenBodyParameters() {
100-
return this.extraTokenBodyParameters == null ? null : new ArrayList<>(this.extraTokenBodyParameters);
101-
}
102-
10394
public List<String> getExtraScopesToConsent() {
10495
return this.extraScopesToConsent == null ? null : new ArrayList<>(this.extraScopesToConsent);
10596
}

common4j/src/main/com/microsoft/identity/common/java/commands/parameters/TokenCommandParameters.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
import com.microsoft.identity.common.java.authscheme.AbstractAuthenticationScheme;
2929
import com.microsoft.identity.common.java.dto.IAccountRecord;
3030
import com.microsoft.identity.common.java.logging.Logger;
31-
import com.microsoft.identity.common.java.util.StringUtil;
3231

32+
import java.util.ArrayList;
3333
import java.util.Arrays;
3434
import java.util.HashSet;
3535
import java.util.List;
@@ -73,10 +73,17 @@ public class TokenCommandParameters extends CommandParameters {
7373

7474
private final List<Map.Entry<String, String>> extraOptions;
7575

76+
// Only put in the token request body
77+
private final List<Map.Entry<String, String>> extraTokenBodyParameters;
78+
7679
public Set<String> getScopes() {
7780
return this.scopes == null ? null : new HashSet<>(this.scopes);
7881
}
7982

83+
public List<Map.Entry<String, String>> getExtraTokenBodyParameters() {
84+
return this.extraTokenBodyParameters == null ? null : new ArrayList<>(this.extraTokenBodyParameters);
85+
}
86+
8087
public String getMamEnrollmentId(){
8188
return mamEnrollmentId;
8289
}

0 commit comments

Comments
 (0)