Home Ask Login Register

Developers Planet

Your answer is one click away!

user3452075 February 2016

Spring - Http Basic Auth - Mark endpoint as public

I am using spring for providing basic http authentication. For this I am simply setting user and password in the application.properies:

enter image description here

However, I would like to expose an endpoint/or a static file as public (no authentication required for this). Is there a simple way to do this?

I find the spring documentation quite hard to search so any tips would be appreciated.


nobeh February 2016

You can use a method to configure the endpoints on your application:

protected void configure(HttpSecurity http) throws Exception {
            .antMatchers("/", "/public/**").permitAll()

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

Post Status

Asked in February 2016
Viewed 2,652 times
Voted 14
Answered 1 times


Leave an answer

Quote of the day: live life