Skip to content

Commit

Permalink
ForcePasswordChangeFilter should not run on /ws
Browse files Browse the repository at this point in the history
  • Loading branch information
ibacher committed Oct 10, 2024
1 parent d111cdf commit fea2c6e
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public void destroy() {
*/
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
ServletException {
String requestURI = ((HttpServletRequest) request).getRequestURI();
HttpServletRequest httpRequest = (HttpServletRequest) request;
String requestURI = httpRequest.getRequestURI().substring(httpRequest.getContextPath().length());

if (Context.isAuthenticated()
&& new UserProperties(Context.getAuthenticatedUser().getUserProperties()).isSupposedToChangePassword()
Expand All @@ -65,10 +66,13 @@ && shouldNotAllowAccessToUrl(requestURI)) {
* Method to check if the request url is an excluded url.
*
* @param requestURI
* @param excludeURL
* @return
*/
private boolean shouldNotAllowAccessToUrl(String requestURI) {
// /ws is reserved
if (requestURI.startsWith("/ws")) {
return false;
}

for (String url : excludedURLs) {
if (requestURI.endsWith(url)) {
Expand Down

0 comments on commit fea2c6e

Please sign in to comment.