How to add new domain in whitelist via Java API?

Przemysław Stępniak
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 12, 2020

Hi,

I'm looking for a way to add a my domain to the whitelist on the Jira server using Java API. 

 

I've done some research and found:

InternalWhitelistManager 

 

I've created this PoC:

@Named
public class WhitelistTestService{

private final InternalWhitelistManager internalWhitelistManager;

@Inject
public InstallService(@ComponentImport InternalWhitelistManager internalWhitelistManager ) {

this.internalWhitelistManager = internalWhitelistManager;
}

public void addAddress() {
String address = "https://example.page.net";

List<String> rules = new ArrayList<>(internalWhitelistManager.getRules());

rules.add(address);

internalWhitelistManager.updateRules(rules, internalWhitelistManager.isDisabled());
}
}

 But the result is:

whitelistpic.PNG

 

I need to add new domain and set type as Domain name and Allow incoming to true

In documentation (link) I've found: 

After I implemented this, only equals sign(=) changed type to Exact match.

0 answers

Suggest an answer

Log in or Sign up to answer