من یه وب سرویس رست با Spring Boot 2 نوشتم این وب سرویس روی سیستم خودم درست کار میکنه ولی وقتی می برم روی ماشین مجازی و روی Tomcat بالا میارم خطا عدم دست رسی میده:
{ "timestamp": "2019-11-25T11:09:03.800+0000", "status": 401, "error": "Unauthorized", "message": "A granted authority textual representation is required", "path": "/api/v1/logincas/ddoarppofchhlhvdgv93i30312" }
این هم کد مسیر متدم:
@RestController @RequestMapping(Constants.KEY_API_VER ) public class UserController { @GetMapping(value = "/logincas/{casid}", produces = {MediaType.APPLICATION_JSON_VALUE}) public ResponseEntity> signIn(@PathVariable("casid") String casid) {
…
و این هم نحوی کانفیگ بخش امنیت برنامه:
@Override protected void configure(HttpSecurity http) throws Exception { http.cors().and().csrf().disable() .authorizeRequests() .antMatchers("/**").permitAll() .antMatchers("/api/v1/logincas/**").permitAll() .antMatchers("/login/**").permitAll() .antMatchers("/404/**").permitAll() .antMatchers("/img/**").permitAll() .antMatchers("/fonts/**").permitAll() .antMatchers("/dashboard/**").permitAll() .antMatchers("/dashboard2/**").permitAll() .anyRequest().authenticated() // .and() // .exceptionHandling().accessDeniedHandler(accessDeniedHandler) .and() .exceptionHandling().authenticationEntryPoint(unauthorizedHandler) .and() .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); http.addFilterBefore(authenticationJwtTokenFilter(), UsernamePasswordAuthenticationFilter.class); }
لطفا اگر میش راهنمایی کنید
با تشکر.