rest - Spring OAuth 2: public access to a resource -
how allow public access in specific url in spring security oauth-2 rest application.
i have urls started /rest/** secured, make /rest/about public, not require user authenticate access it. tried using permitall() still requires token in request. httpsecurity configuration:
@configuration @enableresourceserver protected static class resourceserverconfiguration extends resourceserverconfigureradapter { @override public void configure(resourceserversecurityconfigurer resources) { resources.resourceid(resource_id); } @override public void configure(httpsecurity http) throws exception { http .authorizerequests() .antmatchers("/rest/about").permitall() .antmatchers("/rest/**").authenticated() ; } } a request /rest/about still returns 401 unauthorized - "error":"unauthorized","error_description":"full authentication required access resource"
found answer. needed add anonymous():
public void configure(httpsecurity http) throws exception { http .anonymous().and() .authorizerequests() .antmatchers("/rest/about").permitall() .antmatchers("/rest/**").authenticated() ; } got answer from: https://stackoverflow.com/a/25280897/256245
Comments
Post a Comment