user971169 user971169 - 4 months ago 63
reST (reStructuredText) Question

spring boot ldap group and restricted endpoints

I want to restrict certain rest endpoints to be only for LDAP users in a certain group.

I followed the guide to setup LDAP authentication which is working perfectly. So how do I restrict certain rest endpoints?

I tried

public String foo(HttpServletRequest request) {
return "Welcome to FOO " + request.getRemoteUser();

but it still lets users not in the developers group access that endpoint


@EnableGlobalMethodSecurity(securedEnabled=true) needed to be added to the webSecurityConfig. Once I did that I was able to use @Secured("ROLE_DEVELOPERS") and that method was then restricted to that role.