|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2022 the original author or authors. |
| 2 | + * Copyright 2002-2023 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
43 | 43 | import org.springframework.security.web.csrf.CsrfFilter;
|
44 | 44 | import org.springframework.security.web.csrf.CsrfLogoutHandler;
|
45 | 45 | import org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository;
|
46 |
| -import org.springframework.security.web.csrf.LazyCsrfTokenRepository; |
47 | 46 | import org.springframework.security.web.csrf.MissingCsrfTokenException;
|
48 | 47 | import org.springframework.security.web.servlet.support.csrf.CsrfRequestDataValueProcessor;
|
49 | 48 | import org.springframework.security.web.session.InvalidSessionAccessDeniedHandler;
|
@@ -109,13 +108,12 @@ public BeanDefinition parse(Element element, ParserContext pc) {
|
109 | 108 | this.requestHandlerRef = element.getAttribute(ATT_REQUEST_HANDLER);
|
110 | 109 | }
|
111 | 110 | if (!StringUtils.hasText(this.csrfRepositoryRef)) {
|
112 |
| - RootBeanDefinition csrfTokenRepository = new RootBeanDefinition(HttpSessionCsrfTokenRepository.class); |
113 |
| - BeanDefinitionBuilder lazyTokenRepository = BeanDefinitionBuilder |
114 |
| - .rootBeanDefinition(LazyCsrfTokenRepository.class); |
115 |
| - lazyTokenRepository.addConstructorArgValue(csrfTokenRepository); |
116 |
| - this.csrfRepositoryRef = pc.getReaderContext().generateBeanName(lazyTokenRepository.getBeanDefinition()); |
117 |
| - pc.registerBeanComponent( |
118 |
| - new BeanComponentDefinition(lazyTokenRepository.getBeanDefinition(), this.csrfRepositoryRef)); |
| 111 | + BeanDefinitionBuilder httpSessionCsrfTokenRepository = BeanDefinitionBuilder |
| 112 | + .rootBeanDefinition(HttpSessionCsrfTokenRepository.class); |
| 113 | + this.csrfRepositoryRef = pc.getReaderContext() |
| 114 | + .generateBeanName(httpSessionCsrfTokenRepository.getBeanDefinition()); |
| 115 | + pc.registerBeanComponent(new BeanComponentDefinition(httpSessionCsrfTokenRepository.getBeanDefinition(), |
| 116 | + this.csrfRepositoryRef)); |
119 | 117 | }
|
120 | 118 | BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(CsrfFilter.class);
|
121 | 119 | builder.addConstructorArgReference(this.csrfRepositoryRef);
|
|
0 commit comments