Package org.powertac.visualizer.security
Class SecurityUtils
java.lang.Object
org.powertac.visualizer.security.SecurityUtils
public final class SecurityUtils extends Object
Utility class for Spring Security.
-
Method Summary
Modifier and Type Method Description static StringgetCurrentUserLogin()Get the login of the current user.static booleanisAuthenticated()Check if a user is authenticated.static booleanisCurrentUserInRole(String authority)If the current user has a specific authority (security role).
-
Method Details
-
getCurrentUserLogin
Get the login of the current user.- Returns:
- the login of the current user
-
isAuthenticated
public static boolean isAuthenticated()Check if a user is authenticated.- Returns:
- true if the user is authenticated, false otherwise
-
isCurrentUserInRole
If the current user has a specific authority (security role).The name of this method comes from the isUserInRole() method in the Servlet API
- Parameters:
authority- the authority to check- Returns:
- true if the current user has the authority, false otherwise
-