0
我是新来的春天和学习。我被困在使用用户电子邮件的登录页面上。我可以使用用户名和密码创建登录,使用jdbc-user-service。但现在我想更改登录使用UserEmail。如何使用电子邮件创建Spring登录?
<security:form-login login-page="/login"
default-target-url="/product/productList/all" authentication-failure-url="/login?error"
username-parameter="username" password-parameter="password" />
<security:logout logout-success-url="/login?logout" />
</security:http>
<security:authentication-manager>
<security:authentication-provider>
<security:jdbc-user-service data-source-ref="dataSource"
authorities-by-username-query="SELECT username, authority FROM authorities WHERE username = ?"
users-by-username-query="SELECT username, password, enabled FROM users WHERE username = ?" />
<security:password-encoder ref="bcryptEncoder" />
</security:authentication-provider>
</security:authentication-manager>
登录表单如下:
用户名和如下密码登录示例配置
<form name="loginForm" action="<c:url value="/j_spring_security_check" />" method="post">
<c:if test="${not empty error}">
<div class="error" style="color: #ff0000;">${error}</div>
</c:if>
<div class="form-group">
<label for="username">UserName : </label>
<input type="text" id="username" name="username" class="form-control" />
</div>
<div class="form-group">
<label for="password">Passwrod:</label>
<input type="password" id="password" name="password" class="form-control" />
</div>
<input type="submit" value="Submit" class="btn btn-default">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
</form>
我怎样才能改变验证用户的电子邮件,并与用户授权进行绑定,太?请帮助我获得演示教程。
非常感谢。
是它的工作原理,谢谢@Andrel。 – soewin