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

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -