package at.fhj.swd13.pse.controller;

import javax.faces.bean.ManagedBean;
import javax.inject.Inject;

import at.fhj.swd13.pse.db.entity.Person;
import at.fhj.swd13.pse.domain.user.UserService;
import at.fhj.swd13.pse.plumbing.UserSession;

@ManagedBean
public class TestLoggedInController {

	@Inject
	private UserSession userSession;

	@Inject
	private UserService userService;

	public String getUsername() {

		return userSession.getUsername();
	}

	public Person getUser() {
		return userService.getUser(userSession.getUsername());
	}
}

@@ -29,24 +29,64 @@
 troller;%0D%0A%0D%0A
+import javax.annotation.PostConstruct;%0D%0A
 import javax
@@ -139,16 +139,60 @@
 Inject;%0D
+%0Aimport javax.ws.rs.NotAuthorizedException;%0D
 %0A%0D%0Aimpor
@@ -473,24 +473,231 @@
 Service;%0D%0A%0D%0A
+%09@PostConstruct%0D%0A%09protected void validateLogin() %7B%0D%0A%09%09if ( ! userSession.isLoggedIn() ) %7B%0D%0A%09%09%09throw new NotAuthorizedException(%22User has not logged in and is not authorized to view this page%22);%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%09%0D%0A
 %09public Stri

throw exception when not logged in