大网数据广告活动
网站运营与故障问答

What does mask spring authentication nginx configuration do?

· 52CE 我爱测

I have the following setting in my nginx.conf but I am not sure what it does. I copied it from a Google search. location / { set $tempRequest $request; if ($tempRequest ~ (.*)j_password=[^&]*(.*)) { # Mask spring authentication p…

问题原文

原帖链接 · Anthony · CC BY-SA 3.0

I have the following setting in my nginx.conf but I am not sure what it does. I copied it from a Google search.

   location / {
        set $tempRequest $request;
        if ($tempRequest ~ (.*)j_password=[^&]*(.*)) {
            # Mask spring authentication password param.
            set $tempRequest $1j_password=****$2;
        }

Can someone explain what it does? I am using nginx as a proxy server for a grails application running on Tomcat.

I thought this setting would not show j_password parameter when users submit the password at authentication time but I can see the value of j_password using Chrome Inspect when the form is submitted.

已采纳解答

原帖链接 · Erik Pragt · CC BY-SA 3.0

I don't know what it exactly does, but I assume you want to rename the parameters. The parameters have to be POSTed anyway, so there's no way around that, but if you want to rename to something else, you the following (in resources.xml):

<beans:bean class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter">
                 <beans:property name="usernameParameter" value="user_name">
        <beans:property name="passwordParameter" value="passwd">
        < !-- other properties which you also use in the -login element -->
</beans:bean>

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2016-07-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。