<!-- legal values for dumpServiceResult=[minimal,detailed,full] -->\r
<dump payloads="false" dumpServiceResult="minimal" />\r
\r
- <auths default="test">\r
- <auth ID="test">dGVzdDp0ZXN0</auth>\r
+ <auths default="admin@collectionspace.org">\r
+ <auth ID="admin@collectionspace.org">YWRtaW5AY29sbGVjdGlvbnNwYWNlLm9yZzpBZG1pbmlzdHJhdG9y</auth>\r
</auths>\r
\r
\r
<!-- legal values for dumpServiceResult=[minimal,detailed,full] -->\r
<dump payloads="false" dumpServiceResult="minimal" />\r
\r
- <auths default="test">\r
- <auth ID="test">dGVzdDp0ZXN0</auth>\r
+ <auths default="admin@collectionspace.org">\r
+ <auth ID="admin@collectionspace.org">YWRtaW5AY29sbGVjdGlvbnNwYWNlLm9yZzpBZG1pbmlzdHJhdG9y</auth>\r
</auths>\r
\r
\r
<xmlReplay>\r
<auths>\r
<!-- IMPORTANT: THESE ARE STICKY :: THEY STICK AROUND UNTIL RESET, IN EXEC ORDER OF THIS FILE. -->\r
- <auth ID="test">dGVzdDp0ZXN0</auth>\r
+ <auth ID="admin@collectionspace.org">59PnafP1k9rcuGNMxbCfyQ3TphxKBqecsJI2Yv5vrms=</auth>\r
<auth ID="bigbird2010">YmlnYmlyZDIwMTA6YmlnYmlyZDIwMTA=</auth>\r
</auths>\r
\r
</test>\r
\r
<!-- should succeed on auth="test" since test is admin user. -->\r
- <test ID="dimension2" auth="test">\r
+ <test ID="dimension2" auth="admin@collectionspace.org">\r
<!-- actually, this one should succeed since "test" is admin, but it fails now. -->\r
<expectedCodes>201,403</expectedCodes>\r
<method>POST</method>\r
\r
<testGroup ID="dimensionCRUDGroup" autoDeletePOSTS="true">\r
<!-- should succeed on auth="test" since test is admin user. -->\r
- <test ID="dimPOST" auth="test">\r
+ <test ID="dimPOST" auth="admin@collectionspace.org">\r
<!-- actually, this one should succeed since "test" is admin, but it fails now. -->\r
<expectedCodes>201</expectedCodes>\r
<method>POST</method>\r
</part>\r
</test>\r
\r
- <test ID="dimGET" auth="test">\r
+ <test ID="dimGET" auth="admin@collectionspace.org">\r
<!-- actually, this one should succeed since "test" is admin, but it fails now. -->\r
<method>GET</method>\r
<uri>/cspace-services/dimensions/${dimPOST.CSID}</uri>\r
</test>\r
\r
- <test ID="dimPUT" auth="test">\r
+ <test ID="dimPUT" auth="admin@collectionspace.org">\r
<method>PUT</method>\r
<uri>/cspace-services/dimensions/${dimPOST.CSID}</uri>\r
<part>\r
</part>\r
</test>\r
\r
- <test ID="dimGET2" auth="test">\r
+ <test ID="dimGET2" auth="admin@collectionspace.org">\r
<method>GET</method>\r
<uri>/cspace-services/dimensions/${dimPOST.CSID}</uri>\r
</test>\r
\r
</xmlReplay>\r
\r
-
\ No newline at end of file
+ \r
<xmlReplay>\r
<auths>\r
<!-- IMPORTANT: THESE ARE STICKY :: THEY STICK AROUND UNTIL RESET, IN EXEC ORDER OF THIS FILE. -->\r
- <auth ID="test">dGVzdDp0ZXN0</auth>\r
+ <auth ID="admin@collectionspace.org">YWRtaW5AY29sbGVjdGlvbnNwYWNlLm9yZzpBZG1pbmlzdHJhdG9y</auth>\r
</auths>\r
\r
<!-- ================================================================================ -->\r
\r
<testGroup ID="CRUDL" autoDeletePOSTS="true">\r
- <test ID="oe1" auth="test">\r
+ <test ID="oe1" auth="admin@collectionspace.org">\r
<method>POST</method>\r
<uri>/cspace-services/objectexit/</uri>\r
<part>\r
\r
</xmlReplay>\r
\r
-
\ No newline at end of file
+ \r
<?xml version="1.0" encoding="UTF-8"?>\r
<xmlReplay>\r
<testGroup ID="organization" autoDeletePOSTS="true">\r
- <test ID="OrgAuth1" auth="test">\r
+ <test ID="OrgAuth1" auth="admin@collectionspace.org">\r
<method>POST</method>\r
<uri>/cspace-services/orgauthorities/</uri>\r
<part>\r
<xmlReplay>\r
<auths>\r
<!-- IMPORTANT: THESE ARE STICKY :: THEY STICK AROUND UNTIL RESET, IN EXEC ORDER OF THIS FILE. -->\r
- <auth ID="test">dGVzdDp0ZXN0</auth>\r
- <auth ID="test-pahma">dGVzdC1wYWhtYTp0ZXN0</auth>\r
+ <auth ID="admin@collectionspace.org">YWRtaW5AY29sbGVjdGlvbnNwYWNlLm9yZzpBZG1pbmlzdHJhdG9y</auth>\r
<auth ID="user1@museum1">dXNlcjFAbXVzZXVtMS5vcmc6dXNlcjFAbXVzZXVtMS5vcmc=</auth>\r
<auth ID="bigbird2010">YmlnYmlyZDIwMTA6YmlnYmlyZDIwMTA=</auth>\r
<auth ID="elmo2010">ZWxtbzIwMTA6ZWxtbzIwMTA=</auth>\r
</test>\r
\r
<!--Next, set up permissions and roles, and test bigbird2010 and elmo2010. -->\r
- <test ID="permBigbird" auth="test">\r
+ <test ID="permBigbird" auth="admin@collectionspace.org">\r
<method>POST</method>\r
<uri>/cspace-services/authorization/permissions</uri>\r
<filename>security/1-bigbird-permission.xml</filename>\r
-->\r
\r
\r
- <test auth="test">\r
+ <test auth="admin@collectionspace.org">\r
<method>DELETE</method>\r
<uri>/cspace-services/authorization/permissions/${permBigbird.CSID}/permroles</uri>\r
<!-- don't do <fromTestID>, no CSID of permrole on end of url, but deleteURL will put one there for you, so don't use it.\r
</test>\r
\r
\r
- <test ID="accountroles2" auth="test">\r
+ <test ID="accountroles2" auth="admin@collectionspace.org">\r
<method>DELETE</method>\r
<uri>/cspace-services/accounts/${accountBigbird.CSID}/accountroles</uri>\r
</test>\r
</test>\r
\r
<!--Next, set up permissions and roles, and test bigbird2010.-->\r
- <test ID="permBigbird" auth="test">\r
+ <test ID="permBigbird" auth="admin@collectionspace.org">\r
<method>POST</method>\r
<uri>/cspace-services/authorization/permissions</uri>\r
<filename>security/1-bigbird-permission.xml</filename>\r
</test>\r
- <test ID="roleTestCM" auth="test">\r
+ <test ID="roleTestCM" auth="admin@collectionspace.org">\r
<method>POST</method>\r
<uri>/cspace-services/authorization/roles</uri>\r
<filename>security/3-role-test-cm.xml</filename>\r
\r
<!-- NOW **REMOVE** PERMROLES FROM BIGBIRD -->\r
\r
- <test ID="deletePermrolesBigbird" auth="test">\r
+ <test ID="deletePermrolesBigbird" auth="admin@collectionspace.org">\r
<msg>Deleting permroles from bigbird2010</msg>\r
<method>DELETE</method>\r
<uri>/cspace-services/authorization/permissions/${permBigbird.CSID}/permroles</uri>\r
\r
<!-- NOW **ADD** PERMS CRU TO BIGBIRD -->\r
\r
- <test ID="permBigbird_CRU" auth="test">\r
+ <test ID="permBigbird_CRU" auth="admin@collectionspace.org">\r
<method>POST</method>\r
<uri>/cspace-services/authorization/permissions</uri>\r
<filename>security/11-bigbird-permission-CRU.xml</filename>\r
</test>\r
- <test ID="bigbirdPermrolesCRU" auth="test">\r
+ <test ID="bigbirdPermrolesCRU" auth="admin@collectionspace.org">\r
<method>POST</method>\r
<uri>/cspace-services/authorization/permissions/${permBigbird_CRU.CSID}/permroles</uri>\r
<filename>security/11-permissionroles-bigbird-CRU.xml</filename>\r
\r
<!-- NOW **REMOVE** PERMROLES FROM BIGBIRD -->\r
\r
- <test ID="deletePermrolesBigbird" auth="test">\r
+ <test ID="deletePermrolesBigbird" auth="admin@collectionspace.org">\r
<msg>Deleting permroles from bigbird2010</msg>\r
<method>DELETE</method>\r
<uri>/cspace-services/authorization/permissions/${permBigbird_CRU.CSID}/permroles</uri>\r
\r
<!-- NOW **ADD** PERMS R TO BIGBIRD -->\r
\r
- <test ID="permBigbird_R" auth="test">\r
+ <test ID="permBigbird_R" auth="admin@collectionspace.org">\r
<method>POST</method>\r
<uri>/cspace-services/authorization/permissions</uri>\r
<filename>security/12-bigbird-permission-R.xml</filename>\r
</test>\r
- <test ID="bigbirdPermroles_R" auth="test">\r
+ <test ID="bigbirdPermroles_R" auth="admin@collectionspace.org">\r
<method>POST</method>\r
<uri>/cspace-services/authorization/permissions/${permBigbird_R.CSID}/permroles</uri>\r
<filename>security/12-permissionroles-bigbird-R.xml</filename>\r
</test>\r
\r
<!-- CLEANUP -->\r
- <test auth="test">\r
+ <test auth="admin@collectionspace.org">\r
<method>DELETE</method>\r
<uri>/cspace-services/accounts/${accountBigbird.CSID}/accountroles</uri>\r
</test>\r
\r
</xmlReplay>\r
\r
-
\ No newline at end of file
+ \r
<!-- legal values for dumpServiceResult=[minimal,detailed,full] -->\r
<dump payloads="false" dumpServiceResult="minimal" />\r
\r
- <auths default="test">\r
- <auth ID="test">dGVzdDp0ZXN0</auth>\r
+ <auths default="admin@collectionspace.org">\r
+ <auth ID="admin@collectionspace.org">YWRtaW5AY29sbGVjdGlvbnNwYWNlLm9yZzpBZG1pbmlzdHJhdG9y</auth>\r
</auths>\r
\r
\r
<protoHostPort>http://localhost:8180</protoHostPort>\r
\r
<!-- legal values for dumpServiceResult=[minimal,detailed,full] -->\r
- <dump payloads="false" dumpServiceResult="minimal" />\r
+ <dump payloads="false" dumpServiceResult="full" />\r
\r
- <auths default="test">\r
- <auth ID="test">dGVzdDp0ZXN0</auth>\r
+ <auths default="admin@collectionspace.org">\r
+ <auth ID="admin@collectionspace.org">YWRtaW5AY29sbGVjdGlvbnNwYWNlLm9yZzpBZG1pbmlzdHJhdG9y</auth>\r
</auths>\r
\r
<!--\r
<?xml version="1.0" encoding="UTF-8"?>\r
<xmlReplay>\r
<testGroup ID="selftestGroup" autoDeletePOSTS="true">\r
- <test ID="OrgAuth1" auth="test">\r
+ <test ID="OrgAuth1" auth="admin@collectionspace.org">\r
<method>POST</method>\r
<uri>/cspace-services/orgauthorities/</uri>\r
<part>\r
}
}
- @SuppressWarnings("unchecked")
- @Test(dataProvider = "testName", dataProviderClass = AccountTest.class)
- public void createTest(String testName) throws Exception {
- AccountsCommon account = null;
- try {
- account = findAccount("test");
- if (account != null) {
- return;
- }
- } catch (NoResultException nre) {
- //ignore
- }
- if (account == null) {
- account = new AccountsCommon();
- }
- account.setScreenName("test");
- account.setPersonRefName("test hello");
- account.setEmail("test.test@berkeley.edu");
- account.setUserId("test");
- account.setStatus(Status.ACTIVE);
- id = UUID.randomUUID().toString();
- account.setCsid(id);
-
- AccountTenant tenant = new AccountTenant();
- tenant.setTenantId("1");
- List<AccountTenant> tList = new ArrayList<AccountTenant>();
- tList.add(tenant);
- account.setTenants(tList);
- em.getTransaction().begin();
- em.persist(account);
- // Commit the transaction
- em.getTransaction().commit();
- if (logger.isDebugEnabled()) {
- logger.debug("created/updated account "
- + " screen name=" + account.getScreenName()
- + " email=" + account.getEmail());
- }
- }
@SuppressWarnings("unchecked")
@Test(dataProvider = "testName", dataProviderClass = AccountTest.class)
-- Tenants
-- default cspace --
-- ONLY Needed for the hack below.
-INSERT INTO `cspace`.`tenants` (`id`, `name`, `created_at`) VALUES ('1','collectionspace.org', now());
+-- INSERT INTO `cspace`.`tenants` (`id`, `name`, `created_at`) VALUES ('1','collectionspace.org', now());
-- Accounts
--- default test account --
-INSERT INTO `cspace`.`accounts_common` (`csid`, `email`, `phone`, `mobile`, `userid`, `status`, `screen_name`, `created_at`) VALUES ('eeca40d7-dc77-4cc5-b489-16a53c75525a','test.test@berkeley.edu',NULL,NULL,'test','ACTIVE','test', now());
+-- default bootstrap user required to run ImportAuthZ (to bootstrap Spring) --
+-- INSERT INTO `cspace`.`accounts_common` (`csid`, `email`, `phone`, `mobile`, `userid`, `status`, `screen_name`, `created_at`) VALUES ('Bootstrapping-Account-DO-NOT-DELETE','bootstrap@collectionspace.org',NULL,NULL,'SPRING_ADMIN','ACTIVE','SPRING_ADMIN', now());
-- Association of accounts with tenants
-INSERT INTO `cspace`.`accounts_tenants` (`TENANTS_ACCOUNTSCOMMON_CSID`, `tenant_id`) VALUES ('eeca40d7-dc77-4cc5-b489-16a53c75525a', '1');
+-- INSERT INTO `cspace`.`accounts_tenants` (`TENANTS_ACCOUNTSCOMMON_CSID`, `tenant_id`) VALUES ('Bootstrapping-Account-DO-NOT-DELETE', '1');
--\r
use cspace;\r
\r
--- default test user --\r
--- This should go away.\r
-insert into `users` (`username`,`passwd`, `created_at`) VALUES ('test','n4bQgYhMfWWaL+qgxVrQFaO/TxsrC4Is0V1sFbDwCgg=', now());\r
+-- default bootstrap user required to run ImportAuthZ (to bootstrap Spring) --\r
+-- insert into `users` (`username`,`passwd`, `created_at`) VALUES ('SPRING_ADMIN','MzwE3RUaKmgxwDnLmmUd8pGYvooE4WzoYdS2o0oRyVQ=', now());\r
<mainClass>org.collectionspace.ImportAuthz</mainClass>\r
<arguments>\r
<argument>-u</argument>\r
- <argument>test</argument>\r
+ <argument>SPRING_ADMIN</argument>\r
<argument>-p</argument>\r
- <argument>test</argument>\r
+ <argument>does_not_matter</argument>\r
<argument>-b</argument>\r
<argument>${basedir}/../../common/src/main/config/services/tenant-bindings.xml</argument>\r
<argument>-edir</argument>\r
}
private void login() {
- GrantedAuthority cspace_admin = new GrantedAuthorityImpl("ROLE_ADMINISTRATOR");
+ //GrantedAuthority cspace_admin = new GrantedAuthorityImpl("ROLE_ADMINISTRATOR");
GrantedAuthority spring_security_admin = new GrantedAuthorityImpl("ROLE_SPRING_ADMIN");
HashSet<GrantedAuthority> gauths = new HashSet<GrantedAuthority>();
- gauths.add(cspace_admin);
+ //gauths.add(cspace_admin);
gauths.add(spring_security_admin);
Authentication authRequest = new UsernamePasswordAuthenticationToken(user, password, gauths);
SecurityContextHolder.getContext().setAuthentication(authRequest);
--\r
use cspace;\r
\r
-insert into `roles` (`csid`, `rolename`, `displayName`, `rolegroup`, `created_at`, `tenant_id`) values ('-1', 'ROLE_SPRING_ADMIN', 'SPRING_ADMIN', 'Spring Security Administrator', now(), '0');\r
-insert into `roles` (`csid`, `rolename`, `displayName`, `rolegroup`, `created_at`, `tenant_id`) values ('0', 'ROLE_ADMINISTRATOR', 'ADMINISTRATOR', 'CollectionSpace Administrator', now(), '0');\r
+-- insert into `roles` (`csid`, `rolename`, `displayName`, `rolegroup`, `created_at`, `tenant_id`) values ('-1', 'ROLE_SPRING_ADMIN', 'SPRING_ADMIN', 'Spring Security Administrator', now(), '0');\r
+-- insert into `roles` (`csid`, `rolename`, `displayName`, `rolegroup`, `created_at`, `tenant_id`) values ('0', 'ROLE_ADMINISTRATOR', 'ADMINISTRATOR', 'CollectionSpace Administrator', now(), '0');\r
\r
--- for default test account --\r
--- THESE SHOULD GO AWAY.\r
-insert into `accounts_roles`(`account_id`, `user_id`, `role_id`, `role_name`, `created_at`) values ('eeca40d7-dc77-4cc5-b489-16a53c75525a', 'test', '-1', 'ROLE_SPRING_ADMIN', now());\r
-insert into `accounts_roles`(`account_id`, `user_id`, `role_id`, `role_name`, `created_at`) values ('eeca40d7-dc77-4cc5-b489-16a53c75525a', 'test', '0', 'ROLE_ADMINISTRATOR', now());\r
+-- for default bootstrap user required to run ImportAuthZ (to bootstrap Spring) --\r
+-- insert into `accounts_roles`(`account_id`, `user_id`, `role_id`, `role_name`, `created_at`) values ('Bootstrapping-Account-DO-NOT-DELETE', 'test', '-1', 'ROLE_SPRING_ADMIN', now());\r
+-- insert into `accounts_roles`(`account_id`, `user_id`, `role_id`, `role_name`, `created_at`) values ('Bootstrapping-Account-DO-NOT-DELETE', 'test', '0', 'ROLE_ADMINISTRATOR', now());\r
\r
}\r
pstmt.close();\r
// Fifth, fetch and save the default roles\r
+ String springAdminRoleCSID = null;\r
String querySpringRole = \r
"SELECT `csid` from `Roles` WHERE `rolename`='"+SPRING_ADMIN_ROLE+"'";\r
rs = stmt.executeQuery(querySpringRole);\r
- if(!rs.next()) {\r
- throw new RuntimeException("Cannot find SPRING ADMIN role!");\r
+ if(rs.next()) {\r
+ springAdminRoleCSID = rs.getString(1);\r
+ if (logger.isDebugEnabled()) {\r
+ logger.debug("createDefaultAccounts found Spring Admin role: "\r
+ +springAdminRoleCSID);\r
+ }\r
+ } else {\r
+ String insertSpringAdminRoleSQL =\r
+ "INSERT INTO `Roles` (`csid`, `rolename`, `displayName`, `rolegroup`, `created_at`, `tenant_id`) "\r
+ + "VALUES ('-1', 'ROLE_SPRING_ADMIN', 'SPRING_ADMIN', 'Spring Security Administrator', now(), '0')";\r
+ stmt.executeUpdate(insertSpringAdminRoleSQL);\r
+ springAdminRoleCSID = "-1";\r
+ if (logger.isDebugEnabled()) {\r
+ logger.debug("createDefaultAccounts CREATED Spring Admin role: "\r
+ +springAdminRoleCSID);\r
+ }\r
}\r
- String springAdminRoleCSID = rs.getString(1);\r
- if (logger.isDebugEnabled()) {\r
- logger.debug("createDefaultAccounts found Spring Admin role: "\r
- +springAdminRoleCSID);\r
- }\r
rs.close();\r
String getRoleCSIDSql =\r
"SELECT `csid` from `Roles` WHERE `tenant_id`=? and `rolename`=?";\r
setupCreate();
AccountClient accountClient = new AccountClient();
- accountClient.setAuth(true, "test", true, "test", true);
+ // This should not be needed - the auth is already set up
+ //accountClient.setAuth(true, "test", true, "test", true);
// Submit the request to the service and store the response.
AccountsCommon account =
setupCreate();
AccountClient accountClient = new AccountClient();
- accountClient.setAuth(true, "test", true, "test", true);
+ // This should not be needed - the auth is already set up
+ //accountClient.setAuth(true, "test", true, "test", true);
// Submit the request to the service and store the response.
AccountsCommon account =
}
setupCreate();
CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
- collectionObjectClient.setAuth(false, "test", true, "test", true);
+ String user = collectionObjectClient.getProperty(collectionObjectClient.USER_PROPERTY);
+ String pass = collectionObjectClient.getProperty(collectionObjectClient.PASSWORD_PROPERTY);
+ collectionObjectClient.setAuth(false, user, true, pass, true);
String identifier = BaseServiceTest.createIdentifier();
MultipartOutput multipart = createCollectionObjectInstance(
collectionObjectClient.getCommonPartName(), identifier);
logger.debug(testBanner(testName));
}
CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
- collectionObjectClient.setAuth(true, "test", true, "", false);
+ String user = collectionObjectClient.getProperty(collectionObjectClient.USER_PROPERTY);
+ collectionObjectClient.setAuth(true, user, true, "", false);
String identifier = BaseServiceTest.createIdentifier();
MultipartOutput multipart = createCollectionObjectInstance(
collectionObjectClient.getCommonPartName(), identifier);
logger.debug(testBanner(testName));
}
CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
- collectionObjectClient.setAuth(true, "test", true, "bar", true);
+ String user = collectionObjectClient.getProperty(collectionObjectClient.USER_PROPERTY);
+ collectionObjectClient.setAuth(true, user, true, "bar", true);
String identifier = BaseServiceTest.createIdentifier();
MultipartOutput multipart = createCollectionObjectInstance(
collectionObjectClient.getCommonPartName(), identifier);
// Perform setup.
setupDelete();
AccountClient accountClient = new AccountClient();
- accountClient.setAuth(true, "test", true, "test", true);
+ // accountClient.setAuth(true, "test", true, "test", true);
// Submit the request to the service and store the response.
ClientResponse<Response> res = accountClient.delete(barneyAccountId);
int statusCode = res.getStatus();