首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spring安全和用户名/密码在导航器中自动填充

Spring安全和用户名/密码在导航器中自动填充
EN

Stack Overflow用户
提问于 2018-02-13 16:39:59
回答 1查看 249关注 0票数 0

我使用Roo和gvnix插件为登录表单生成了以下JSP spring安全代码。身份验证工作正常,但我无法在导航器(Firefox,IE)中自动登录。他们只是建议保存一个我还没有设置的"X“用户名,并且在返回表单时没有任何建议。我只是找不到为什么我输入的用户名没有保存...有什么想法吗?谢谢

代码语言:javascript
复制
 <div>
    <label for="j_username">
        <spring:message code="security_login_form_name"/>
    </label>
    <input id="username" name="j_username" style="width:150px" type="text"/> 
    <spring:message code="security_login_form_name_message" htmlEscape="false" var="name_msg"/>
    <script type="text/javascript">
        <c:set var="sec_name_msg">
            <spring:escapeBody javaScriptEscape="true">${name_msg}</spring:escapeBody>
        </c:set>
        Spring.addDecoration(new Spring.ElementDecoration({elementId : "j_username", widgetType : "dijit.form.ValidationTextBox", widgetAttrs : {promptMessage: "${sec_name_msg}", required : true}})); 
    </script>
</div>
<div>
    <label for="j_password">
        <spring:message code="security_login_form_password"/>
    </label>
    <input id="j_password" name="j_password" style="width:150px" type="password"/>
    <spring:message code="security_login_form_password_message" htmlEscape="false" var="pwd_msg"/>
    <script type="text/javascript">
        <c:set var="sec_pwd_msg">
            <spring:escapeBody javaScriptEscape="true">${pwd_msg}</spring:escapeBody>
        </c:set>
        Spring.addDecoration(new Spring.ElementDecoration({elementId : "j_password", widgetType : "dijit.form.ValidationTextBox", widgetAttrs : {promptMessage: "${sec_pwd_msg}", required : true}})); 
    </script>
</div>
<div class="submit">
    <script type="text/javascript">Spring.addDecoration(new Spring.ValidateAllDecoration({elementId:'proceed', event:'onclick'}));</script>
    <spring:message code="button_submit" htmlEscape="false" var="submit_label"/>
    <input id="proceed" type="submit" value="${fn:escapeXml(submit_label)}"/>
</div>
EN

回答 1

Stack Overflow用户

发布于 2018-02-13 16:51:25

从安全的角度来看,用户名的自动补全被认为是不好的做法。

用户可以自由地指示他们的浏览器保存他们的凭据信息,并在自动完成操作中使用它,但应用程序不应强制执行此行为。

您的需求似乎更多地与浏览器相关,而不是Spring框架。

一般来说,可能值的自动补全意味着有人键入一个值,自动补全会从存储中获取满足条件(例如,以开头)的所有值。我猜你不希望有人能够使用这个自动补全功能从你的存储中取出你所有的用户名。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48762571

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档