Spring Security OpenID - Unable to Process claimed identity "null"
I'm having trouble getting the Spring Security OpenID functionality working. I'm getting the error below when I use http://spring.security.test.myopenid.com/ as input. Here is a link to the spring source that shows where the exception is thrown. Any ideas?
Unable to process claimed identity 'null'.
applicationContext-security.xml:
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.xsd">
<http>
<intercept-url pattern="/**" access="ROLE_USER" />
<intercept-url pattern="/login/" filters="none" />
<intercept-url pattern="/" filters="none" />
<logout />
<openid-login login-page="/login/" authentication-failure-url="/login/?login_error=true">
<attribute-exchange>
<openid-attribute name="email" type="http://schema.openid.net/contact/email" />
<openid-attribute name="name" type="http://schema.openid.net/namePerson/friendly" />
</attribute-exchange>
</openid-login>
<remember-me token-repository-ref="tokenRepository"/>
</http>
<beans:bean id="tokenRepository"
class="org.springframework.security.web.authentication.rememberme.InMemoryTokenRepositoryImpl" />
<authentication-manager alias="authenticationManager" />
<user-service id="userService">
<user name="http://spring.security.test.myopenid.com/" password="password" authorities="ROLE_SUPERVISOR,ROLE_USER" />
</user-service>
</beans:beans>
login.jsp:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test GAE</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<h3>Please Enter Your OpenID Identity</h3>
开发者_StackOverflow中文版 <c:if test="${not empty param.login_error}">
Your login attempt was not successful, try again.<br/><br/>
Reason: <c:out value="${SPRING_SECURITY_LAST_EXCEPTION.message}"/>.
</c:if>
<form action="<c:url value='/j_spring_openid_security_check'/>" method="post">
<table>
<tr><td>OpenID Identity:</td><td><input type='text' name='j_username' value='<c:if test="${not empty param.login_error}"><c:out value="${SPRING_SECURITY_LAST_USERNAME}"/></c:if>'/></td></tr>
<tr><td><input type="checkbox" name="_spring_security_remember_me" /></td><td>Remember me on this computer.</td></tr>
<tr><td colspan='2'><input name="submit" type="submit" /></td></tr>
<tr><td colspan='2'><input name="reset" type="reset" /></td></tr>
</table>
</form>
</body>
</html>
Probably, you should replace j_username
by openid_identifier
in your <input ...>
name
From the source:
/**
* The name of the request parameter containing the OpenID identity, as submitted from the initial login form.
*
* @param claimedIdentityFieldName defaults to "openid_identifier"
*/
精彩评论