0
저는 Zuul 뒤에 Oauth2 서버를 실행하고 있습니다. Zuul은 사용자를 로그인 페이지로 전달합니다.Freemarker 템플릿의 CSRF 토큰이 null입니다.
이@Override
public void configure(HttpSecurity http) throws Exception {
...
.and().csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse());
}
OAuth2를 서버에 로그인 프리 마커 템플릿이 같은 CSRF 토큰을 구문 분석 :
<from>
...
<input type="hidden" id="csrf_token" name="${_csrf.parameterName}" value="${_csrf.token}"/>
</form>
여기까지, 모든 것이 잘 작동 Zuul은 또한 다음과 같은 HttpSecurity을 정의합니다. 다음 WebMvcConfigurerAdapter 구성과 함께
<a href="/uaa/reset"><@spring.message "login.forgot"/></a>
: 아니, 난 암호에 대한 링크 프리 마커 템플릿을 다시 포함
@Configuration
public class OAuthWebFormConfiguration extends WebMvcConfigurerAdapter {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/login").setViewName("login");
registry.addViewController("/reset").setViewName("reset");
}
나는 다음과 같은 오류 얻을 리셋보기로 이동하는 경우 :
: Servlet.service() for servlet [dispatcherServlet] in context with path
[/uaa] threw exception [Request processing failed; nested exception is
freemarker.core.InvalidReferenceException: The following has evaluated to
null or missing:
==> _csrf [in template "reset.ftl" at line 21, column 64]
Tip: If the failing expression is known to legally refer to something
that's sometimes null or missing, either specify a default value like
myOptionalVar!myDefault, or use <#if myOptionalVar??>when-
present<#else>when-missing</#if>. (These only cover the last step of the
expression; to cover the whole expression, use parenthesis:
(myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
FTL stack trace ("~" means nesting-related):
- Failed at: ${_csrf.parameterName} [in template "reset.ftl" at line 21,
column 62]
----] with root cause
freemarker.core.InvalidReferenceException: The following has evaluated to
null or missing:
==> _csrf [in template "reset.ftl" at line 21, column 64]
Tip: If the failing expression is known to legally refer to something that's
sometimes null or missing, either specify a default value like
myOptionalVar!myDefault, or use <#if myOptionalVar??>when-
present<#else>when-
missing</#if>. (These only cover the last step of the expression; to cover
the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault,
(myOptionalVar.foo)??
FTL stack trace ("~" means nesting-related):
- Failed at: ${_csrf.parameterName} [in template "reset.ftl" at line 21,
column 62]
에게
어떤 도움이 필요합니까?