[jboss-cvs] JBossAS SVN: r62533 - trunk/testsuite/src/main/org/jboss/test/security/managers.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Apr 25 00:24:40 EDT 2007
Author: anil.saldhana at jboss.com
Date: 2007-04-25 00:24:40 -0400 (Wed, 25 Apr 2007)
New Revision: 62533
Removed:
trunk/testsuite/src/main/org/jboss/test/security/managers/AuthorizationManagerServiceUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/security/managers/AuthorizationManagerUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/security/managers/JASPISecurityManagerServiceUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/security/managers/JASPISecurityManagerUnitTestCase.java
Log:
remove obsolete test cases on jaspi/authz managers
Deleted: trunk/testsuite/src/main/org/jboss/test/security/managers/AuthorizationManagerServiceUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/security/managers/AuthorizationManagerServiceUnitTestCase.java 2007-04-25 04:23:31 UTC (rev 62532)
+++ trunk/testsuite/src/main/org/jboss/test/security/managers/AuthorizationManagerServiceUnitTestCase.java 2007-04-25 04:24:40 UTC (rev 62533)
@@ -1,58 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.security.managers;
-
-import javax.management.JMException;
-import javax.management.MBeanInfo;
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-
-import org.jboss.test.JBossTestCase;
-
-//$Id$
-
-/**
- * Unit Tests Authorization Manager Service
- * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- * @since Jan 5, 2006
- * @version $Revision$
- */
-public class AuthorizationManagerServiceUnitTestCase extends JBossTestCase
-{
- private ObjectName objectName = null;
-
- public AuthorizationManagerServiceUnitTestCase(String name)
- throws JMException
- {
- super(name);
- objectName = new ObjectName("jboss.security:service=AuthorizationManager");
- }
-
- public void testAuthorizationServiceExistence() throws Exception
- {
- MBeanServerConnection server = this.getServer();
- MBeanInfo info = server.getMBeanInfo(objectName);
- assertNotNull("MBeanInfo != null?", info);
- String origAuthName = (String)server.getAttribute(objectName, "AuthorizationManagerClassName");
- assertNotNull("AuthorizationManager name != null", origAuthName);
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/test/security/managers/AuthorizationManagerUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/security/managers/AuthorizationManagerUnitTestCase.java 2007-04-25 04:23:31 UTC (rev 62532)
+++ trunk/testsuite/src/main/org/jboss/test/security/managers/AuthorizationManagerUnitTestCase.java 2007-04-25 04:24:40 UTC (rev 62533)
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.security.managers;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.security.AuthorizationManager;
-import org.jboss.security.SimplePrincipal;
-import org.jboss.security.plugins.JBossAuthorizationManager;
-
-//$Id$
-
-/**
- * Unit Test Case for the Default AuthorizationManager implementation
- * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- * @since Jan 5, 2006
- * @version $Revision$
- */
-public class AuthorizationManagerUnitTestCase extends JASPISecurityManagerUnitTestCase
-{
- public AuthorizationManagerUnitTestCase(String name)
- {
- super(name);
- }
-
- public void testSuccessfulValidation() throws Exception
- {
- super.testSuccessfulValidation();
-
- //Lets deal with Authorization also
- JBossAuthorizationManager jsm = new JBossAuthorizationManager("java:/jaas/other",null);
- assertNotNull("JBossAuthorizationManager != null?", jsm);
- assertTrue("JBossAuthorizationManager instanceof AuthorizationManager",
- jsm instanceof AuthorizationManager);
- assertNotNull("Principal from super class != null", id);
- Set roles = jsm.getUserRoles(id);
- assertTrue("admin has roles?", roles != null);
- assertTrue("admin has roles?", roles.size() > 0);
- HashSet set = new HashSet();
- set.add(new SimplePrincipal("TestRole"));
- boolean hasRole = jsm.doesUserHaveRole(id,set);
- assertTrue("admin has TestRole?", hasRole);
- set.clear();
- set.add(new SimplePrincipal("BadRole"));
- hasRole = jsm.doesUserHaveRole(id,set);
- assertFalse("admin should not have BadRole?", hasRole);
- }
-
-}
Deleted: trunk/testsuite/src/main/org/jboss/test/security/managers/JASPISecurityManagerServiceUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/security/managers/JASPISecurityManagerServiceUnitTestCase.java 2007-04-25 04:23:31 UTC (rev 62532)
+++ trunk/testsuite/src/main/org/jboss/test/security/managers/JASPISecurityManagerServiceUnitTestCase.java 2007-04-25 04:24:40 UTC (rev 62533)
@@ -1,58 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.security.managers;
-
-import javax.management.JMException;
-import javax.management.MBeanInfo;
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-
-import org.jboss.test.JBossTestCase;
-
-//$Id$
-
-/**
- * Unit Test Case for the JASPISecurityManagerService
- * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- * @since Jan 6, 2006
- * @version $Revision$
- */
-public class JASPISecurityManagerServiceUnitTestCase extends JBossTestCase
-{
- private ObjectName objectName = null;
-
- public JASPISecurityManagerServiceUnitTestCase(String name)
- throws JMException
- {
- super(name);
- objectName = new ObjectName("jboss.security:service=JASPISecurityManager");
- }
-
- public void testJASPISecurityManagerServiceExistence() throws Exception
- {
- MBeanServerConnection server = this.getServer();
- MBeanInfo info = server.getMBeanInfo(objectName);
- assertNotNull("MBeanInfo != null?", info);
- String origAuthName = (String)server.getAttribute(objectName, "SecurityManagerClassName");
- assertNotNull("SecurityManager name != null", origAuthName);
- }
-}
Deleted: trunk/testsuite/src/main/org/jboss/test/security/managers/JASPISecurityManagerUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/security/managers/JASPISecurityManagerUnitTestCase.java 2007-04-25 04:23:31 UTC (rev 62532)
+++ trunk/testsuite/src/main/org/jboss/test/security/managers/JASPISecurityManagerUnitTestCase.java 2007-04-25 04:24:40 UTC (rev 62533)
@@ -1,125 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.security.managers;
-
-import java.io.IOException;
-import java.lang.reflect.UndeclaredThrowableException;
-import java.security.Principal;
-
-import javax.security.auth.Subject;
-import javax.security.auth.login.Configuration;
-import javax.security.auth.message.config.ServerAuthContext;
-
-import org.jboss.security.AuthenticationManager;
-import org.jboss.security.SecurityAssociation;
-import org.jboss.security.SimplePrincipal;
-import org.jboss.security.auth.callback.SecurityAssociationHandler;
-import org.jboss.security.auth.login.XMLLoginConfigImpl;
-import org.jboss.security.plugins.JASPISecurityManager;
-import org.jboss.test.JBossTestCase;
-import org.jboss.test.util.AppCallbackHandler;
-
-//$Id$
-
-/**
- * Unit TestCase for the Default JASPISecurityManager implementation
- * @author <a href="mailto:Anil.Saldhana at jboss.org">Anil Saldhana</a>
- * @since Dec 30, 2005
- * @version $Revision$
- */
-public class JASPISecurityManagerUnitTestCase extends JBossTestCase
-{
- protected Principal id = null;
-
- public JASPISecurityManagerUnitTestCase(String name)
- {
- super(name);
- }
-
- public void testConstruction() throws Exception
- {
- Configuration cfg = getConfiguration();
- Configuration.setConfiguration(cfg);
- JASPISecurityManager jsm = new JASPISecurityManager();
- checkJASPISecurityManagerObject(jsm);
-
- jsm = new JASPISecurityManager("jaspi", new SecurityAssociationHandler());
- checkJASPISecurityManagerObject(jsm);
- //Check for bad CallbackHandler passage that has no setSecurityInfo method
- try
- {
- jsm = new JASPISecurityManager("jaspi", new AppCallbackHandler("test","pwd".toCharArray()));
- fail("JASPISecurityManager ctr should throw " +
- "an exception as handler has no setSecurityInfo method");
- }catch(UndeclaredThrowableException ute)
- {
- Throwable t = ute.getUndeclaredThrowable();
- if(t instanceof NoSuchMethodException == false)
- {
- fail("Test failed while expecting NoMethodException");
- }
- }
- }
-
- public void testSuccessfulValidation() throws Exception
- {
- Configuration cfg = getConfiguration();
- Configuration.setConfiguration(cfg);
- JASPISecurityManager jsm = new JASPISecurityManager("java:/jaas/other",
- new SecurityAssociationHandler());
- Subject subject = new Subject();
- Object cred = "secret";
- id = new SimplePrincipal("admin");
- SecurityAssociation.setPrincipal(id);
- SecurityAssociation.setCredential(cred);
- boolean isValid = jsm.isValid( id,cred,subject);
- assertTrue("Successful validation?", isValid);
- SecurityAssociation.pushSubjectContext(subject,id, cred);
- }
-
- public void testUnSuccessfulValidation() throws Exception
- {
- Configuration cfg = getConfiguration();
- Configuration.setConfiguration(cfg);
- JASPISecurityManager jsm = new JASPISecurityManager("java:/jaas/other",
- new SecurityAssociationHandler());
- boolean isValid = jsm.isValid(new SimplePrincipal("admin"),"bad");
- assertFalse("Should be invalid?", isValid);
- }
-
- //private methods
- private void checkJASPISecurityManagerObject(JASPISecurityManager jsm)
- {
- assertNotNull("JASPISecurityManager != null?", jsm);
- assertTrue("is AuthenticationManager?", jsm instanceof AuthenticationManager);
- assertTrue("is ServerAuthContext?", jsm instanceof ServerAuthContext);
- }
-
- private Configuration getConfiguration() throws IOException
- {
- // Install the custom JAAS configuration
- XMLLoginConfigImpl config = new XMLLoginConfigImpl();
- config.setConfigResource("security/login-config.xml");
- config.loadConfig();
- return config;
- }
-}
More information about the jboss-cvs-commits
mailing list