package com.micer.easyball.controller;

import com.micer.easyball.ApiVersion;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(ApiVersion.V1)
public class InternalController {

    /**
     * 已收紧：仅允许具备管理员角色的用户访问此内部敏感接口。
     */
    @PreAuthorize("@ex.hasRole('ROLE_ADMIN')")
    @GetMapping("/internal/secret")
    public String getSecret() {
        return "{" +
                "\"db_username\": \"root\", " +
                "\"db_password\": \"<redacted>\", " +
                "\"cloud_access_key\": \"<redacted>\"" +
                "}";
    }
}