Commit 48a7a2c0175de9224d2434abd0b384fd143e5951

Authored by Thomas Ziemer
1 parent 7a79c761

test: Logout

src/main/java/net/ziemers/swxercise/lg/user/service/SessionContext.java
... ... @@ -16,8 +16,23 @@ public class SessionContext implements java.io.Serializable {
16 16 return user;
17 17 }
18 18  
19   - public void setUser(User user) {
  19 + private void setUser(User user) {
20 20 this.user = user;
21 21 }
22 22  
  23 + public boolean login(final User user) {
  24 + if (getUser() == null) {
  25 + setUser(user);
  26 + return true;
  27 + }
  28 + return false;
  29 + }
  30 +
  31 + public boolean logout() {
  32 + if (getUser() != null) {
  33 + setUser(null);
  34 + return true;
  35 + }
  36 + return false;
  37 + }
23 38 }
... ...