2026-01-10 17:14:04 +01:00
|
|
|
package com.commafeed.security;
|
|
|
|
|
|
2026-07-05 10:18:30 +02:00
|
|
|
import io.quarkus.vertx.http.runtime.VertxHttpConfig;
|
2026-07-29 20:36:03 +02:00
|
|
|
|
2026-01-10 17:14:04 +01:00
|
|
|
import jakarta.inject.Singleton;
|
|
|
|
|
import jakarta.ws.rs.core.NewCookie;
|
2026-07-29 20:36:03 +02:00
|
|
|
|
2026-07-05 10:18:30 +02:00
|
|
|
import java.time.Instant;
|
|
|
|
|
import java.util.Date;
|
2026-01-10 17:14:04 +01:00
|
|
|
|
|
|
|
|
@Singleton
|
|
|
|
|
public class CookieService {
|
|
|
|
|
|
2026-07-05 10:18:30 +02:00
|
|
|
private final String cookieName;
|
2026-01-10 17:14:04 +01:00
|
|
|
|
2026-07-05 10:18:30 +02:00
|
|
|
public CookieService(VertxHttpConfig config) {
|
|
|
|
|
this.cookieName = config.auth().form().cookieName();
|
|
|
|
|
}
|
2026-01-10 17:14:04 +01:00
|
|
|
|
2026-07-05 10:18:30 +02:00
|
|
|
public NewCookie buildLogoutCookie() {
|
2026-11-03 06:48:11 +01:00
|
|
|
return new NewCookie.Builder(cookieName).maxAge(0).expiry(Date.from(Instant.EPOCH)).path("/").build();
|
2026-07-05 10:18:30 +02:00
|
|
|
}
|
2026-01-10 17:14:04 +01:00
|
|
|
}
|