Property 'security.basic.enabled' is Deprecated The security auto-configuration is no longer customizable
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Overview
In the ever-evolving landscape of application security, Spring Boot and its ecosystem remain pivotal for Java developers. One important recent change is the deprecation of the `security.basic.enabled` property within Spring Boot. This change has significant implications for developers relying on Spring Boot’s security auto-configurations, necessitating an understanding of alternative methods for securing applications.
Technical Background
Historical Context
Previously, Spring Boot provides a simplistic and opinionated approach to securing web applications via its security auto-configuration. By setting the `security.basic.enabled` property to `true` or `false`, developers could easily toggle basic security configurations without delving deep into detailed security setups.
What Does `security.basic.enabled` Do?
When `security.basic.enabled` was set to `true`:
- It used default username/password authentication (with `user` and a randomly generated password).
- Applied basic HTTP authentication, suitable for many simple applications or prototypes.
- This property could be customized or turned off, allowing developers to plug in a more robust security mechanism as needed.
Why the Change?
The deprecation of the `security.basic.enabled` property reflects a shift towards promoting a more explicit, fine-grained approach to security. There are several reasons for this change:
- Security Best Practices: Reliance on defaults can often lead to vulnerabilities if not properly examined and adapted to specific contexts.
- Customizability: Greater emphasis on building security configurations tailored to application specifics.
- Encouragement for Detailed Configuration: Encourages developers to consider advanced security needs from the beginning—avoiding overreliance on simplistic defaults.
Alternatives and Adjustments
Replacing `security.basic.enabled`
Since the auto-configuration approach is no longer advised or supported for most cases, the following strategies can be implemented:
- Custom Security Configurations: Use Spring Security's comprehensive configuration capabilities. By extending `WebSecurityConfigurerAdapter`, you can customize the `HttpSecurity` bean as per your application's needs.
- For OAuth or OpenID Connect: Integrate these standards for more complex scenarios requiring federated authentication.
- JWT (JSON Web Tokens) for stateless authentication needs.
- Threat Modeling: Identify threats and outline security requirements early in the project lifecycle.
- Use Secure Communication: Always enforce SSL/TLS within your applications.
- Regular Security Audits: Conduct security assessments and pen-testing to ensure no vulnerabilities arise over time.
Related reading
- Pros and cons of RNGCryptoServiceProvider
- Protect .NET code from reverse engineering?
- proxy for distributed file share system in window
- Publishing from Visual Studio 2015 - allow untrusted certificates
- Property 'spring.profiles.active' imported from location 'class path resource application-dev.yml' is invalid
- Provide Spring Boot git and build information via /actuator/info endpoint when using maven as a build tool
- RabbitMQ 3.3.1 can not login with guest/guest
- RabbitMQ 3.6.1 / Erlang 18.3 TLS insufficient security failures

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.