Skip to content
This repository has been archived by the owner on Jun 10, 2019. It is now read-only.

Commit

Permalink
Merge pull request #435 from pedroigor/master
Browse files Browse the repository at this point in the history
[PLINK-630] - Reuse the same Identity instance during request processing.
  • Loading branch information
pedroigor committed Nov 16, 2014
2 parents 4fbdc61 + 858e243 commit 2772a22
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,16 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo

pathConfiguration = this.pathMatcher.matches(request);

performAuthenticationIfRequired(pathConfiguration, request, response);
Identity identity = getIdentity();

performAuthenticationIfRequired(pathConfiguration, identity, request, response);

if (isSecured(pathConfiguration)) {
if (!isMethodAllowed(pathConfiguration, request)) {
throw new MethodNotAllowedException("The given method is not allowed [" + request.getMethod() + "] for path [" + pathConfiguration.getUri() + "].");
}

if (!response.isCommitted()) {
Identity identity = getIdentity();

if (!identity.isLoggedIn()) {
challengeClientForCredentials(pathConfiguration, request, response);
} else if (isLogoutPath(pathConfiguration)) {
Expand Down Expand Up @@ -364,8 +364,8 @@ private void challengeClientForCredentials(PathConfiguration pathConfiguration,
}
}

private void performAuthenticationIfRequired(PathConfiguration pathConfiguration, HttpServletRequest request, HttpServletResponse response) throws IOException {
Identity identity = getIdentity();
private void performAuthenticationIfRequired(PathConfiguration pathConfiguration, Identity identity,
HttpServletRequest request, HttpServletResponse response) throws IOException {
HttpAuthenticationScheme authenticationScheme = getAuthenticationScheme(pathConfiguration, request);

if (authenticationScheme != null) {
Expand Down

0 comments on commit 2772a22

Please sign in to comment.