-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathDevLoginStartupWarning.java
More file actions
27 lines (24 loc) · 1.03 KB
/
Copy pathDevLoginStartupWarning.java
File metadata and controls
27 lines (24 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.digitalsanctuary.spring.user.dev;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
import jakarta.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;
/**
* Logs a prominent warning on startup when the dev login feature is active.
* This ensures developers are aware that passwordless authentication is enabled.
*/
@Slf4j
@Component
@Profile("local")
@ConditionalOnProperty(name = "user.dev.auto-login-enabled", havingValue = "true", matchIfMissing = false)
public class DevLoginStartupWarning {
@PostConstruct
public void logWarning() {
log.warn("========================================================");
log.warn(" DEV LOGIN IS ACTIVE");
log.warn(" Passwordless authentication is enabled at /dev/login-as/{email}");
log.warn(" DO NOT enable this in production!");
log.warn("========================================================");
}
}