### fix: behebe CORS- und Config-Probleme
- **MailServiceApplication:** Füge `scanBasePackages` hinzu, um `GlobalSecurityConfig` korrekt zu laden. - **GlobalSecurityConfig:** Erlaube Zugriff auf `/api/mail/nennung` ohne Authentifizierung. - **MailController:** Entferne redundante `@CrossOrigin` Annotation. - **UI:** Aktualisiere Versionsmarker auf `v2026-04-23.16 - CORS & CONFIG FIX`.
This commit is contained in:
+2
@@ -35,6 +35,8 @@ class GlobalSecurityConfig {
|
||||
// Explizite Freigaben (Health, Information, Public-Endpoints)
|
||||
auth.requestMatchers("/actuator/**").permitAll()
|
||||
auth.requestMatchers("/api/v1/devices/register").permitAll() // Onboarding erlauben
|
||||
auth.requestMatchers("/api/mail/nennung").permitAll() // Plan-B Nennungen erlauben
|
||||
auth.requestMatchers("/api/mail/nennungen").authenticated() // Liste schützen
|
||||
auth.requestMatchers("/ping/public").permitAll()
|
||||
auth.requestMatchers("/ping/simple").permitAll()
|
||||
auth.requestMatchers("/ping/health").permitAll()
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import org.springframework.boot.runApplication
|
||||
import org.springframework.context.event.EventListener
|
||||
import org.springframework.core.env.Environment
|
||||
|
||||
@SpringBootApplication
|
||||
@SpringBootApplication(scanBasePackages = ["at.mocode.mail", "at.mocode.infrastructure.security"])
|
||||
class MailServiceApplication(private val env: Environment) {
|
||||
|
||||
private val log = LoggerFactory.getLogger(MailServiceApplication::class.java)
|
||||
|
||||
-5
@@ -39,11 +39,6 @@ data class NennungRequest(
|
||||
@OptIn(ExperimentalUuidApi::class)
|
||||
@RestController
|
||||
@RequestMapping("/api/mail")
|
||||
@CrossOrigin(
|
||||
origins = ["http://localhost:8080", "https://nennung.mo-code.at", "https://app.mo-code.at", "https://api.mo-code.at"],
|
||||
allowedHeaders = ["*"],
|
||||
methods = [RequestMethod.GET, RequestMethod.POST, RequestMethod.PUT, RequestMethod.DELETE, RequestMethod.OPTIONS]
|
||||
) // Für Wasm-Web-App (Compose HTML/Wasm)
|
||||
class MailController(
|
||||
private val nennungRepository: NennungRepository,
|
||||
private val mailSender: JavaMailSender
|
||||
|
||||
Reference in New Issue
Block a user