Hello Community, I am working on an app for the first time with the latest versions of Vaadin 24 and Spring-Boot 3. It seems that Vaadin has control over all REST endpoints and of course it does not know the path /api/v2/ of spring-boot.
How do I achieve this separation Vaadin for UI and spring-boot for REST?
For the REST endpoints it does not need authentication.
The user authenticates against LDAP.
public class VaadinWithLdapConfiguration extends VaadinWebSecurity {
@Autowired
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.ldapAuthentication()
.userSearchFilter(userSearchFilter)
.userDnPatterns(userDnPattern)
.contextSource()
.url(String.format(“%s/%s”, url, contextRoot))
.managerDn(managerDn)
.managerPassword(managerPassword)
.and()
.userDetailsContextMapper(ldapMapper);
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeHttpRequests(authz ->
authz.requestMatchers("/public/**").permitAll()
);
super.configure(http);
setLoginView(http, LoginView.class);
}
@Override
public void configure(WebSecurity web) throws Exception {
super.configure(web);
}
}
Now an “agent” is to communicate with this app via Spring Boot REST
@RestController
@RequestMapping(“/api/v2”)
@ResponseBody
public class AgentRegistrationRestController {
private static final Logger LOGGER = LoggerFactory.getLogger(AgentRegistrationRestController.class);
@PostMapping(value = “/agentregistration”, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity registerAgent(@RequestBody AgentRegistration agentRegistration) {
LOGGER.info("REST Endpoint 'RegisterAgent' called");
// more stuff
return ResponseEntity.status(HttpStatus.OK).body("Agent successfully registered");
}
}
I am grateful for any tip.