java - annotation security spring file properties -
i want use annotation @preauthorized , @postauthorized in application in spring, use , not nothing. need activate "something" in application.properties, don´t know that. read put servlet.xl
<global-method-security pre-post-annotations="enabled" />
but in file properties? use java annotations haven't activate this.
i suggest use configurations this:
@configuration @enableglobalmethodsecurity(prepostenabled = true) @enablewebsecurity public class authenticationconfiguration extends websecurityconfigureradapter { // authorisation service, need provide 1 @autowired private userauthenticationservice userdetailsservice; @override protected void configure(authenticationmanagerbuilder auth) throws exception { auth.userdetailsservice(userdetailsservice); } @override protected void configure(httpsecurity http) throws exception { http.authorizerequests().anyrequest().fullyauthenticated(); http.httpbasic(); http.csrf().disable(); } }
there pretty nice tutorial this on here, should read , try replicate step step, there more information on topic can put here: building secure rest api spring data rest , java 8
Comments
Post a Comment