private void configureTwoWayAuth(final ConfigureAuthEntity entity, ApplicationLink link) throws AuthenticationConfigurationException { linkService.configureAuthenticationForApplicationLink( link, new AuthenticationScenario() { public boolean isCommonUserBase() { return entity.sharedUserBase; } public boolean isTrusted() { return entity.trusted; } }, entity.username, entity.password); }
@PUT @WebSudoNotRequired @XsrfProtectionExcluded @Path("{applinkid}") public javax.ws.rs.core.Response configureAuthentication(@PathParam("applinkid") String applinkId, RestAuthenticationConfiguration configuration) throws Exception { ApplicationLink applink = applicationLinkService.getApplicationLink(parseApplicationId(applinkId)); applicationLinkService.configureAuthenticationForApplicationLink(applink, configuration.getAuthenticationScenario(), configuration.getUsername(), configuration.getPassword()); return RestResponses.noContent(); }
protected void authenticateApplicationLink(ApplicationLink applicationLink, String username, String password, URI localRpcUrl) throws JiraIntegrationConfigurationException { final AuthenticationScenario authenticationScenario = new AuthenticationScenario() { public boolean isCommonUserBase() { // we're delegating to JIRA for user management, so userbase is definitely common return true; } public boolean isTrusted() { // TODO warn the user in the UI that trust is implicit return true; } }; try { applicationLinkService.configureAuthenticationForApplicationLink(applicationLink, authenticationScenario, username, password); } catch (AuthenticationConfigurationException e) { throw new JiraIntegrationConfigurationException(String.format( "Failed to authenticate application link between JIRA server at %s " + "to this %s server at %s?. Please read the " + "troubleshooting guide.", applicationLink.getRpcUrl(), jiraIntegrationSetupHelper.getApplicationType().getDisplayName(), localRpcUrl), e); } }
applicationLinkService.configureAuthenticationForApplicationLink( createdApplicationLink, new AuthenticationScenario() {