SEC-690: Use consistent naming in OpenID classes

http://jira.springframework.org/browse/SEC-690
This commit is contained in:
Luke Taylor 2008-02-29 12:52:13 +00:00
parent 45e43073a0
commit 5ba7091a20
4 changed files with 405 additions and 410 deletions

View File

@ -1,202 +1,202 @@
/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.security.ui.openid; package org.springframework.security.ui.openid;
import org.springframework.security.Authentication; import org.springframework.security.Authentication;
import org.springframework.security.AuthenticationException; import org.springframework.security.AuthenticationException;
import org.springframework.security.AuthenticationServiceException; 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.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;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import java.io.IOException; import java.io.IOException;
/** /**
* @author Robin Bramley, Opsera Ltd * @author Robin Bramley, Opsera Ltd
* @author Ray Krueger * @author Ray Krueger
* @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 ================================================================================================
private OpenIDConsumer consumer; private OpenIDConsumer consumer;
private String claimedIdentityFieldName = DEFAULT_CLAIMED_IDENTITY_FIELD; private String claimedIdentityFieldName = DEFAULT_CLAIMED_IDENTITY_FIELD;
//~ Methods ======================================================================================================== //~ Methods ========================================================================================================
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();
} }
} }
public Authentication attemptAuthentication(HttpServletRequest req) throws AuthenticationException { public Authentication attemptAuthentication(HttpServletRequest req) throws AuthenticationException {
OpenIDAuthenticationToken token; OpenIDAuthenticationToken token;
String identity = req.getParameter("openid.identity"); String identity = req.getParameter("openid.identity");
if (!StringUtils.hasText(identity)) { if (!StringUtils.hasText(identity)) {
// 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 {
token = consumer.endConsumption(req); token = consumer.endConsumption(req);
} catch (OpenIDConsumerException oice) { } catch (OpenIDConsumerException oice) {
throw new AuthenticationServiceException("Consumer error", oice); throw new AuthenticationServiceException("Consumer error", oice);
} }
// delegate to the auth provider // delegate to the auth provider
Authentication authentication = this.getAuthenticationManager().authenticate(token); Authentication authentication = this.getAuthenticationManager().authenticate(token);
if (authentication.isAuthenticated()) { if (authentication.isAuthenticated()) {
setLastUsername(token.getIdentityUrl(), req); setLastUsername(token.getIdentityUrl(), req);
} }
return authentication; return authentication;
} }
private void setLastUsername(String username, HttpServletRequest request) { private void setLastUsername(String username, HttpServletRequest request) {
HttpSession session = request.getSession(false); HttpSession session = request.getSession(false);
if (session != null || getAllowSessionCreation()) { if (session != null || getAllowSessionCreation()) {
request.getSession().setAttribute(AuthenticationProcessingFilter.SPRING_SECURITY_LAST_USERNAME_KEY, username); request.getSession().setAttribute(AuthenticationProcessingFilter.SPRING_SECURITY_LAST_USERNAME_KEY, username);
} }
} }
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)) {
try { try {
String returnToUrl = buildReturnToUrl(request); String returnToUrl = buildReturnToUrl(request);
return consumer.beginConsumption(request, claimedIdentity, returnToUrl); return consumer.beginConsumption(request, claimedIdentity, returnToUrl);
} catch (OpenIDConsumerException e) { } catch (OpenIDConsumerException e) {
log.error("Unable to consume claimedIdentity [" + claimedIdentity + "]", e); log.error("Unable to consume claimedIdentity [" + claimedIdentity + "]", e);
} }
} }
} }
return super.determineFailureUrl(request, failed); return super.determineFailureUrl(request, failed);
} }
protected String buildReturnToUrl(HttpServletRequest request) { protected String buildReturnToUrl(HttpServletRequest request) {
return request.getRequestURL().toString(); return request.getRequestURL().toString();
} }
public String getClaimedIdentityFieldName() { public String getClaimedIdentityFieldName() {
return claimedIdentityFieldName; return claimedIdentityFieldName;
} }
public OpenIDConsumer getConsumer() { public OpenIDConsumer getConsumer() {
return consumer; return consumer;
} }
public String getDefaultFilterProcessesUrl() { public String getDefaultFilterProcessesUrl() {
return "/j_spring_openid_security_check"; return "/j_spring_openid_security_check";
} }
protected boolean isAuthenticated(HttpServletRequest request) { protected boolean isAuthenticated(HttpServletRequest request) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication(); Authentication auth = SecurityContextHolder.getContext().getAuthentication();
return (auth != null) && auth.isAuthenticated(); return (auth != null) && auth.isAuthenticated();
} }
/** /**
* The OpenIdAuthenticationProcessingFilter will ignore the request coming in if this method returns false. * The OpenIdAuthenticationProcessingFilter will ignore the request coming in if this method returns false.
* The default functionality checks if the request scheme starts with http. <br/ * The default functionality checks if the request scheme starts with http. <br/
* > This method should be overridden in subclasses that wish to consider a different strategy * > This method should be overridden in subclasses that wish to consider a different strategy
* *
* @param request HttpServletRequest we're processing * @param request HttpServletRequest we're processing
* @return true if this request is determined to be an OpenID request. * @return true if this request is determined to be an OpenID request.
*/ */
protected boolean isOpenIdRequest(HttpServletRequest request) { protected boolean isOpenIdRequest(HttpServletRequest request) {
String username = obtainUsername(request); String username = obtainUsername(request);
return (StringUtils.hasText(username)) && username.toLowerCase().startsWith("http"); return (StringUtils.hasText(username)) && username.toLowerCase().startsWith("http");
} }
protected String obtainUsername(HttpServletRequest req) { protected String obtainUsername(HttpServletRequest req) {
return req.getParameter(claimedIdentityFieldName); return req.getParameter(claimedIdentityFieldName);
} }
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());
} }
} }
public void setClaimedIdentityFieldName(String claimedIdentityFieldName) { public void setClaimedIdentityFieldName(String claimedIdentityFieldName) {
this.claimedIdentityFieldName = claimedIdentityFieldName; this.claimedIdentityFieldName = claimedIdentityFieldName;
} }
public void setConsumer(OpenIDConsumer consumer) { public void setConsumer(OpenIDConsumer consumer) {
this.consumer = consumer; this.consumer = consumer;
} }
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);
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Updated SecurityContextHolder to contain null Authentication"); logger.debug("Updated SecurityContextHolder to contain null Authentication");
} }
String failureUrl = determineFailureUrl(request, failed); String failureUrl = determineFailureUrl(request, failed);
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Authentication request failed: " + failed.toString()); logger.debug("Authentication request failed: " + failed.toString());
} }
if (getAllowSessionCreation()) { if (getAllowSessionCreation()) {
try { try {
request.getSession().setAttribute(SPRING_SECURITY_LAST_EXCEPTION_KEY, failed); request.getSession().setAttribute(SPRING_SECURITY_LAST_EXCEPTION_KEY, failed);
} catch (Exception ignored) { } catch (Exception ignored) {
} }
} }
super.getRememberMeServices().loginFail(request, response); super.getRememberMeServices().loginFail(request, response);
sendRedirect(request, response, failureUrl); sendRedirect(request, response, failureUrl);
} }
public int getOrder() { public int getOrder() {
return FilterChainOrder.AUTHENTICATION_PROCESSING_FILTER; return FilterChainOrder.AUTHENTICATION_PROCESSING_FILTER;
} }
} }

