java - Spring - Http Basic Auth - Mark endpoint as public -


i using spring providing basic http authentication. setting user , password in application.properies:

enter image description here

however, expose endpoint/or static file public (no authentication required this). there simple way this?

i find spring documentation quite hard search tips appreciated.

you can use method configure endpoints on application:

protected void configure(httpsecurity http) throws exception {     http.authorizerequests()             .antmatchers("/", "/public/**").permitall()             .antmatchers("/users/**").hasauthority("admin")             .anyrequest().fullyauthenticated()             .and()             .formlogin()             .loginpage("/login")             .failureurl("/login?error")             .usernameparameter("email")             .permitall()             .and()             .logout()             .logouturl("/logout")             .deletecookies("remember-me")             .logoutsuccessurl("/")             .permitall()             .and()             .rememberme(); } 

the complete example can found here: https://github.com/bkielczewski/example-spring-boot-security


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -