spring - Securing a REST application in SpringBoot and accessing it from a Rest Client -


i pretty new springboot. have developed rest server wondering how perform basic authentication client , how configure spring boot server authenticate request. tutorials saw online didn't include restful client. great if can show code including both client request , server authentication process springboot rest.

on client side since using jersey client need following:

client c = client.create(); c.addfilter(new httpbasicauthfilter(user, password)); 

one server side need enable spring security , set basic authentication following (this simplest possible case).

@configuration @enablewebsecurity public class rootconfig extends websecurityconfigureradapter {  @override protected void registerauthentication(authenticationmanagerbuilder auth) throws exception { auth.inmemoryauthentication()     .withuser("tester").password("passwd").roles("user"); }  @override protected void configure(httpsecurity http) throws exception {      http      .authorizeurls()          .anyrequest().authenticated()          .and()      .httpbasic();          } } 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -