Skip to content

Commit

Permalink
[SHIBUI-1179]
Browse files Browse the repository at this point in the history
Replaced static.html web security entry with a new /unsecured/**/*
entry. Updated new user redirect to redirect to /unsecured/error.html.
Updated tests.
  • Loading branch information
Bill Smith committed Jan 23, 2019
1 parent 1a8aa58 commit 983780d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
user = persistedUser.get();
}
if (user.getRole().equals(ROLE_NONE)) {
((HttpServletResponse) response).sendRedirect("/static.html");
((HttpServletResponse) response).sendRedirect("/unsecured/error.html");
} else {
chain.doFilter(request, response); // else, user is in the system already, carry on
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ protected void configure(HttpSecurity http) throws Exception {

@Configuration
@Order(1)
public static class StaticSecurityConfiguration extends WebSecurityConfigurerAdapter {
public static class UnsecuredSecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.antMatcher("/static.html").authorizeRequests().antMatchers("/static.html").permitAll();
http.antMatcher("/unsecured/**/*").authorizeRequests().antMatchers("/unsecured/**/*").permitAll();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class AddNewUserFilterTests extends Specification {
1 * roleRepository.save(_)
1 * userRepository.save(_)
1 * emailService.sendNewUserMail('newUser')
1 * response.sendRedirect("/static.html")
1 * response.sendRedirect("/unsecured/error.html")
}

def "existing users are not redirected"() {
Expand Down

0 comments on commit 983780d

Please sign in to comment.