# Task 5 Report: 토큰 인증 인터셉터 + 매핑 + 시큐리티 예외 ## Files Changed ### Created - `src/main/java/itn/com/cmm/interceptor/DashboardApiAuthInterceptor.java` ### Modified - `src/main/webapp/WEB-INF/config/egovframework/springmvc/egov-interceptor-servlet.xml` - `src/main/resources/egovframework/spring/com/context-security.xml` --- ## XML Snippets Added ### egov-interceptor-servlet.xml — inside ``, first position ```xml ``` Style mirrors existing interceptors: ``/`` are in the default `mvc` namespace; the bean uses the `beans:` prefix as ``, matching `InterceptorHandler` and `IPIgnoreInterceptorHandler`. ### context-security.xml — after existing `security="none"` entries (line 16) ```xml ``` Placed immediately after the `\A/WEB-INF/jsp/.*\Z` regex entry, before ``. --- ## @Value / globalSettings Pattern Verification Reference file: `src/main/java/itn/let/mjo/api/sms/web/ApiSmsTestMsgController.java` line 32: ```java @Value("#{globalSettings['Globals.api.ip']}") private String API_IP; ``` The new interceptor uses: ```java @Value("#{globalSettings['Globals.dashboard.api.token']}") private String apiToken; ``` Identical SpEL pattern `#{globalSettings['']}`. The `globalSettings` bean is defined in `context-properties.xml` and is available in the dispatcher servlet context (interceptors are registered there and Spring injects `@Value` into interceptor beans declared via `` in the servlet context). Pattern confirmed to match the reference. --- ## XML Well-Formedness Confirmation ### egov-interceptor-servlet.xml - Root element: `` (line 2) — closed at line 40 ``. Balanced. - `` (line 10) — closed at line 38 ``. Balanced. - New `` block (lines 11-15): `` self-closing, `` self-closing, `` closes. Balanced. - Namespaces: `mvc` default, `beans:` prefix. New snippet uses correct prefixes. ### context-security.xml - Root element: `` (line 2) — closed at line 95 (original line 95) ``. Balanced. - New entry is a self-closing `` element using the already-declared `security:` namespace. Well-formed. --- ## Commit Short Hash (See below — recorded after commit) --- ## Concerns / Notes 1. **@Value injection into interceptor**: Spring injects `@Value` into interceptor beans only when the bean is instantiated by the application context (i.e., declared as `` in the servlet XML). This pattern is consistent with how the project already declares interceptor beans in `egov-interceptor-servlet.xml`. 2. **IPIgnoreInterceptorHandler also matches `/api/dashboard/**`**: The `/**` mapping interceptor still runs on this path. That interceptor only logs specific URI patterns (`errorLogInsert`, `*Ajax.do`, etc.) and will not block the API flow. 3. **mvn/curl verification deferred**: Plan Steps 4-6 (mvn clean package, mvn tomcat7:run, curl 401/200 checks) could NOT be run in this environment — mvn and curl are not available. Verification was performed statically: file content read-back, XML tag balance check, @Value pattern cross-reference. Runtime verification must be performed by the developer in IntelliJ (Run → Deploy, then manual curl or browser test). 4. **Token value**: `globals_local.properties` / `globals_dev.properties` / `globals_prod.properties` all contain `Globals.dashboard.api.token=CHANGE_ME_TOKEN`. Replace with a real secret before deploying to production.