인증/권한 업무 규칙과 전환 불변식 추출 #2

Open
forge-bot wants to merge 9 commits from forge/codex-bais-final3-20260713-192718-BAIS-SPRING-ANA-AUTH-001-attempt-1-run-f0808bb53869 into main
Showing only changes of commit f449b32ccd - Show all commits

View file

@ -0,0 +1,29 @@
package com.example.auth.security;
import org.springframework.stereotype.Service;
import java.time.Instant;
import java.util.concurrent.ConcurrentHashMap;
/**
* Token Blacklist Service - preserves AUTH-012 invariant.
* Logout immediately invalidates token.
*/
@Service
public class TokenBlacklistService {
private final ConcurrentHashMap<String, Instant> blacklist = new ConcurrentHashMap<>();
public void blacklist(String token) {
blacklist.put(token, Instant.now());
}
public boolean isBlacklisted(String token) {
return blacklist.containsKey(token);
}
public void cleanupExpired() {
Instant cutoff = Instant.now().minusSeconds(7 * 24 * 60 * 60);
blacklist.entrySet().removeIf(entry -> entry.getValue().isBefore(cutoff));
}
}