Make samples and tests use username "rod".
This commit is contained in:
@@ -3,8 +3,8 @@ This directory contains some example certificates for the X.509 version of the c
|
||||
application. They have all been generated using openssl with a demo certificate authority.
|
||||
The password for all the files is "password"
|
||||
|
||||
- marissa.p12 is a pkcs12 file containing the client certificate and private key for
|
||||
the user marissa, and should be imported into your browser.
|
||||
- user.p12 is a pkcs12 file containing the client certificate and private key for
|
||||
a user, and should be imported into your browser.
|
||||
|
||||
- server.p12 is a pkcs12 file containing a server certificate and private key.
|
||||
|
||||
@@ -30,7 +30,7 @@ To try out the application, first get the server running with client authenticat
|
||||
|
||||
|
||||
|
||||
[1] This was origially also a pkcs12 file. However I couldn't get tomcat to work with
|
||||
[1] This was originally also a pkcs12 file. However I couldn't get tomcat to work with
|
||||
it unless it contained the CA's private key as well as the certificate, which is obviously
|
||||
not feasible. If anyone works out how to get Tomcat to work with a pkcs12 file containing
|
||||
a single certificate, then please let me know.
|
||||
|
||||
@@ -129,9 +129,9 @@ public class ClientApplication {
|
||||
if ("".equals(username) || "".equals(password)) {
|
||||
System.out.println(
|
||||
"You need to specify the user ID to use, the password to use, and optionally a number of calls "
|
||||
+ "using the username, password, and nrOfCalls system properties respectively. eg for user marissa, "
|
||||
+ "use: -Dusername=marissa -Dpassword=koala' for a single call per service and "
|
||||
+ "use: -Dusername=marissa -Dpassword=koala -DnrOfCalls=10 for ten calls per service.");
|
||||
+ "using the username, password, and nrOfCalls system properties respectively. eg for user rod, "
|
||||
+ "use: -Dusername=rod -Dpassword=koala' for a single call per service and "
|
||||
+ "use: -Dusername=rod -Dpassword=koala -DnrOfCalls=10 for ten calls per service.");
|
||||
System.exit(-1);
|
||||
} else {
|
||||
int nrOfCalls = 1;
|
||||
|
||||
@@ -80,7 +80,7 @@ public class DataSourcePopulator implements InitializingBean {
|
||||
Assert.notNull(tt, "platformTransactionManager required");
|
||||
|
||||
// Set a user account that will initially own all the created data
|
||||
Authentication authRequest = new UsernamePasswordAuthenticationToken("marissa", "koala",
|
||||
Authentication authRequest = new UsernamePasswordAuthenticationToken("rod", "koala",
|
||||
new GrantedAuthority[] {new GrantedAuthorityImpl("ROLE_IGNORED")});
|
||||
SecurityContextHolder.getContext().setAuthentication(authRequest);
|
||||
|
||||
@@ -104,7 +104,7 @@ public class DataSourcePopulator implements InitializingBean {
|
||||
|
||||
/*
|
||||
Passwords encoded using MD5, NOT in Base64 format, with null as salt
|
||||
Encoded password for marissa is "koala"
|
||||
Encoded password for rod is "koala"
|
||||
Encoded password for dianne is "emu"
|
||||
Encoded password for scott is "wombat"
|
||||
Encoded password for peter is "opal" (but user is disabled)
|
||||
@@ -113,15 +113,15 @@ public class DataSourcePopulator implements InitializingBean {
|
||||
Encoded password for jane is "wombat"
|
||||
|
||||
*/
|
||||
template.execute("INSERT INTO USERS VALUES('marissa','a564de63c2d0da68cf47586ee05984d7',TRUE);");
|
||||
template.execute("INSERT INTO USERS VALUES('rod','a564de63c2d0da68cf47586ee05984d7',TRUE);");
|
||||
template.execute("INSERT INTO USERS VALUES('dianne','65d15fe9156f9c4bbffd98085992a44e',TRUE);");
|
||||
template.execute("INSERT INTO USERS VALUES('scott','2b58af6dddbd072ed27ffc86725d7d3a',TRUE);");
|
||||
template.execute("INSERT INTO USERS VALUES('peter','22b5c9accc6e1ba628cedc63a72d57f8',FALSE);");
|
||||
template.execute("INSERT INTO USERS VALUES('bill','2b58af6dddbd072ed27ffc86725d7d3a',TRUE);");
|
||||
template.execute("INSERT INTO USERS VALUES('bob','2b58af6dddbd072ed27ffc86725d7d3a',TRUE);");
|
||||
template.execute("INSERT INTO USERS VALUES('jane','2b58af6dddbd072ed27ffc86725d7d3a',TRUE);");
|
||||
template.execute("INSERT INTO AUTHORITIES VALUES('marissa','ROLE_USER');");
|
||||
template.execute("INSERT INTO AUTHORITIES VALUES('marissa','ROLE_SUPERVISOR');");
|
||||
template.execute("INSERT INTO AUTHORITIES VALUES('rod','ROLE_USER');");
|
||||
template.execute("INSERT INTO AUTHORITIES VALUES('rod','ROLE_SUPERVISOR');");
|
||||
template.execute("INSERT INTO AUTHORITIES VALUES('dianne','ROLE_USER');");
|
||||
template.execute("INSERT INTO AUTHORITIES VALUES('scott','ROLE_USER');");
|
||||
template.execute("INSERT INTO AUTHORITIES VALUES('peter','ROLE_USER');");
|
||||
@@ -158,12 +158,12 @@ public class DataSourcePopulator implements InitializingBean {
|
||||
}
|
||||
|
||||
// Now grant some permissions
|
||||
grantPermissions(1, "marissa", BasePermission.ADMINISTRATION);
|
||||
grantPermissions(2, "marissa", BasePermission.READ);
|
||||
grantPermissions(3, "marissa", BasePermission.READ);
|
||||
grantPermissions(3, "marissa", BasePermission.WRITE);
|
||||
grantPermissions(3, "marissa", BasePermission.DELETE);
|
||||
grantPermissions(4, "marissa", BasePermission.ADMINISTRATION);
|
||||
grantPermissions(1, "rod", BasePermission.ADMINISTRATION);
|
||||
grantPermissions(2, "rod", BasePermission.READ);
|
||||
grantPermissions(3, "rod", BasePermission.READ);
|
||||
grantPermissions(3, "rod", BasePermission.WRITE);
|
||||
grantPermissions(3, "rod", BasePermission.DELETE);
|
||||
grantPermissions(4, "rod", BasePermission.ADMINISTRATION);
|
||||
grantPermissions(4, "dianne", BasePermission.ADMINISTRATION);
|
||||
grantPermissions(4, "scott", BasePermission.READ);
|
||||
grantPermissions(5, "dianne", BasePermission.ADMINISTRATION);
|
||||
@@ -182,7 +182,7 @@ public class DataSourcePopulator implements InitializingBean {
|
||||
grantPermissions(9, "scott", BasePermission.DELETE);
|
||||
|
||||
// Now expressly change the owner of the first ten contacts
|
||||
// We have to do this last, because "marissa" owns all of them (doing it sooner would prevent ACL updates)
|
||||
// We have to do this last, because "rod" owns all of them (doing it sooner would prevent ACL updates)
|
||||
// Note that ownership has no impact on permissions - they're separate (ownership only allows ACl editing)
|
||||
changeOwner(5, "dianne");
|
||||
changeOwner(6, "dianne");
|
||||
|
||||
@@ -201,7 +201,7 @@
|
||||
|
||||
<!-- Filter used to switch the user context. Note: the switch and exit url must be secured
|
||||
based on the role granted the ability to 'switch' to another user -->
|
||||
<!-- In this example 'marissa' has ROLE_SUPERVISOR that can switch to regular ROLE_USER(s) -->
|
||||
<!-- In this example 'rod' has ROLE_SUPERVISOR that can switch to regular ROLE_USER(s) -->
|
||||
<bean id="switchUserProcessingFilter" class="org.springframework.security.ui.switchuser.SwitchUserProcessingFilter">
|
||||
<property name="userDetailsService" ref="jdbcDaoImpl" />
|
||||
<property name="switchUserUrl"><value>/j_spring_security_switch_user</value></property>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<P>Valid users:
|
||||
<P>
|
||||
<P>username <b>marissa</b>, password <b>koala</b>
|
||||
<P>username <b>rod</b>, password <b>koala</b>
|
||||
<P>username <b>dianne</b>, password <b>emu</b>
|
||||
<p>username <b>scott</b>, password <b>wombat</b>
|
||||
<p>username <b>peter</b>, password <b>opal</b> (user disabled)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
<P>Valid users:
|
||||
<P>
|
||||
<P>username <b>marissa</b>, password <b>koala</b>
|
||||
<P>username <b>rod</b>, password <b>koala</b>
|
||||
<P>username <b>dianne</b>, password <b>emu</b>
|
||||
<p>username <b>scott</b>, password <b>wombat</b>
|
||||
<p>username <b>bill</b>, password <b>wombat</b>
|
||||
|
||||
@@ -110,7 +110,7 @@ public class GetAllContactsTests extends AbstractTransactionalSpringContextTests
|
||||
protected void makeActiveUser(String username) {
|
||||
String password = "";
|
||||
|
||||
if ("marissa".equals(username)) {
|
||||
if ("rod".equals(username)) {
|
||||
password = "koala";
|
||||
} else if ("dianne".equals(username)) {
|
||||
password = "emu";
|
||||
@@ -148,8 +148,8 @@ public class GetAllContactsTests extends AbstractTransactionalSpringContextTests
|
||||
assertNotContainsContact(Long.toString(3), contacts);
|
||||
}
|
||||
|
||||
public void testMarissa() {
|
||||
makeActiveUser("marissa"); // has ROLE_SUPERVISOR
|
||||
public void testrod() {
|
||||
makeActiveUser("rod"); // has ROLE_SUPERVISOR
|
||||
|
||||
List contacts = contactManager.getAll();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
marissa=koala,ROLE_SUPERVISOR
|
||||
rod=koala,ROLE_SUPERVISOR
|
||||
dianne=emu,ROLE_USER
|
||||
scott=wombat,ROLE_USER
|
||||
peter=opal,disabled,ROLE_USER
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<P>Valid users:
|
||||
<P>
|
||||
<P>username <b>marissa</b>, password <b>koala</b> (supervisor)
|
||||
<P>username <b>rod</b>, password <b>koala</b> (supervisor)
|
||||
<P>username <b>dianne</b>, password <b>emu</b> (normal user)
|
||||
<p>username <b>scott</b>, password <b>wombat</b> (normal user)
|
||||
<p>username <b>peter</b>, password <b>opal</b> (user disabled)
|
||||
|
||||
Reference in New Issue
Block a user