diff --git a/samples/tutorial/src/main/java/bigbank/BankService.java b/samples/tutorial/src/main/java/bigbank/BankService.java index e9bbce0fc2..8fa0d6ac92 100644 --- a/samples/tutorial/src/main/java/bigbank/BankService.java +++ b/samples/tutorial/src/main/java/bigbank/BankService.java @@ -10,7 +10,7 @@ public interface BankService { public Account[] findAccounts(); @PreAuthorize( - "hasRole('ROLE_SUPERVISOR') or " + - "hasRole('ROLE_TELLER') and (#account.balance + #amount >= -#account.overdraft)" ) + "hasRole('supervisor') or " + + "hasRole('teller') and (#account.balance + #amount >= -#account.overdraft)" ) public Account post(Account account, double amount); } diff --git a/samples/tutorial/src/main/java/bigbank/BankServiceImpl.java b/samples/tutorial/src/main/java/bigbank/BankServiceImpl.java index d5b77a3c46..a6309564c8 100644 --- a/samples/tutorial/src/main/java/bigbank/BankServiceImpl.java +++ b/samples/tutorial/src/main/java/bigbank/BankServiceImpl.java @@ -17,9 +17,9 @@ public class BankServiceImpl implements BankService { public Account post(Account account, double amount) { Assert.notNull(account); - // We read account bank from DAO so it reflects the latest balance + // We read account back from DAO so it reflects the latest balance Account a = bankDao.readAccount(account.getId()); - if (account == null) { + if (a == null) { throw new IllegalArgumentException("Couldn't find requested account"); } diff --git a/samples/tutorial/src/main/webapp/WEB-INF/applicationContext-security.xml b/samples/tutorial/src/main/webapp/WEB-INF/applicationContext-security.xml index 3c307b2071..1ba55d9ecd 100644 --- a/samples/tutorial/src/main/webapp/WEB-INF/applicationContext-security.xml +++ b/samples/tutorial/src/main/webapp/WEB-INF/applicationContext-security.xml @@ -18,7 +18,7 @@ - + + + - + - - - - + + + + diff --git a/samples/tutorial/src/main/webapp/WEB-INF/web.xml b/samples/tutorial/src/main/webapp/WEB-INF/web.xml index 325805a212..37b9078afa 100644 --- a/samples/tutorial/src/main/webapp/WEB-INF/web.xml +++ b/samples/tutorial/src/main/webapp/WEB-INF/web.xml @@ -39,8 +39,6 @@ org.springframework.web.context.ContextLoaderListener @@ -55,7 +53,7 @@ bank diff --git a/samples/tutorial/src/main/webapp/secure/index.jsp b/samples/tutorial/src/main/webapp/secure/index.jsp index e6063c64da..165f8e90dc 100644 --- a/samples/tutorial/src/main/webapp/secure/index.jsp +++ b/samples/tutorial/src/main/webapp/secure/index.jsp @@ -28,6 +28,7 @@ or if you've authenticated this session. <sec:authentication property='name' /> + <sec:authentication property='principal.username' /> @@ -37,6 +38,7 @@ or if you've authenticated this session. <sec:authentication property='principal.accountNonLocked' /> +