jwt - Spring boot and JWTToken and how to authenticate the User -
i learning how implement jwt token generation spring boot restful controller , following article on https://auth0.com/blog/securing-spring-boot-with-jwts/
by following article able generate jwt token , able access /users. in article author defaulted user name , password below:
public class websecurityconfig extends websecurityconfigureradapter {
@override protected void configure(httpsecurity http) throws exception { // disable caching http.headers().cachecontrol(); http.csrf().disable() // disable csrf our requests. .authorizerequests() .antmatchers("/").permitall() .antmatchers(httpmethod.post, "/login").permitall() .anyrequest().authenticated() .and() // filter api/login requests .addfilterbefore(new jwtloginfilter("/login", authenticationmanager()), usernamepasswordauthenticationfilter.class) // , filter other requests check presence of jwt in header .addfilterbefore(new jwtauthenticationfilter(), usernamepasswordauthenticationfilter.class); } @override protected void configure(authenticationmanagerbuilder auth) throws exception { // create default account auth.inmemoryauthentication() .withuser("admin") .password("password") .roles("admin"); }
}
i trying understand how authenticate credential s of user hitting data base or dao layer please me wrote mean in while file { tokenauthenticationservice ,jwtloginfilter, jwtauthenticationfilter }and mehod () dao layer code
Comments
Post a Comment