mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-26 05:42:31 +00:00
Added check for null consumer, removed unused "errorPage" property.
This commit is contained in:
parent
ca75905c3e
commit
0d9c1924fb
@ -21,6 +21,8 @@ import org.springframework.security.AuthenticationServiceException;
|
|||||||
import org.springframework.security.context.SecurityContextHolder;
|
import org.springframework.security.context.SecurityContextHolder;
|
||||||
import org.springframework.security.providers.openid.OpenIDAuthenticationToken;
|
import org.springframework.security.providers.openid.OpenIDAuthenticationToken;
|
||||||
import org.springframework.security.ui.AbstractProcessingFilter;
|
import org.springframework.security.ui.AbstractProcessingFilter;
|
||||||
|
import org.springframework.security.ui.FilterChainOrder;
|
||||||
|
import org.springframework.security.ui.openid.consumers.OpenId4JavaConsumer;
|
||||||
import org.springframework.security.ui.webapp.AuthenticationProcessingFilter;
|
import org.springframework.security.ui.webapp.AuthenticationProcessingFilter;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@ -32,10 +34,10 @@ import java.io.IOException;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DOCUMENT ME!
|
|
||||||
*
|
*
|
||||||
* @author $author$
|
* @author Ray Krueger
|
||||||
* @version $Revision$
|
* @version $Id$
|
||||||
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public class OpenIdAuthenticationProcessingFilter extends AbstractProcessingFilter {
|
public class OpenIdAuthenticationProcessingFilter extends AbstractProcessingFilter {
|
||||||
//~ Static fields/initializers =====================================================================================
|
//~ Static fields/initializers =====================================================================================
|
||||||
@ -47,12 +49,17 @@ public class OpenIdAuthenticationProcessingFilter extends AbstractProcessingFilt
|
|||||||
|
|
||||||
private OpenIDConsumer consumer;
|
private OpenIDConsumer consumer;
|
||||||
private String claimedIdentityFieldName = DEFAULT_CLAIMED_IDENTITY_FIELD;
|
private String claimedIdentityFieldName = DEFAULT_CLAIMED_IDENTITY_FIELD;
|
||||||
private String errorPage = "index.jsp";
|
|
||||||
|
|
||||||
//~ Methods ========================================================================================================
|
//~ Methods ========================================================================================================
|
||||||
|
|
||||||
public Authentication attemptAuthentication(HttpServletRequest req)
|
public void afterPropertiesSet() throws Exception {
|
||||||
throws AuthenticationException {
|
super.afterPropertiesSet();
|
||||||
|
if (consumer == null) {
|
||||||
|
consumer = new OpenId4JavaConsumer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Authentication attemptAuthentication(HttpServletRequest req) throws AuthenticationException {
|
||||||
OpenIDAuthenticationToken token;
|
OpenIDAuthenticationToken token;
|
||||||
|
|
||||||
String identity = req.getParameter("openid.identity");
|
String identity = req.getParameter("openid.identity");
|
||||||
@ -112,10 +119,6 @@ public class OpenIdAuthenticationProcessingFilter extends AbstractProcessingFilt
|
|||||||
return "/j_spring_openid_security_check";
|
return "/j_spring_openid_security_check";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getErrorPage() {
|
|
||||||
return errorPage;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean isAuthenticated(HttpServletRequest request) {
|
protected boolean isAuthenticated(HttpServletRequest request) {
|
||||||
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
|
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
|
||||||
|
|
||||||
@ -156,10 +159,6 @@ public class OpenIdAuthenticationProcessingFilter extends AbstractProcessingFilt
|
|||||||
this.consumer = consumer;
|
this.consumer = consumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setErrorPage(String errorPage) {
|
|
||||||
this.errorPage = errorPage;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void unsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response,
|
protected void unsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response,
|
||||||
AuthenticationException failed) throws IOException {
|
AuthenticationException failed) throws IOException {
|
||||||
SecurityContextHolder.getContext().setAuthentication(null);
|
SecurityContextHolder.getContext().setAuthentication(null);
|
||||||
@ -185,6 +184,6 @@ public class OpenIdAuthenticationProcessingFilter extends AbstractProcessingFilt
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getOrder() {
|
public int getOrder() {
|
||||||
throw new UnsupportedOperationException();
|
return FilterChainOrder.AUTHENTICATION_PROCESSING_FILTER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user