View File

@ -1,34 +1,34 @@
/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.security.ui.openid; package org.springframework.security.ui.openid;
import org.springframework.security.AuthenticationException; 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;
} }
public String getClaimedIdentity() { public String getClaimedIdentity() {
return claimedIdentity; return claimedIdentity;
} }
} }

View File

@ -1,135 +1,134 @@
/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.security.ui.openid.consumers; package org.springframework.security.ui.openid.consumers;
import org.springframework.security.providers.openid.OpenIDAuthenticationStatus; import org.springframework.security.providers.openid.OpenIDAuthenticationStatus;
import org.springframework.security.providers.openid.OpenIDAuthenticationToken; import org.springframework.security.providers.openid.OpenIDAuthenticationToken;
import org.springframework.security.ui.openid.OpenIDConsumer; import org.springframework.security.ui.openid.OpenIDConsumer;
import org.springframework.security.ui.openid.OpenIDConsumerException; import org.springframework.security.ui.openid.OpenIDConsumerException;
import org.openid4java.association.AssociationException; import org.openid4java.association.AssociationException;
import org.openid4java.consumer.ConsumerException; import org.openid4java.consumer.ConsumerException;
import org.openid4java.consumer.ConsumerManager; import org.openid4java.consumer.ConsumerManager;
import org.openid4java.consumer.VerificationResult; import org.openid4java.consumer.VerificationResult;
import org.openid4java.discovery.DiscoveryException; import org.openid4java.discovery.DiscoveryException;
import org.openid4java.discovery.DiscoveryInformation; import org.openid4java.discovery.DiscoveryInformation;
import org.openid4java.discovery.Identifier; import org.openid4java.discovery.Identifier;
import org.openid4java.message.AuthRequest; import org.openid4java.message.AuthRequest;
import org.openid4java.message.MessageException; import org.openid4java.message.MessageException;
import org.openid4java.message.ParameterList; import org.openid4java.message.ParameterList;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession; 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()); }
}
//~ Methods ========================================================================================================
//~ Methods ========================================================================================================
public String beginConsumption(HttpServletRequest req, String identityUrl, String returnToUrl)
public String beginConsumption(HttpServletRequest req, String identityUrl, String returnToUrl) throws OpenIDConsumerException {
throws OpenIDConsumerException { List discoveries;
List discoveries;
try {
try { discoveries = consumerManager.discover(identityUrl);
discoveries = consumerManager.discover(identityUrl); } catch (DiscoveryException e) {
} catch (DiscoveryException e) { throw new OpenIDConsumerException("Error during discovery", e);
throw new OpenIDConsumerException("Error during discovery", e); }
}
DiscoveryInformation information = consumerManager.associate(discoveries);
DiscoveryInformation information = consumerManager.associate(discoveries); HttpSession session = req.getSession(true);
HttpSession session = req.getSession(true); session.setAttribute(DiscoveryInformation.class.getName(), information);
session.setAttribute(DiscoveryInformation.class.getName(), information);
AuthRequest authReq;
AuthRequest authReq;
try {
try { authReq = consumerManager.authenticate(information, returnToUrl);
authReq = consumerManager.authenticate(information, returnToUrl); } catch (MessageException e) {
} catch (MessageException e) { throw new OpenIDConsumerException("Error processing ConumerManager authentication", e);
throw new OpenIDConsumerException("Error processing ConumerManager authentication", e); } catch (ConsumerException e) {
} catch (ConsumerException e) { throw new OpenIDConsumerException("Error processing ConumerManager authentication", e);
throw new OpenIDConsumerException("Error processing ConumerManager authentication", e); }
}
return authReq.getDestinationUrl(true);
return authReq.getDestinationUrl(true); }
}
public OpenIDAuthenticationToken endConsumption(HttpServletRequest request)
public OpenIDAuthenticationToken endConsumption(HttpServletRequest request) throws OpenIDConsumerException {
throws OpenIDConsumerException { // extract the parameters from the authentication response
// extract the parameters from the authentication response // (which comes in as a HTTP request from the OpenID provider)
// (which comes in as a HTTP request from the OpenID provider) ParameterList openidResp = new ParameterList(request.getParameterMap());
ParameterList openidResp = new ParameterList(request.getParameterMap());
// retrieve the previously stored discovery information
// retrieve the previously stored discovery information DiscoveryInformation discovered = (DiscoveryInformation) request.getSession()
DiscoveryInformation discovered = (DiscoveryInformation) request.getSession() .getAttribute(DiscoveryInformation.class.getName());
.getAttribute(DiscoveryInformation.class.getName());
// extract the receiving URL from the HTTP request
// extract the receiving URL from the HTTP request StringBuffer receivingURL = request.getRequestURL();
StringBuffer receivingURL = request.getRequestURL(); String queryString = request.getQueryString();
String queryString = request.getQueryString();
if ((queryString != null) && (queryString.length() > 0)) {
if ((queryString != null) && (queryString.length() > 0)) { receivingURL.append("?").append(request.getQueryString());
receivingURL.append("?").append(request.getQueryString()); }
}
// verify the response
// verify the response VerificationResult verification;
VerificationResult verification;
try {
try { verification = consumerManager.verify(receivingURL.toString(), openidResp, discovered);
verification = consumerManager.verify(receivingURL.toString(), openidResp, discovered); } catch (MessageException e) {
} catch (MessageException e) { throw new OpenIDConsumerException("Error verifying openid response", e);
throw new OpenIDConsumerException("Error verifying openid response", e); } catch (DiscoveryException e) {
} catch (DiscoveryException e) { throw new OpenIDConsumerException("Error verifying openid response", e);
throw new OpenIDConsumerException("Error verifying openid response", e); } catch (AssociationException e) {
} catch (AssociationException e) { throw new OpenIDConsumerException("Error verifying openid response", e);
throw new OpenIDConsumerException("Error verifying openid response", e); }
}
// examine the verification result and extract the verified identifier
// examine the verification result and extract the verified identifier Identifier verified = verification.getVerifiedId();
Identifier verified = verification.getVerifiedId();
if (verified != null) {
if (verified != null) { return new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.SUCCESS, verified.getIdentifier(),
return new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.SUCCESS, verified.getIdentifier(), "some message");
"some message"); } else {
} else { return new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.FAILURE,
return new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.FAILURE, discovered.getClaimedIdentifier().getIdentifier(),
discovered.getClaimedIdentifier().getIdentifier(), "Verification status message: [" + verification.getStatusMsg() + "]");
"Verification status message: [" + verification.getStatusMsg() + "]"); }
} }
} }
}

View File

@ -1,39 +1,35 @@
/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.security.providers.openid; 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 {
OpenIDAuthenticationToken token = newToken();
public void test() throws Exception { assertEquals(token, newToken());
OpenIDAuthenticationToken token = newToken(); }
assertEquals(token, newToken());
} private OpenIDAuthenticationToken newToken() {
return new OpenIDAuthenticationToken(
private OpenIDAuthenticationToken newToken() { OpenIDAuthenticationStatus.SUCCESS,
return new OpenIDAuthenticationToken( "http://raykrueger.blogspot.com/",
OpenIDAuthenticationStatus.SUCCESS, "what is this for anyway?");
"http://raykrueger.blogspot.com/", }
"what is this for anyway?"); }
}
}