forked from baron/baron-sso
조직도 M2M조회 추가, 자동로그인 보완
This commit is contained in:
@@ -84,6 +84,10 @@ func validateScope(method, path string, rawScopes string) bool {
|
||||
scopeMap[s] = true
|
||||
}
|
||||
|
||||
if strings.Contains(path, "/integrations/org-context") {
|
||||
return method == fiber.MethodGet && scopeMap["org-context:read"]
|
||||
}
|
||||
|
||||
// 1. 감사 로그 관련 (audit:*)
|
||||
if strings.Contains(path, "/admin/audit") || strings.Contains(path, "/v1/audit") {
|
||||
if method == fiber.MethodGet {
|
||||
|
||||
15
backend/internal/middleware/api_key_auth_test.go
Normal file
15
backend/internal/middleware/api_key_auth_test.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestValidateScope_AllowsOrgContextReadOnly(t *testing.T) {
|
||||
require.True(t, validateScope(fiber.MethodGet, "/api/v1/integrations/org-context", "org-context:read"))
|
||||
require.False(t, validateScope(fiber.MethodPost, "/api/v1/integrations/org-context", "org-context:read"))
|
||||
require.False(t, validateScope(fiber.MethodGet, "/api/v1/integrations/org-context", "tenant:read"))
|
||||
require.False(t, validateScope(fiber.MethodGet, "/api/v1/orgfront/org-context", "org-context:read"))
|
||||
}
|
||||
Reference in New Issue
Block a user