草庐IT

Form_Login

全部标签

java - 为什么/login?logout 会重定向到/login?

在我的Spring项目中,我将注销目标url设置为“/login?logout”以显示登录页面并显示消息“您现在已注销”。在SpringSecurity配置中,我这样做了:@Overrideprotectedvoidconfigure(HttpSecurityhttp)throwsException{http.csrf().disable().authorizeRequests().antMatchers("/error").permitAll().anyRequest().fullyAuthenticated().and().formLogin().loginPage("/login

Java 配置 Spring 安全 FORM_LOGIN_FILTER

我正在研究一些SpringSecurity教程并尝试在没有xml的情况下实现它们,但我似乎找不到任何关于替换默认UsernamePasswordAuthenticationFilter的信息。类似于thisquestion我想从登录表单中检索一个额外的参数。我遇到困难的地方是:为了正确设置它,我需要从AuthenticationManagerBuilder向下构建吗?还是我错过了什么? 最佳答案 根据此处找到的SpringSecurity文档:http://docs.spring.io/spring-security/site/do

java - Spring Security 显示 'Your login attempt was not successful due to' 用于自定义成员资格

我对SpringSecurity感到困惑,当我打开登录页面时,它显示以下错误消息甚至在提交表单之前。我不知道如何解决这个问题。Yourloginattemptwasnotsuccessfulduetomy-servlet.xml.....org.hibernate.dialect.MySQLDialecttruetruetrueupdatespring-security.xmllogin-service.xml登录页面Yourloginattemptwasnotsuccessfuldueto.Log-inInvalidusernameandpassword.${error}${msg}

java - 使用 Spring :message to define form tag attribute in Spring web application

我正在开发一个Java/SpringWeb应用程序。我目前面临的问题是我希望将来自message.resources的消息显示为HTML中的属性。所以我需要的不是硬编码值“login”,而是作为该输入标签的值属性。由于页面都是xml,因此无法嵌套标签,如"/>因为它不编译。当然,我可以读取JavaController中的值并使用JSTL变量来显示该值,但我认为这太笨拙和复杂,尤其是对于具有大量提交按钮的页面。是否有某种优雅的方式来完成我想做的事情? 最佳答案 使用将值存储在var中,然后使用EL引用该var,例如

spring - 是否可以在表单 :select/form:option 的 itemLabel 中使用多个参数

我正在使用Spring。我有一个带有表单的JSP:在其中选择显示用户列表。在这种情况下,用户名或id对用户来说意义不大,所以我需要显示firstnamelastname。我试过了:SelecttoEdit但这给了我一个很大的错误。如何让itemLabels显示姓氏、名字? 最佳答案 我不这么认为。在您的对象中有一个getFullName()getter返回姓氏和名字的串联,或者在循环中逐个显示选项:SelecttoEdit通过user.getFullName()执行连接: 关于sprin

java - 如何使用 <spring :message> inside an attribute of <form:input>?

我有类似的JSP代码:"path="email"cssClass="inputrequiredemail"/>我想用一些工具提示文本设置title属性,支持i18n。我该怎么做?我想做这样的事情:"/>"path="email"cssClass="inputrequiredemail"/> 最佳答案 您不能在属性内使用标签:但是你可以使用上面的。它工作正常。 关于java-如何使用insideanattributeof?,我们在StackOverflow上找到一个类似的问题:

spring - @RequestBody MultiValueMap 不支持内容类型 'application/x-www-form-urlencoded;charset=UTF-8'

基于答案forproblemwithx-www-form-urlencodedwithSpring@Controller我写了下面的@Controller方法@RequestMapping(value="/{email}/authenticate",method=RequestMethod.POST,produces={"application/json","application/xml"},consumes={"application/x-www-form-urlencoded"})public@ResponseBodyRepresentationauthenticate(@Pat

javascript - Node JS : Login not working

我在Node上使用Express和.hbs模板。我正在使用护照来验证特定用户。我在MongoDB中使用过的数据库。这是我的注册路线:varexpress=require('express');varrouter=express.Router();varpassport=require('passport');varuserServices=require('../services/user-services');router.get('/',function(req,res,next){varvm={title:'Jointhisweb',};res.render('signup',v

javascript - Node JS : Login not working

我在Node上使用Express和.hbs模板。我正在使用护照来验证特定用户。我在MongoDB中使用过的数据库。这是我的注册路线:varexpress=require('express');varrouter=express.Router();varpassport=require('passport');varuserServices=require('../services/user-services');router.get('/',function(req,res,next){varvm={title:'Jointhisweb',};res.render('signup',v

docker 未经授权的: authentication required - upon push with successful login

从我的主机推送docker镜像(成功登录后)时,我收到“未经授权:需要身份验证”。详情如下。-bash-4.2#dockerlogin--username=asamba--email=anand.sambamoorthy@gmail.comWARNING:logincredentialssavedin/root/.docker/config.json*LoginSucceeded*-bash-4.2#-bash-4.2#dockerpushasamba/docker-whaleDoyoureallywanttopushtopublicregistry?[y/n]:yThepushref