If I have a controller method
@RequestMapping (value = "/boards/{id}")
public String viewBoard(@PathVariable(value="id") String id){/*..*/}
How can I dynamically, at run-time
, pre authorize
the user for it by querying the database
and getting the desired value for that board id access (for the logged in user).
I tried to research on runtime dynamic
spring security permissions with spring security roles but couldnt find a working example.
Further elaboration:
It means, every time the user wants to access that method, the database is checked that whether the user has permissions for it.
This cannot be done in roles
as there might be millions of cases. e.g. one user may have view access for a board id 3 but not for board id 10003
some links I got:
http://docs.spring.io/spring-security/site/docs/3.1.x/reference/ns-config.html#ns-method-security
http://docs.spring.io/spring-security/site/docs/3.0.x/reference/el-access.html
http://www.javabeat.net/separating-roles-and-permissions-in-spring-security/
Further info:
I am using public class CustomUserDetailsService implements UserDetailsService{
to give users Roles at login time. But thats a different story.