mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-28 23:02:15 +00:00
SEC-690: Use consistent naming in OpenID classes
http://jira.springframework.org/browse/SEC-690
This commit is contained in:
parent
45e43073a0
commit
5ba7091a20
@ -22,7 +22,7 @@ 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.FilterChainOrder;
|
||||||
import org.springframework.security.ui.openid.consumers.OpenId4JavaConsumer;
|
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;
|
||||||
@ -40,10 +40,10 @@ import java.io.IOException;
|
|||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
public class OpenIdAuthenticationProcessingFilter extends AbstractProcessingFilter {
|
public class OpenIDAuthenticationProcessingFilter extends AbstractProcessingFilter {
|
||||||
//~ Static fields/initializers =====================================================================================
|
//~ Static fields/initializers =====================================================================================
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(OpenIdAuthenticationProcessingFilter.class);
|
private static final Log log = LogFactory.getLog(OpenIDAuthenticationProcessingFilter.class);
|
||||||
public static final String DEFAULT_CLAIMED_IDENTITY_FIELD = "j_username";
|
public static final String DEFAULT_CLAIMED_IDENTITY_FIELD = "j_username";
|
||||||
|
|
||||||
//~ Instance fields ================================================================================================
|
//~ Instance fields ================================================================================================
|
||||||
@ -56,7 +56,7 @@ public class OpenIdAuthenticationProcessingFilter extends AbstractProcessingFilt
|
|||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
super.afterPropertiesSet();
|
super.afterPropertiesSet();
|
||||||
if (consumer == null) {
|
if (consumer == null) {
|
||||||
consumer = new OpenId4JavaConsumer();
|
consumer = new OpenID4JavaConsumer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ public class OpenIdAuthenticationProcessingFilter extends AbstractProcessingFilt
|
|||||||
// Make the username available to the view
|
// Make the username available to the view
|
||||||
String username = obtainUsername(req);
|
String username = obtainUsername(req);
|
||||||
setLastUsername(username, req);
|
setLastUsername(username, req);
|
||||||
throw new OpenIdAuthenticationRequiredException("External Authentication Required", username);
|
throw new OpenIDAuthenticationRequiredException("External Authentication Required", username);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -97,8 +97,8 @@ public class OpenIdAuthenticationProcessingFilter extends AbstractProcessingFilt
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected String determineFailureUrl(HttpServletRequest request, AuthenticationException failed) {
|
protected String determineFailureUrl(HttpServletRequest request, AuthenticationException failed) {
|
||||||
if (failed instanceof OpenIdAuthenticationRequiredException) {
|
if (failed instanceof OpenIDAuthenticationRequiredException) {
|
||||||
OpenIdAuthenticationRequiredException openIdRequiredException = (OpenIdAuthenticationRequiredException) failed;
|
OpenIDAuthenticationRequiredException openIdRequiredException = (OpenIDAuthenticationRequiredException) failed;
|
||||||
String claimedIdentity = openIdRequiredException.getClaimedIdentity();
|
String claimedIdentity = openIdRequiredException.getClaimedIdentity();
|
||||||
|
|
||||||
if (StringUtils.hasText(claimedIdentity)) {
|
if (StringUtils.hasText(claimedIdentity)) {
|
||||||
@ -155,9 +155,9 @@ public class OpenIdAuthenticationProcessingFilter extends AbstractProcessingFilt
|
|||||||
|
|
||||||
protected void onUnsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response,
|
protected void onUnsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response,
|
||||||
AuthenticationException failed) throws IOException {
|
AuthenticationException failed) throws IOException {
|
||||||
if (failed instanceof OpenIdAuthenticationRequiredException) {
|
if (failed instanceof OpenIDAuthenticationRequiredException) {
|
||||||
OpenIdAuthenticationRequiredException openIdAuthenticationRequiredException = (OpenIdAuthenticationRequiredException) failed;
|
OpenIDAuthenticationRequiredException openIdAuthenticationRequiredException = (OpenIDAuthenticationRequiredException) failed;
|
||||||
request.setAttribute(OpenIdAuthenticationRequiredException.class.getName(),
|
request.setAttribute(OpenIDAuthenticationRequiredException.class.getName(),
|
||||||
openIdAuthenticationRequiredException.getClaimedIdentity());
|
openIdAuthenticationRequiredException.getClaimedIdentity());
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -19,11 +19,11 @@ import org.springframework.security.AuthenticationException;
|
|||||||
/**
|
/**
|
||||||
* @author Ray Krueger
|
* @author Ray Krueger
|
||||||
*/
|
*/
|
||||||
public class OpenIdAuthenticationRequiredException extends AuthenticationException {
|
public class OpenIDAuthenticationRequiredException extends AuthenticationException {
|
||||||
|
|
||||||
private final String claimedIdentity;
|
private final String claimedIdentity;
|
||||||
|
|
||||||
public OpenIdAuthenticationRequiredException(String msg, String claimedIdentity) {
|
public OpenIDAuthenticationRequiredException(String msg, String claimedIdentity) {
|
||||||
super(msg);
|
super(msg);
|
||||||
this.claimedIdentity = claimedIdentity;
|
this.claimedIdentity = claimedIdentity;
|
||||||
}
|
}
|
@ -41,22 +41,21 @@ import javax.servlet.http.HttpSession;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DOCUMENT ME!
|
|
||||||
*
|
*
|
||||||
* @author Ray Krueger
|
* @author Ray Krueger
|
||||||
*/
|
*/
|
||||||
public class OpenId4JavaConsumer implements OpenIDConsumer {
|
public class OpenID4JavaConsumer implements OpenIDConsumer {
|
||||||
//~ Instance fields ================================================================================================
|
//~ Instance fields ================================================================================================
|
||||||
|
|
||||||
private final ConsumerManager consumerManager;
|
private final ConsumerManager consumerManager;
|
||||||
|
|
||||||
//~ Constructors ===================================================================================================
|
//~ Constructors ===================================================================================================
|
||||||
|
|
||||||
public OpenId4JavaConsumer(ConsumerManager consumerManager) {
|
public OpenID4JavaConsumer(ConsumerManager consumerManager) {
|
||||||
this.consumerManager = consumerManager;
|
this.consumerManager = consumerManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OpenId4JavaConsumer() throws ConsumerException {
|
public OpenID4JavaConsumer() throws ConsumerException {
|
||||||
this(new ConsumerManager());
|
this(new ConsumerManager());
|
||||||
}
|
}
|
||||||
|
|
@ -17,11 +17,9 @@ package org.springframework.security.providers.openid;
|
|||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DOCUMENT ME!
|
|
||||||
*
|
|
||||||
* @author Ray Krueger
|
* @author Ray Krueger
|
||||||
*/
|
*/
|
||||||
public class OpenIdAuthenticationTokenTests extends TestCase {
|
public class OpenIDAuthenticationTokenTests extends TestCase {
|
||||||
|
|
||||||
public void test() throws Exception {
|
public void test() throws Exception {
|
||||||
OpenIDAuthenticationToken token = newToken();
|
OpenIDAuthenticationToken token = newToken();
|
||||||
@ -34,6 +32,4 @@ public class OpenIdAuthenticationTokenTests extends TestCase {
|
|||||||
"http://raykrueger.blogspot.com/",
|
"http://raykrueger.blogspot.com/",
|
||||||
"what is this for anyway?");
|
"what is this for anyway?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user