I have a spring project with working security configured, what I'm trying to do is set up a specific path that will accept REST calls with just basic user/password authentication, which can be hard-coded.
I know it is a bit of a weird case, but I have a very specific use-case for this.
The security code looks similar to:
@Override
public void configure(HttpSecurity http) throws Exception {
http
...
.and()
.authorizeRequests()
.antMatchers("my-path/**").authenticated()
}
I don't really understand how spring does all the magic, but I would have liked it to look something like:
@Override
public void configure(HttpSecurity http) throws Exception {
http
...
.and()
.authorizeRequests()
.antMatchers("my-path/**").authenticatedWithUserPassword("user", "pswd")
}
2 things that must happen:
- I want this user/pswd to work for this path and this path only!
- I want this path to work only for this user/pswd and for no other authentication types!