removeAccount(IAccount account) {
+ if (brokerEnabled) {
+ broker.removeAccount(this, account);
+ }
+
+ return super.removeAccount(account);
+ }
+
private PublicClientApplication(Builder builder) {
super(builder);
validateNotBlank("clientId", clientId());
log = LoggerFactory.getLogger(PublicClientApplication.class);
this.clientAuthentication = new ClientAuthenticationPost(ClientAuthenticationMethod.NONE,
new ClientID(clientId()));
+ this.broker = builder.broker;
+ this.brokerEnabled = builder.brokerEnabled;
}
@Override
@@ -146,6 +189,22 @@ private Builder(String clientId) {
super(clientId);
}
+ private IBroker broker = null;
+ private boolean brokerEnabled = false;
+
+ /**
+ * Implementation of IBroker that will be used to retrieve tokens
+ *
+ * Setting this will cause MSAL Java to use the given broker implementation to retrieve tokens from a broker (such as WAM/MSALRuntime) in flows that support it
+ */
+ public PublicClientApplication.Builder broker(IBroker val) {
+ this.broker = val;
+
+ this.brokerEnabled = this.broker.isBrokerAvailable();
+
+ return self();
+ }
+
@Override
public PublicClientApplication build() {