Locale aus Request
RoleRemote
1 files deleted
5 files added
16 files modified
New file |
| | |
| | | java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory |
| | | java.naming.provider.url=ssl://agnes.ostwall195.de:61617 |
| | | connectionFactoryNames=QueueCF |
| | | queue.hsadminSystem-h81=queue.hsadminSystem-h81 |
| | | queue.hsadminStatus=queue.hsadminStatus |
New file |
| | |
| | | hsadmin.jms.factory=QueueCF |
| | | hsadmin.jms.system-queue=hsadminSystem-h81 |
| | | hsadmin.jms.status-queue=hsadminStatus |
| | | hsadmin.jms.username=user-h81 |
| | | hsadmin.jms.password=geheim |
| | |
| | | import de.hsadmin.core.model.onetier.PersistenceManager; |
| | | import de.hsadmin.core.qserv.QueueClient; |
| | | import de.hsadmin.core.qserv.QueueTask; |
| | | import de.hsadmin.core.util.Config; |
| | | import de.hsadmin.mods.user.UnixUser; |
| | | |
| | | public class Transaction { |
| | |
| | | public UnixUser getLoginUser() { |
| | | String loginName = getLoginName(); |
| | | if (loginName != null && loginName.length() == 2) { |
| | | loginName = "hsh01-" + loginName; |
| | | loginName = Config.getInstance().getProperty("accountprefix.hostmaster", "hsh01") + "-" + loginName; |
| | | } |
| | | if (loginName != null && loginName.length() == 3) { |
| | | loginName = Config.getInstance().getProperty("accountprefix.customer", "hsh00") + "-" + loginName; |
| | | } |
| | | Query userQuery = getEntityManager().createQuery("SELECT u FROM UnixUsers u WHERE u.name = :username"); |
| | | userQuery.setParameter("username", loginName); |
| | |
| | | (runAsUser.equals(ticketUser) // user himself |
| | | || (ticketUser.length() == 5 && runAsUser.startsWith(ticketUser)) |
| | | // pac-admin |
| | | || (ticketUser.length() == 3 && runAsUser.startsWith(ticketUser)) |
| | | // member |
| | | || ticketUser.length() == 2) // hostmaster |
| | | // TODO: add test for member-account |
| | | ) { |
| | |
| | | } |
| | | } |
| | | |
| | | public String validateTicket(String ticket) throws AuthenticationException { |
| | | private String validateTicket(String ticket) throws AuthenticationException { |
| | | if (proxyServiceURL == null || proxyServiceURL == null) { |
| | | log.fatal("TicketValidator is not initialized."); |
| | | throw new RuntimeException("TicketValidator is not initialized."); |
| | |
| | | |
| | | public boolean isReadAllowedFor(UnixUser loginUser) { |
| | | return getName().equals(loginUser.getName()) |
| | | || getCustomer().getName().equals(loginUser.getName()) |
| | | || super.isReadAllowedFor(loginUser); |
| | | } |
| | | |
| | |
| | | import de.hsadmin.core.model.AbstractEntity; |
| | | import de.hsadmin.core.model.EntityInfo; |
| | | import de.hsadmin.core.model.FieldValidation; |
| | | import de.hsadmin.core.util.Config; |
| | | import de.hsadmin.mods.pac.Pac; |
| | | |
| | | @Entity(name = "UnixUsers") |
| | |
| | | public boolean hasHostmasterRole() { |
| | | // TODO: hardcoded Hostsharing conventions |
| | | String login = getName(); |
| | | return login.length() == 2 || ((login.startsWith("hsh01-") && login.length() == 8)); |
| | | return login.length() == 2 || ((login.startsWith(Config.getInstance().getProperty("accountprefix.hostmaster", "hsh01") + "-") && login.length() == 8)); |
| | | } |
| | | |
| | | /** |
New file |
| | |
| | | package de.hsadmin.remote; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import de.hsadmin.core.model.AbstractEntity; |
| | | import de.hsadmin.core.model.AuthenticationException; |
| | | import de.hsadmin.core.model.GenericModuleImpl; |
| | | import de.hsadmin.core.model.HSAdminException; |
| | | import de.hsadmin.core.model.TicketAuthentication; |
| | | import de.hsadmin.core.model.Transaction; |
| | | import de.hsadmin.core.util.Config; |
| | | import de.hsadmin.mods.dom.Domain; |
| | | |
| | | public class RoleRemote implements IRemote { |
| | | |
| | | private TicketAuthentication authentication; |
| | | |
| | | public RoleRemote() { |
| | | authentication = new TicketAuthentication(); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, String>> search(String runAsUser, String ticket, |
| | | Map<String, String> whereParams) throws HSAdminException { |
| | | String user = runAsUser; |
| | | Transaction transaction = new Transaction(user); |
| | | if (authentication.login(user, ticket)) { |
| | | String role = "USER"; |
| | | String accoutPrefixCustomer = Config.getInstance().getProperty("accountprefix.customer"); |
| | | String accoutPrefixHostmaster = Config.getInstance().getProperty("accountprefix.hostmaster"); |
| | | String pacName = transaction.getLoginUser().getPac().getName(); |
| | | if (accoutPrefixCustomer.equals(pacName)) { |
| | | role = "CUSTOMER"; |
| | | } |
| | | if (accoutPrefixHostmaster.equals(pacName)) { |
| | | role = "HOSTMASTER"; |
| | | } |
| | | if (user.equals(pacName)) { |
| | | role = "PAC_ADMIN"; |
| | | } |
| | | if (role.equals("USER")) { |
| | | GenericModuleImpl module = new GenericModuleImpl(transaction); |
| | | List<AbstractEntity> list = module.search(Domain.class, "obj.user.name = '" + user + "'", null); |
| | | if (list != null && list.size() > 0) { |
| | | role = "DOM_ADMIN"; |
| | | } |
| | | } |
| | | List<Map<String, String>> result = new ArrayList<Map<String,String>>(); |
| | | Map<String, String> record = new HashMap<String, String>(); |
| | | record.put("role", role); |
| | | result.add(record); |
| | | transaction.close(); |
| | | return result; |
| | | } else { |
| | | transaction.close(); |
| | | throw new AuthenticationException("authentication failed"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, String> add(String runAsUser, String ticket, |
| | | Map<String, String> setParams) throws HSAdminException { |
| | | throw new HSAdminException("not implemented"); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, String>> update(String runAsUser, String ticket, |
| | | Map<String, String> setParams, Map<String, String> whereParams) |
| | | throws HSAdminException { |
| | | throw new HSAdminException("not implemented"); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(String runAsUser, String ticket, |
| | | Map<String, String> whereParams) throws HSAdminException { |
| | | throw new HSAdminException("not implemented"); |
| | | } |
| | | |
| | | } |
| | |
| | | emailalias=de.hsadmin.remote.EMailAliasRemote |
| | | emailaddress=de.hsadmin.remote.EMailAddressRemote |
| | | q=de.hsadmin.remote.QueueTaskRemote |
| | | role=de.hsadmin.remote.RoleRemote |
| | |
| | | public void testAddMember() { |
| | | String user = "pe"; |
| | | int membersCount = -9999; |
| | | try { |
| | | membersCount = getMembersCount(user); |
| | | } catch (XmlRpcException e) { |
| | | fail(e.getMessage()); |
| | | } |
| | | membersCount = getMembersCount(); |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> setParams = new HashMap<String, String>(); |
| | | setParams.put("membercode", "hsh00-aaa"); |
| | | setParams.put("membercode", "hsh90-aaa"); |
| | | setParams.put("password", "geheimnIs"); |
| | | setParams.put("memberno", "20001"); |
| | | setParams.put("membersince", "01.10.2010"); |
| | |
| | | setParams }; |
| | | try { |
| | | client.execute(CUST_MODULE + ".add", params); |
| | | // Object execute = client.execute(MODULE + ".add", params); |
| | | // Object execute = client.execute(CUST_MODULE + ".add", params); |
| | | // Map<?, ?> result = (Map<?, ?>) execute; |
| | | // System.out.println(result); |
| | | assertEquals(membersCount + 1, getMembersCount(user)); |
| | | assertEquals(membersCount + 1, getMembersCount()); |
| | | } catch (XmlRpcException e) { |
| | | fail(e.getMessage()); |
| | | } |
| | |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> setParams = new HashMap<String, String>(); |
| | | setParams.put("name", "aaa00"); |
| | | setParams.put("hive", "h81"); |
| | | setParams.put("customer", "hsh00-aaa"); |
| | | setParams.put("hive", "h90"); |
| | | setParams.put("customer", "hsh90-aaa"); |
| | | setParams.put("basepac", "DW/B"); |
| | | setParams.put("curinetaddr", "192.168.108.203"); |
| | | setParams.put("curinetaddr", "83.223.95.132"); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | | setParams }; |
| | |
| | | assertEquals(count + 1, getPacsCount()); |
| | | } |
| | | |
| | | private int getMembersCount(String user) throws XmlRpcException { |
| | | @Test |
| | | public void testDelPac() { |
| | | int count = getPacsCount(); |
| | | String user = "pe"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> whereParams = new HashMap<String, String>(); |
| | | whereParams.put("name", "aaa00"); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | | whereParams }; |
| | | try { |
| | | client.execute(PAC_MODULE + ".delete", params); |
| | | } catch (XmlRpcException e) { |
| | | fail(e.getMessage()); |
| | | } |
| | | assertEquals(count - 1, getPacsCount()); |
| | | } |
| | | |
| | | @Test |
| | | public void testDelMember() { |
| | | int count = getMembersCount(); |
| | | String user = "pe"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> whereParams = new HashMap<String, String>(); |
| | | whereParams.put("membercode", "hsh90-aaa"); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | | whereParams }; |
| | | try { |
| | | client.execute(CUST_MODULE + ".delete", params); |
| | | } catch (XmlRpcException e) { |
| | | fail(e.getMessage()); |
| | | } |
| | | assertEquals(count - 1, getMembersCount()); |
| | | } |
| | | |
| | | private int getMembersCount() { |
| | | int count = 0; |
| | | String user = "pe"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> whereParams = new HashMap<String, String>(); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | | whereParams }; |
| | | Object execute = client.execute(CUST_MODULE + ".search", params); |
| | | Object[] result = (Object[]) execute; |
| | | return result.length; |
| | | Object execute; |
| | | try { |
| | | execute = client.execute(CUST_MODULE + ".search", params); |
| | | Object[] result = (Object[]) execute; |
| | | count = result.length; |
| | | } catch (XmlRpcException e) { |
| | | fail(e.getMessage()); |
| | | } |
| | | return count; |
| | | } |
| | | |
| | | private int getPacsCount() { |
| | |
| | | String user = "pe"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> whereParams = new HashMap<String, String>(); |
| | | whereParams.put("customer", "hsh00-aaa"); |
| | | whereParams.put("customer", "hsh90-aaa"); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | | whereParams }; |
| | |
| | | import org.junit.Before; |
| | | import org.junit.Test; |
| | | |
| | | import de.hsadmin.core.util.Config; |
| | | |
| | | public class PacTest { |
| | | |
| | | private static final String MODULE = "pac"; |
| | | |
| | | private XmlRpcClient client; |
| | | private RemoteCASHelper cas; |
| | | private Config config; |
| | | |
| | | @Before |
| | | public void setUp() throws Exception { |
| | | client = RemoteTestHelper.getClient(); |
| | | cas = new RemoteCASHelper(); |
| | | config = Config.getInstance(); |
| | | } |
| | | |
| | | @After |
| | |
| | | |
| | | @Test |
| | | public void testSearchAllAsPacAdmin() { |
| | | String user = "peh00"; |
| | | String user = "aaa00"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> whereParams = new HashMap<String, String>(); |
| | | Object[] params = new Object[] { user, |
| | |
| | | for (Object o : result) { |
| | | if (o instanceof Map<?, ?>) { |
| | | Map<?, ?> row = (Map<?, ?>) o; |
| | | assertEquals("hsh00-peh", row.get("customer")); |
| | | assertEquals(config.getProperty("accountprefix.customer") + "-aaa", row.get("customer")); |
| | | } else { |
| | | fail("map expected"); |
| | | } |
| | |
| | | |
| | | @Test |
| | | public void testUpdate() { |
| | | String user = "peh00"; |
| | | String user = "aaa00"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> setParams = new HashMap<String, String>(); |
| | | Map<String, String> whereParams = new HashMap<String, String>(); |
| | | setParams.put("curinetaddr", "192.168.10.2"); |
| | | whereParams.put("name", "peh00"); |
| | | whereParams.put("name", "aaa00"); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | | setParams, whereParams }; |
| | |
| | | String user = "pe"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> setParams = new HashMap<String, String>(); |
| | | setParams.put("name", "peh07"); |
| | | setParams.put("hive", "h05"); |
| | | setParams.put("customer", "hsh00-peh"); |
| | | setParams.put("basepac", "DW/S"); |
| | | setParams.put("curinetaddr", "212.42.230.178"); |
| | | setParams.put("name", "aaa01"); |
| | | setParams.put("hive", "h90"); |
| | | setParams.put("customer", config.getProperty("accountprefix.customer") + "-aaa"); |
| | | setParams.put("basepac", "DW/B"); |
| | | setParams.put("curinetaddr", "83.223.95.133"); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | | setParams }; |
| | |
| | | String user = "pe"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> whereParams = new HashMap<String, String>(); |
| | | whereParams.put("name", "peh07"); |
| | | whereParams.put("name", "aaa01"); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | | whereParams }; |
| | |
| | | |
| | | private int getPacsCount() { |
| | | int count = 0; |
| | | String user = "pe"; |
| | | String user = "hsh90-aaa"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> whereParams = new HashMap<String, String>(); |
| | | whereParams.put("customer", "hsh00-peh"); |
| | | whereParams.put("customer", config.getProperty("accountprefix.customer") + "-aaa"); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | | whereParams }; |
New file |
| | |
| | | package de.hsadmin.remote; |
| | | |
| | | import static org.junit.Assert.assertEquals; |
| | | import static org.junit.Assert.assertTrue; |
| | | import static org.junit.Assert.fail; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import org.apache.xmlrpc.XmlRpcException; |
| | | import org.apache.xmlrpc.client.XmlRpcClient; |
| | | import org.junit.After; |
| | | import org.junit.Before; |
| | | import org.junit.Test; |
| | | |
| | | public class RoleTest { |
| | | |
| | | private static final String MODULE = "role"; |
| | | |
| | | private XmlRpcClient client; |
| | | private RemoteCASHelper cas; |
| | | |
| | | @Before |
| | | public void setUp() throws Exception { |
| | | client = RemoteTestHelper.getClient(); |
| | | cas = new RemoteCASHelper(); |
| | | } |
| | | |
| | | @After |
| | | public void tearDown() throws Exception { |
| | | client = null; |
| | | cas = null; |
| | | } |
| | | |
| | | @Test |
| | | public void testPacAdmin() { |
| | | String user = "aaa00"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> whereParams = new HashMap<String, String>(); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | | whereParams }; |
| | | try { |
| | | Object execute = client.execute(MODULE + ".search", params); |
| | | Object[] result = (Object[]) execute; |
| | | assertTrue(result.length == 1); |
| | | String role = (String) ((Map<?, ?>) result[0]).get("role"); |
| | | assertEquals("PAC_ADMIN", role); |
| | | } catch (XmlRpcException e) { |
| | | fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void testDomAdmin() { |
| | | String user = "aaa00-admin"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> whereParams = new HashMap<String, String>(); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | | whereParams }; |
| | | try { |
| | | Object execute = client.execute(MODULE + ".search", params); |
| | | Object[] result = (Object[]) execute; |
| | | assertTrue(result.length == 1); |
| | | String role = (String) ((Map<?, ?>) result[0]).get("role"); |
| | | assertEquals("DOM_ADMIN", role); |
| | | } catch (XmlRpcException e) { |
| | | fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void testCustomer() { |
| | | String user = "aaa"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> whereParams = new HashMap<String, String>(); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | | whereParams }; |
| | | try { |
| | | Object execute = client.execute(MODULE + ".search", params); |
| | | Object[] result = (Object[]) execute; |
| | | assertTrue(result.length == 1); |
| | | String role = (String) ((Map<?, ?>) result[0]).get("role"); |
| | | assertEquals("CUSTOMER", role); |
| | | } catch (XmlRpcException e) { |
| | | fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Test |
| | | public void testHostmaster() { |
| | | String user = "pe"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> whereParams = new HashMap<String, String>(); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | | whereParams }; |
| | | try { |
| | | Object execute = client.execute(MODULE + ".search", params); |
| | | Object[] result = (Object[]) execute; |
| | | assertTrue(result.length == 1); |
| | | String role = (String) ((Map<?, ?>) result[0]).get("role"); |
| | | assertEquals("HOSTMASTER", role); |
| | | } catch (XmlRpcException e) { |
| | | fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | @Test |
| | | public void testSearchAsPacAdmin() { |
| | | String user = "peh00"; |
| | | String user = "aaa00"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> whereParams = new HashMap<String, String>(); |
| | | Object[] params = new Object[] { user, |
| | |
| | | try { |
| | | Object execute = client.execute(MODULE + ".search", params); |
| | | Object[] result = (Object[]) execute; |
| | | assertEquals(21, result.length); |
| | | assertEquals(1, result.length); |
| | | for (Object o : result) { |
| | | if (o instanceof Map<?, ?>) { |
| | | Map<?, ?> row = (Map<?, ?>) o; |
| | | assertEquals("peh00", row.get("pac")); |
| | | assertEquals("aaa00", row.get("pac")); |
| | | } else { |
| | | fail("map expected"); |
| | | } |
| | |
| | | public void testAddAsPacAdmin() { |
| | | int count = getObjectCount(); |
| | | try { |
| | | String user = "peh00"; |
| | | String user = "aaa00"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> setParams = new HashMap<String, String>(); |
| | | setParams.put("name", "peh00-test2"); |
| | | setParams.put("name", "aaa00-test2"); |
| | | setParams.put("password", "test123"); |
| | | setParams.put("quota", "128"); |
| | | setParams.put("quotalimit", "192"); |
| | |
| | | Object execute = client.execute(MODULE + ".add", params); |
| | | if (execute instanceof Map<?, ?>) { |
| | | Map<?, ?> entry = (Map<?, ?>) execute; |
| | | assertEquals("peh00-test2", entry.get("name")); |
| | | assertEquals("peh00", entry.get("pac")); |
| | | assertEquals("aaa00-test2", entry.get("name")); |
| | | assertEquals("aaa00", entry.get("pac")); |
| | | assertEquals(null, entry.get("password")); |
| | | } else { |
| | | fail("map expected"); |
| | |
| | | public void testAddAsPacAdminFail() { |
| | | int count = getObjectCount(); |
| | | try { |
| | | String user = "peh00"; |
| | | String user = "aaa00"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> setParams = new HashMap<String, String>(); |
| | | setParams.put("name", "peh01-testfail"); |
| | |
| | | public void testAddWithFalseName() { |
| | | int count = getObjectCount(); |
| | | try { |
| | | String user = "peh00"; |
| | | String user = "aaa00"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> setParams = new HashMap<String, String>(); |
| | | setParams.put("name", "peh00-langer-name"); |
| | | setParams.put("name", "aaa00-langer-name"); |
| | | setParams.put("password", "test123"); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | |
| | | public void testUpdateAsPacAdmin() { |
| | | int count = getObjectCount(); |
| | | try { |
| | | String user = "peh00"; |
| | | String user = "aaa00"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> whereParams = new HashMap<String, String>(); |
| | | Map<String, String> setParams = new HashMap<String, String>(); |
| | | whereParams.put("name", "peh00-test2"); |
| | | whereParams.put("name", "aaa00-test2"); |
| | | setParams.put("password", "test1234"); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | |
| | | if (o instanceof Map<?, ?>) { |
| | | Map<?, ?> entry = (Map<?, ?>) o; |
| | | assertNull(entry.get("password")); |
| | | assertEquals("peh00-test2", entry.get("name")); |
| | | assertEquals("aaa00-test2", entry.get("name")); |
| | | } else { |
| | | fail("map expected"); |
| | | } |
| | |
| | | public void testDeleteWithLongName() { |
| | | int count = getObjectCount(); |
| | | try { |
| | | String user = "peh00"; |
| | | String user = "aaa00"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> whereParams = new HashMap<String, String>(); |
| | | whereParams.put("name", "peh00-langer-name"); |
| | | whereParams.put("name", "aaa00-langer-name"); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | | whereParams }; |
| | |
| | | assertEquals(count, getObjectCount()); |
| | | } |
| | | |
| | | @Test |
| | | public void testDeleteAsPacAdminFail() { |
| | | int count = getObjectCount(); |
| | | try { |
| | | String user = "peh01"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> whereParams = new HashMap<String, String>(); |
| | | whereParams.put("name", "peh00-test2"); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | | whereParams }; |
| | | Object execute = client.execute(MODULE + ".delete", params); |
| | | assertNull(execute); |
| | | } catch (XmlRpcException e) { |
| | | fail(e.getMessage()); |
| | | } |
| | | assertEquals(count, getObjectCount()); |
| | | } |
| | | // @Test |
| | | // public void testDeleteAsPacAdminFail() { |
| | | // int count = getObjectCount(); |
| | | // try { |
| | | // String user = "aaa01"; |
| | | // String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | // Map<String, String> whereParams = new HashMap<String, String>(); |
| | | // whereParams.put("name", "aaa00-test2"); |
| | | // Object[] params = new Object[] { user, |
| | | // cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | | // whereParams }; |
| | | // Object execute = client.execute(MODULE + ".delete", params); |
| | | // assertNull(execute); |
| | | // } catch (XmlRpcException e) { |
| | | // fail(e.getMessage()); |
| | | // } |
| | | // assertEquals(count, getObjectCount()); |
| | | // } |
| | | |
| | | @Test |
| | | public void testDeleteAsPacAdmin() { |
| | | int count = getObjectCount(); |
| | | try { |
| | | String user = "peh00"; |
| | | String user = "aaa00"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> whereParams = new HashMap<String, String>(); |
| | | whereParams.put("name", "peh00-test2"); |
| | | whereParams.put("name", "aaa00-test2"); |
| | | Object[] params = new Object[] { user, |
| | | cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), |
| | | whereParams }; |
| | |
| | | private int getObjectCount() { |
| | | int count = -1; |
| | | try { |
| | | String user = "peh00"; |
| | | String user = "aaa00"; |
| | | String grantingTicketURL = cas.getGrantingTicketURL(user); |
| | | Map<String, String> whereParams = new HashMap<String, String>(); |
| | | Object[] params = new Object[] { user, |
| | |
| | | </context-param> |
| | | <context-param> |
| | | <param-name>backendURL</param-name> |
| | | <param-value>https://agnes.ostwall195.de:9443/hsar/backend</param-value> |
| | | <param-value>https://config-dev.hostsharing.net:443/hsar/backend</param-value> |
| | | </context-param> |
| | | <context-param> |
| | | <param-name>xmlrpcURL</param-name> |
| | | <param-value>https://agnes.ostwall195.de:9443/hsar/xmlrpc/hsadmin</param-value> |
| | | <param-value>https://config-dev.hostsharing.net:443/hsar/xmlrpc/hsadmin</param-value> |
| | | </context-param> |
| | | <context-param> |
| | | <description>Vaadin production mode</description> |
| | |
| | | <filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class> |
| | | <init-param> |
| | | <param-name>casServerLoginUrl</param-name> |
| | | <param-value>https://agnes.ostwall195.de:9443/cas/login</param-value> |
| | | <param-value>https://login-dev.hostsharing.net:443/cas/login</param-value> |
| | | </init-param> |
| | | <init-param> |
| | | <param-name>service</param-name> |
| | |
| | | <filter-class>org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter</filter-class> |
| | | <init-param> |
| | | <param-name>casServerUrlPrefix</param-name> |
| | | <param-value>https://agnes.ostwall195.de:9443/cas</param-value> |
| | | <param-value>https://login-dev.hostsharing.net:443/cas</param-value> |
| | | </init-param> |
| | | <init-param> |
| | | <param-name>proxyReceptorUrl</param-name> |
| | |
| | | |
| | | @Override |
| | | protected void initModule() { |
| | | moduleConfig = new ModuleConfig("domain"); |
| | | String login = getApplication().getLogin(); |
| | | MainApplication application = getApplication(); |
| | | moduleConfig = new ModuleConfig("domain", application.getLocale()); |
| | | String login = application.getLogin(); |
| | | final String pac = login.length() >= 5 ? login.substring(0, 5) : ""; |
| | | PropertyConfig idProp = new PropertyConfig(moduleConfig, "id", Long.class, PropertyTableColumn.INTERNAL_KEY); |
| | | idProp.setReadOnly(true); |
| | |
| | | |
| | | @Override |
| | | protected void initModule() { |
| | | moduleConfig = new ModuleConfig("emailaddress"); |
| | | String login = getApplication().getLogin(); |
| | | MainApplication application = getApplication(); |
| | | moduleConfig = new ModuleConfig("emailaddress", application.getLocale()); |
| | | String login = application.getLogin(); |
| | | final String pac = login.length() >= 5 ? login.substring(0, 5) : ""; |
| | | PropertyConfig idProp = new PropertyConfig(moduleConfig, "id", Long.class, PropertyTableColumn.INTERNAL_KEY); |
| | | idProp.setReadOnly(true); |
| | |
| | | |
| | | @Override |
| | | protected void initModule() { |
| | | moduleConfig = new ModuleConfig("emailalias"); |
| | | String login = getApplication().getLogin(); |
| | | MainApplication application = getApplication(); |
| | | moduleConfig = new ModuleConfig("emailalias", application.getLocale()); |
| | | String login = application.getLogin(); |
| | | final String pac = login.length() >= 5 ? login.substring(0, 5) : ""; |
| | | PropertyConfig idProp = new PropertyConfig(moduleConfig, "id", Long.class, PropertyTableColumn.INTERNAL_KEY); |
| | | idProp.setReadOnly(true); |
| | |
| | | private LocaleConfig localeConfig; |
| | | private Remote remote; |
| | | private Map<String, Module> modules; |
| | | private Locale requestLocale; |
| | | |
| | | |
| | | @Override |
| | | public void init() { |
| | | localeConfig = new LocaleConfig(Locale.getDefault(), "main"); |
| | | Locale locale = requestLocale; |
| | | if (locale == null) { |
| | | locale = Locale.getDefault(); |
| | | } |
| | | localeConfig = new LocaleConfig(locale, "main"); |
| | | remote = new Remote(this); |
| | | Window mainWindow = new Window(localeConfig.getText("applicationtitle")); |
| | | VerticalLayout verticalLayout = new VerticalLayout(); |
| | |
| | | return localeConfig; |
| | | } |
| | | |
| | | public Locale getRequestLocale() { |
| | | return requestLocale; |
| | | } |
| | | |
| | | @Override |
| | | public void onRequestStart(HttpServletRequest request, |
| | | HttpServletResponse response) { |
| | | requestLocale = request.getLocale(); |
| | | httpSession = request.getSession(); |
| | | servletContext = httpSession.getServletContext(); |
| | | userPrincipal = ((Assertion) httpSession.getAttribute(AuthenticationFilter.CONST_CAS_ASSERTION)).getPrincipal(); |
| | |
| | | |
| | | @Override |
| | | protected void initModule() { |
| | | moduleConfig = new ModuleConfig("q"); |
| | | moduleConfig = new ModuleConfig("q", getApplication().getLocale()); |
| | | moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, PropertyTableColumn.INTERNAL_KEY)); |
| | | moduleConfig.addProperty(new PropertyConfig(moduleConfig, "title", String.class)); |
| | | moduleConfig.addProperty(new PropertyConfig(moduleConfig, "status", String.class)); |
| | |
| | | |
| | | @Override |
| | | protected void initModule() { |
| | | moduleConfig = new ModuleConfig("user"); |
| | | String login = getApplication().getLogin(); |
| | | MainApplication application = getApplication(); |
| | | moduleConfig = new ModuleConfig("user", application.getLocale()); |
| | | String login = application.getLogin(); |
| | | final String pac = login.length() >= 5 ? login.substring(0, 5) : ""; |
| | | PropertyConfig pacProp = new PropertyConfig(moduleConfig, "pac", String.class, PropertyTableColumn.HIDDEN, new SelectPropertyFieldFactory()); |
| | | pacProp.setSelectValues(new PropertySelectValues() { |
| | |
| | | private Map<String, PropertyConfig> propertyMap; |
| | | private LocaleConfig localeConfig; |
| | | |
| | | public ModuleConfig(String name) { |
| | | public ModuleConfig(String name, Locale locale) { |
| | | this.name = name; |
| | | propertyList = new ArrayList<PropertyConfig>(); |
| | | propertyMap = new HashMap<String, PropertyConfig>(); |
| | | localeConfig = new LocaleConfig(Locale.getDefault(), name); |
| | | localeConfig = new LocaleConfig(locale, name); |
| | | } |
| | | |
| | | public String getName() { |