Skip to content

Commit 41a013f

Browse files
authored
Revert "fix: fix AuthenticationContext bean duplicated definition (#21845) (#21846) (#21847)" (#21849)
This reverts commit f771039.
1 parent f771039 commit 41a013f

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

vaadin-spring/src/main/java/com/vaadin/flow/spring/SpringSecurityAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public VaadinRolePrefixHolder vaadinRolePrefixHolder(
198198
.map(GrantedAuthorityDefaults::getRolePrefix).orElse(null));
199199
}
200200

201-
@Bean(name = "VaadinAuthenticationContext")
201+
@Bean
202202
@ConditionalOnMissingBean
203203
AuthenticationContext authenticationContext() {
204204
return new AuthenticationContext();

vaadin-spring/src/main/java/com/vaadin/flow/spring/security/VaadinWebSecurity.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
package com.vaadin.flow.spring.security;
1717

1818
import javax.crypto.SecretKey;
19-
2019
import java.io.IOException;
2120
import java.util.ArrayList;
2221
import java.util.LinkedHashMap;
@@ -124,10 +123,6 @@ public abstract class VaadinWebSecurity {
124123
@Autowired
125124
private ObjectProvider<NavigationAccessControl> accessControlProvider;
126125

127-
// initialized only for tests, it gets overridden by the injected instance
128-
@Autowired
129-
private AuthenticationContext authenticationContext = new AuthenticationContext();
130-
131126
private NavigationAccessControl accessControl;
132127

133128
@PostConstruct
@@ -136,6 +131,8 @@ void afterPropertiesSet() {
136131
authenticationContext.setRolePrefixHolder(vaadinRolePrefixHolder);
137132
}
138133

134+
private final AuthenticationContext authenticationContext = new AuthenticationContext();
135+
139136
/**
140137
* Registers default {@link SecurityFilterChain} bean.
141138
* <p>
@@ -168,6 +165,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
168165
*
169166
* @return the authentication-context bean
170167
*/
168+
@Bean(name = "VaadinAuthenticationContext")
171169
public AuthenticationContext getAuthenticationContext() {
172170
return authenticationContext;
173171
}

0 commit comments

Comments
 (0)