暂存提交

This commit is contained in:
2026-08-19 16:24:02 +08:00
parent f5c4bf130a
commit 6acb6178da
354 changed files with 25000 additions and 198 deletions
@@ -0,0 +1,12 @@
package com.baiyue.lastleg.security;
import org.junit.jupiter.api.Test;
import org.springframework.web.server.ResponseStatusException;
import static org.junit.jupiter.api.Assertions.*;
class InternalServiceTokenGuardTest {
@Test void acceptsOnlyConfiguredToken() {
InternalServiceTokenGuard guard=new InternalServiceTokenGuard("secret-token");
assertDoesNotThrow(()->guard.verify("secret-token"));
assertEquals(401,assertThrows(ResponseStatusException.class,()->guard.verify("wrong")).getStatusCode().value());
assertEquals(401,assertThrows(ResponseStatusException.class,()->guard.verify(null)).getStatusCode().value());
}
}