@@ -40,6 +40,7 @@ bin/
|
||||
|
||||
# Gradle
|
||||
.gradle/
|
||||
.gradle-cache/
|
||||
**/backend/.gradle/
|
||||
|
||||
# Cache
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.erp.provisioning;
|
||||
|
||||
import com.erp.tenant.ReservedSubdomains;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -17,7 +18,6 @@ import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Phase 3-A 프로비저닝 API.
|
||||
@@ -48,12 +48,6 @@ public class ProvisioningController {
|
||||
@Value("${tenant.provisioning.require-super-admin:false}")
|
||||
private boolean requireSuperAdmin;
|
||||
|
||||
private static final Set<String> RESERVED_SUBDOMAINS = Set.of(
|
||||
"www", "admin", "api", "app", "static", "assets",
|
||||
"main", "mail", "blog", "dev", "test", "staging", "prod", "console",
|
||||
"solution"
|
||||
);
|
||||
|
||||
@GetMapping("/table-groups")
|
||||
public ResponseEntity<List<Map<String, Object>>> tableGroups(HttpServletRequest request) {
|
||||
enforceSuperAdmin(request);
|
||||
@@ -91,7 +85,7 @@ public class ProvisioningController {
|
||||
Map<String, Object> sub = new LinkedHashMap<>();
|
||||
sub.put("value", subdomain);
|
||||
sub.put("valid_format", formatOk);
|
||||
sub.put("reserved", RESERVED_SUBDOMAINS.contains(subdomain));
|
||||
sub.put("reserved", ReservedSubdomains.VALUES.contains(subdomain));
|
||||
sub.put("available", formatOk && !exists);
|
||||
sub.put("url_preview", subdomain + ".invyone.com");
|
||||
result.put("subdomain", sub);
|
||||
@@ -242,7 +236,7 @@ public class ProvisioningController {
|
||||
private static boolean isValidSubdomain(String s) {
|
||||
return s != null
|
||||
&& s.matches("^[a-z][a-z0-9-]{2,30}$")
|
||||
&& !RESERVED_SUBDOMAINS.contains(s);
|
||||
&& !ReservedSubdomains.VALUES.contains(s);
|
||||
}
|
||||
|
||||
private static boolean isValidDbPrefix(String s) {
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.erp.tenant;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public final class ReservedSubdomains {
|
||||
|
||||
public static final Set<String> VALUES = Set.of(
|
||||
"www", "admin", "api", "app", "static", "assets",
|
||||
"main", "mail", "blog", "dev", "test", "staging", "prod", "console",
|
||||
"solution"
|
||||
);
|
||||
|
||||
private ReservedSubdomains() {
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public class SubdomainResolverFilter extends OncePerRequestFilter {
|
||||
if (parts.length < 3) return null; // invyone.com (2파트) → null
|
||||
|
||||
String first = parts[0];
|
||||
if ("www".equals(first) || "admin".equals(first)) return null;
|
||||
if (ReservedSubdomains.VALUES.contains(first)) return null;
|
||||
|
||||
return first;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user