create cook ie в методе successAuthentication (в моем устройстве authenticationFilter),
Cookie cookie = new Cookie("test", token);
cookie.setMaxAge(24*60*60);
cookie.setHttpOnly(true);
cookie.setPath("/");
response.addCookie(cookie);
Моя конфигурация безопасности в API-шлюзе (Zuul) -
http.cors();
http.csrf().disable();
http.headers().frameOptions();
http.authorizeRequests()
.antMatchers(HttpMethod.POST,
environment.getProperty("signup.url.path")).permitAll()
.antMatchers(HttpMethod.POST,
environment.getProperty("login.url.path")).permitAll()
.antMatchers(HttpMethod.POST,
environment.getProperty("syncuser.url.path")).permitAll()
//.antMatchers(environment.getProperty("login.h2.path")).permitAll()
//.antMatchers(environment.getProperty("user.h2.path")).permitAll()
.anyRequest().authenticated()
.and().addFilter(new AuthorizationFilter(authenticationManager(), environment));
//http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
конфигурация безопасности в приложении аутентификации -
http.csrf().disable();
http.authorizeRequests()
.antMatchers(environment.getProperty("allowed.urls")).permitAll()
.and().addFilter(loginFilter());
//http.headers().frameOptions().disable();
Заголовок ответа -
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: http://localhost:4200
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Connection: keep-alive
Content-Type: application/json;charset=UTF-8
Date: Tue, 18 Feb 2020 08:08:30 GMT
Expires: 0
Keep-Alive: timeout=60
Pragma: no-cache
token: eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIyYmVkMjA5MS0yZDNiLTQ5MjUtYTNjYi03MTdkNWExNjg3ZDEiLCJleHAiOjE1ODIwMTY5MDl9.06K_G_9d-ulN7cI8VdBfF5NTVXAFUXv5QFjL-32p95AEAwM2wCSqE_cTxVjuKNswW18X8fIF3WyFgoITFvbRsA
Transfer-Encoding: chunked
userID: 2bed2091-2d3b-4925-a3cb-717d5a1687d1
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
и запрос
Accept: application/json, text/plain, */*
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Connection: keep-alive
Content-Length: 57
Content-Type: application/json
Host: localhost:8011
Origin: http://localhost:4200
Referer: http://localhost:4200/atlantis-auth
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-site
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36
Я вижу другие значения, которые я добавляю в заголовок, такие как userID и token ... I также не вижу никакой ошибки