use of eu.openanalytics.shinyproxy.auth.LogoutHandler in project shinyproxy by openanalytics.
the class WebSecurityConfig method configure.
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().headers().frameOptions().disable();
if (auth.hasAuthorization()) {
// Limit access to the app pages
http.authorizeRequests().antMatchers("/login", "/signin/**", "/signup").permitAll();
for (ShinyApp app : appService.getApps()) {
String[] groups = app.getGroups();
if (groups == null || groups.length == 0)
continue;
String[] appGroups = Arrays.stream(groups).map(s -> s.toUpperCase()).toArray(i -> new String[i]);
http.authorizeRequests().antMatchers("/app/" + app.getName()).hasAnyRole(appGroups);
}
// Limit access to the admin pages
http.authorizeRequests().antMatchers("/admin").hasAnyRole(userService.getAdminGroups());
// All other pages are available to authenticated users
http.authorizeRequests().anyRequest().fullyAuthenticated();
http.formLogin().loginPage("/login").and().logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")).logoutSuccessHandler(logoutHandler).logoutSuccessUrl("/login");
}
auth.configureHttpSecurity(http);
}
Aggregations