in commit-status-publisher-server/src/main/java/jetbrains/buildServer/commitPublisher/stash/StashSettings.java [146:186]
public PropertiesProcessor getParametersProcessor(@NotNull BuildTypeIdentity buildTypeOrTemplate) {
return new PropertiesProcessor() {
public Collection<InvalidProperty> process(Map<String, String> params) {
List<InvalidProperty> errors = new ArrayList<>();
final String authType = getAuthType(params);
switch(authType) {
case Constants.PASSWORD:
params.remove(Constants.TOKEN_ID);
mandatoryString(Constants.STASH_USERNAME, "Username must be specified", params, errors);
mandatoryString(Constants.STASH_PASSWORD, "Password must be specified", params, errors);
break;
case Constants.AUTH_TYPE_STORED_TOKEN:
params.remove(Constants.STASH_USERNAME);
params.remove(Constants.STASH_PASSWORD);
mandatoryString(Constants.TOKEN_ID, "No token configured", params, errors);
break;
case Constants.AUTH_TYPE_VCS:
params.remove(Constants.STASH_USERNAME);
params.remove(Constants.STASH_PASSWORD);
params.remove(Constants.TOKEN_ID);
String vcsRootId = params.get(Constants.VCS_ROOT_ID_PARAM);
SVcsRoot vcsRoot = null == vcsRootId ? null : myProjectManager.findVcsRootByExternalId(vcsRootId);
if (null != vcsRoot) {
String vcsUrl = vcsRoot.getProperty("url");
if (!StringUtil.isEmpty(vcsUrl) && !vcsUrl.trim().toLowerCase().startsWith("http"))
errors.add(new InvalidProperty(Constants.AUTH_TYPE, "Credentials can not be extracted as the selected VCS root uses non-HTTP(S) fetch URL"));
}
break;
default:
errors.add(new InvalidProperty(Constants.AUTH_TYPE, "Unsupported authentication type"));
}
return errors;
}
};
}