SEC-935: Support for OpenID attribute exchange and changes to namespace syntax to allow simple configuration of attributes to request.
This commit is contained in:
@@ -22,8 +22,6 @@ import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
|
||||
/**
|
||||
* DOCUMENT ME!
|
||||
*
|
||||
* @author Robin Bramley, Opsera Ltd
|
||||
*/
|
||||
public class MockOpenIDConsumer implements OpenIDConsumer {
|
||||
@@ -54,17 +52,6 @@ public class MockOpenIDConsumer implements OpenIDConsumer {
|
||||
return redirectUrl;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.security.ui.openid.OpenIDConsumer#beginConsumption(javax.servlet.http.HttpServletRequest, java.lang.String)
|
||||
*/
|
||||
public String beginConsumption(HttpServletRequest req, String identityUrl, String returnToUrl)
|
||||
throws OpenIDConsumerException {
|
||||
throw new UnsupportedOperationException("This method is deprecated, stop using it");
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.security.ui.openid.OpenIDConsumer#endConsumption(javax.servlet.http.HttpServletRequest)
|
||||
*/
|
||||
public OpenIDAuthenticationToken endConsumption(HttpServletRequest req)
|
||||
throws OpenIDConsumerException {
|
||||
return token;
|
||||
@@ -79,9 +66,6 @@ public class MockOpenIDConsumer implements OpenIDConsumer {
|
||||
this.redirectUrl = redirectUrl;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.security.ui.openid.OpenIDConsumer#setReturnToUrl(java.lang.String)
|
||||
*/
|
||||
public void setReturnToUrl(String returnToUrl) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class OpenIDAuthenticationProviderTests extends TestCase {
|
||||
OpenIDAuthenticationProvider provider = new OpenIDAuthenticationProvider();
|
||||
provider.setUserDetailsService(new MockUserDetailsService());
|
||||
|
||||
Authentication preAuth = new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.CANCELLED, USERNAME, "");
|
||||
Authentication preAuth = new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.CANCELLED, USERNAME, "" ,null);
|
||||
|
||||
assertFalse(preAuth.isAuthenticated());
|
||||
|
||||
@@ -65,7 +65,7 @@ public class OpenIDAuthenticationProviderTests extends TestCase {
|
||||
OpenIDAuthenticationProvider provider = new OpenIDAuthenticationProvider();
|
||||
provider.setUserDetailsService(new MockUserDetailsService());
|
||||
|
||||
Authentication preAuth = new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.ERROR, USERNAME, "");
|
||||
Authentication preAuth = new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.ERROR, USERNAME, "", null);
|
||||
|
||||
assertFalse(preAuth.isAuthenticated());
|
||||
|
||||
@@ -84,7 +84,7 @@ public class OpenIDAuthenticationProviderTests extends TestCase {
|
||||
OpenIDAuthenticationProvider provider = new OpenIDAuthenticationProvider();
|
||||
provider.setUserDetailsService(new MockUserDetailsService());
|
||||
|
||||
Authentication preAuth = new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.FAILURE, USERNAME, "");
|
||||
Authentication preAuth = new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.FAILURE, USERNAME, "", null);
|
||||
|
||||
assertFalse(preAuth.isAuthenticated());
|
||||
|
||||
@@ -103,7 +103,7 @@ public class OpenIDAuthenticationProviderTests extends TestCase {
|
||||
OpenIDAuthenticationProvider provider = new OpenIDAuthenticationProvider();
|
||||
provider.setUserDetailsService(new MockUserDetailsService());
|
||||
|
||||
Authentication preAuth = new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.SETUP_NEEDED, USERNAME, "");
|
||||
Authentication preAuth = new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.SETUP_NEEDED, USERNAME, "", null);
|
||||
|
||||
assertFalse(preAuth.isAuthenticated());
|
||||
|
||||
@@ -122,7 +122,7 @@ public class OpenIDAuthenticationProviderTests extends TestCase {
|
||||
OpenIDAuthenticationProvider provider = new OpenIDAuthenticationProvider();
|
||||
provider.setUserDetailsService(new MockUserDetailsService());
|
||||
|
||||
Authentication preAuth = new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.SUCCESS, USERNAME, "");
|
||||
Authentication preAuth = new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.SUCCESS, USERNAME, "", null);
|
||||
|
||||
assertFalse(preAuth.isAuthenticated());
|
||||
|
||||
@@ -132,7 +132,7 @@ public class OpenIDAuthenticationProviderTests extends TestCase {
|
||||
assertTrue(postAuth instanceof OpenIDAuthenticationToken);
|
||||
assertTrue(postAuth.isAuthenticated());
|
||||
assertNotNull(postAuth.getPrincipal());
|
||||
assertEquals(preAuth.getPrincipal(), postAuth.getPrincipal());
|
||||
assertTrue(postAuth.getPrincipal() instanceof UserDetails);
|
||||
assertNotNull(postAuth.getAuthorities());
|
||||
assertTrue(postAuth.getAuthorities().size() > 0);
|
||||
assertTrue(((OpenIDAuthenticationToken) postAuth).getStatus() == OpenIDAuthenticationStatus.SUCCESS);
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.security.openid;
|
||||
|
||||
import org.springframework.security.openid.OpenIDAuthenticationStatus;
|
||||
import org.springframework.security.openid.OpenIDAuthenticationToken;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* @author Ray Krueger
|
||||
*/
|
||||
public class OpenIDAuthenticationTokenTests extends TestCase {
|
||||
|
||||
public void test() throws Exception {
|
||||
OpenIDAuthenticationToken token = newToken();
|
||||
assertEquals(token, newToken());
|
||||
}
|
||||
|
||||
private OpenIDAuthenticationToken newToken() {
|
||||
return new OpenIDAuthenticationToken(
|
||||
OpenIDAuthenticationStatus.SUCCESS,
|
||||
"http://raykrueger.blogspot.com/",
|
||||
"what is this for anyway?");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user