additional tests and content

This commit is contained in:
nnhai1991@gmail.com 2018-08-19 17:34:29 +08:00
parent 3f8eddad33
commit 1842c33b3a
2 changed files with 5 additions and 6 deletions

View File

@ -11,7 +11,7 @@
</head> </head>
<body> <body>
<sec:authorize access="isAnonymous()"> <sec:authorize access="isAnonymous()">
ANONYMOUS ANONYMOUS Content
</sec:authorize> </sec:authorize>
<sec:authorize access="isAuthenticated()"> <sec:authorize access="isAuthenticated()">
AUTHENTICATED Content AUTHENTICATED Content
@ -19,8 +19,7 @@
Content for users who have the "ADMIN" role. Content for users who have the "ADMIN" role.
</sec:authorize> </sec:authorize>
<h2> <h2>
principal.username: Welcome back, <sec:authentication property="name" />
<sec:authentication property="principal.username" />
</h2> </h2>
<form> <form>
<sec:csrfInput /> <sec:csrfInput />

View File

@ -28,7 +28,7 @@ public class HomeControllerTest {
assertFalse(body.contains("ANONYMOUS")); assertFalse(body.contains("ANONYMOUS"));
// test <sec:authorize access="isAuthenticated()"> // test <sec:authorize access="isAuthenticated()">
assertTrue(body.contains("AUTHENTICATED")); assertTrue(body.contains("AUTHENTICATED Content"));
// test <sec:authorize access="hasRole('ADMIN')"> // test <sec:authorize access="hasRole('ADMIN')">
assertTrue(body.contains("Content for users who have the \"ADMIN\" role.")); assertTrue(body.contains("Content for users who have the \"ADMIN\" role."));
@ -52,9 +52,9 @@ public class HomeControllerTest {
.getBody(); .getBody();
// test <sec:authorize access="isAnonymous()"> // test <sec:authorize access="isAnonymous()">
assertTrue(body.contains("ANONYMOUS")); assertTrue(body.contains("ANONYMOUS Content"));
// test <sec:authorize access="isAuthenticated()"> // test <sec:authorize access="isAuthenticated()">
assertFalse(body.contains("AUTHENTICATED")); assertFalse(body.contains("AUTHENTICATED Content"));
} }
} }