How
support change header value of the response
It’s very simple and doesn’t require any additional settings.
In your service implementation, you can set the desired response object, including the body and headers. It’s super easy to implement!
private static HttpCookie buildCookie(final String jwt){
return
ResponseCookie.from("Authorization",jwt)
.path("/")
.maxAge(Duration.ofDays(1))
.httpOnly(true).build();
}
@Override
public void login(
final SimpleResultBuilder<LoginResponse> builder, final LoginRequest loginRequest) {
//...
builder.body().header(HttpHeaders.SET_COOKIE, buildCookie(jwt).toString());
//....
}
As demo, we will set cookie
in the HTTP response.