View Javadoc

1   package org.appfuse.webapp.services;
2   
3   import org.appfuse.model.User;
4   import org.springframework.security.core.userdetails.UserDetails;
5   
6   
7   public interface SecurityContext {
8       /**
9        * Return true if user is authenticated, false otherwise
10       */
11      boolean isLoggedIn();
12      UserDetails getUserDetails();
13  
14      /**
15       * Logged in user
16       * @return
17       */
18      User getUser();
19  
20      String getUsername();
21  
22      /**
23       * Check if user has a role
24       * @param roleName
25       * @return
26       */
27      boolean hasRoles(String roleName);
28  
29      /**
30       * Verify if user has admin role
31       * @return
32       */
33      boolean isAdmin();
34  
35      /**
36       * Authenticates user
37       * @param user
38       */
39      void login(User user);
40  
41      /**
42       * logs user out
43       */
44      void logout();
45  
46      /**
47       *
48       * @return
49       */
50      boolean isRememberMe();
51  }