private boolean supportsImpersonation(ApplicationLink link) { return link.createImpersonatingAuthenticatedRequestFactory() != null; }
private boolean supportsImpersonation(ApplicationLink link) { return link.createImpersonatingAuthenticatedRequestFactory() != null; }
@GET @Path("getImpersonatingRequestType") public Response getImpersonatingRequestType(@QueryParam("rpc-url") String rpcurl) { ApplicationLink applicationLink = getApplicationLinkByRpcUrl(rpcurl); ApplicationLinkRequestFactory factory = applicationLink.createImpersonatingAuthenticatedRequestFactory(); return ok(getRequestType(factory)).build(); }
public PermissionCode handle(final com.atlassian.sal.api.net.Response response) throws ResponseException { if (response.getStatusCode() == 200) { try { return response.getEntity(PermissionCodeEntity.class).getCode(); } catch (Exception e) { throw new ResponseException( String.format("Permission check failed, exception " + "encountered processing response: %s", e)); } } else if (response.getStatusCode() == 401) { ApplicationLinkRequestFactory authenticatedRequestFactory = applicationLink.createImpersonatingAuthenticatedRequestFactory(); if (authenticatedRequestFactory == null) { authenticatedRequestFactory = applicationLink.createNonImpersonatingAuthenticatedRequestFactory(); } if (authenticatedRequestFactory != null) { LOG.warn("Authentication failed for application link " + applicationLink + ". Response headers: " + response.getHeaders().toString() + " body: " + response.getResponseBodyAsString()); } else if (LOG.isDebugEnabled()) { LOG.debug("Authentication failed for application link " + applicationLink + ". Response headers: " + response.getHeaders().toString() + " body: " + response.getResponseBodyAsString()); } return AUTHENTICATION_FAILED; } else { throw new ResponseException(String.format("Permission check failed, received %s", response.getStatusCode())); } } });