Differences from Spring
spring_security_core follows Spring Security: the same types, annotations, expressions and login guarantees. This page lists where it does not, and why.
Why
When you port a Spring application, you need to know where the behaviour is not the one you expect. The differences come from Dart (no threads, no reflection), from the project's rule never to write cryptography by hand, and from a few safer defaults.
Example
@Service()
class OrderService {
@PreAuthorize("hasRole('ADMIN')")
Future<void> cancel(Order order) async {}
}
// No @EnableMethodSecurity: the dependency is enough.
@EnableMethodSecurity
@Configuration
class SecurityConfig {}
Differences
| Spring Security | Here | Why |
|---|---|---|
@EnableMethodSecurity switches method security on |
always on | An annotation is never silently ignored. |
| An annotated bean that cannot be proxied runs unchecked | fails the startup | Never open a method by accident. |
| Expressions parsed at the first call | parsed at startup | A typo stops the application. |
Beans in expressions (@shop.isOpen()) by reflection |
the bean's class needs @Introspected |
No reflection at run time. |
| The context is kept per thread | per Zone |
Dart has one thread; a request keeps its user across await. |
BCrypt is the default ({bcrypt}) |
not available; new hashes are {argon2} |
No vetted Dart implementation, and no hand-written cryptography. A {bcrypt} hash fails with an error saying so. |
{pbkdf2} read with the v5_5 settings (Spring 6+) |
read with the v5_8 settings | Java hashes stored as {pbkdf2} may not verify; {pbkdf2@SpringSecurity_v5_8} ones do. |
| Password checks bounded by the container's threads | spring.security.password-checks.*, on another isolate |
A flood of logins takes half the CPU at most. |
Spring Security 7 adds FACTOR_PASSWORD to password logins |
not yet | Multi-factor authentication is not here. |
Argon2, PBKDF2 and scrypt hashes verify both ways with Spring Security 7.1.
Not supported yet
- JSR-250 (
@RolesAllowed,@PermitAll,@DenyAll). - Annotation templates with parameters (
@HasRole("ADMIN")with{value}); aconstclass that extendsPreAuthorizeworks as a fixed composed annotation. @AuthorizeReturnObjectand@HandleAuthorizationDenied.- Authorization events (
AuthorizationDeniedEvent): only the authentication events are published. - ACL tables and
AclService:hasPermissionneeds your ownPermissionEvaluator. JdbcUserDetailsManagerand LDAP: declare your ownUserDetailsService.- Compromised password checking (
CompromisedPasswordChecker). - Multi-factor authentication and
Authentication.Builder.