Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Mar 14, 2023
2 parents dd68a9a + d6ef62e commit e5d6b28
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.DefaultRedirectStrategy;
import org.springframework.security.web.WebAttributes;
import org.springframework.security.web.util.UrlUtils;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
Expand Down Expand Up @@ -463,9 +464,13 @@ private AuthenticationsPolicyType getAuthenticationPolicy(
}
}

private void processingOfAuthenticatedRequest(MidpointAuthentication mpAuthentication, ServletRequest httpRequest, ServletResponse response, FilterChain chain) throws IOException, ServletException {
private void processingOfAuthenticatedRequest(MidpointAuthentication mpAuthentication, HttpServletRequest httpRequest, ServletResponse response, FilterChain chain) throws IOException, ServletException {
for (ModuleAuthentication moduleAuthentication : mpAuthentication.getAuthentications()) {
if (AuthenticationModuleState.SUCCESSFULLY.equals(moduleAuthentication.getState())) {
if(AuthSequenceUtil.isUrlForAuthProcessing(httpRequest)) {
new DefaultRedirectStrategy().sendRedirect(httpRequest, (HttpServletResponse) response, "/");
return;
}
int i = mpAuthentication.getIndexOfModule(moduleAuthentication);
VirtualFilterChain vfc = new VirtualFilterChain(chain,
((AuthModuleImpl) mpAuthentication.getAuthModules().get(i)).getSecurityFilterChain().getFilters());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -642,4 +642,8 @@ public static String getAuthSequenceIdentifier(@NotNull AuthenticationSequenceTy
return StringUtils.isNotEmpty(seq.getIdentifier()) ? seq.getIdentifier() : seq.getName();
}

public static boolean isUrlForAuthProcessing(HttpServletRequest httpRequest) {
String localPath = httpRequest.getRequestURI().substring(httpRequest.getContextPath().length());
return localPath != null && !localPath.isEmpty() && localPath.startsWith(SchemaConstants.AUTH_MODULE_PREFIX);
}
}

0 comments on commit e5d6b28

Please sign in to comment.