Package org.opencastproject.security.api
Interface SecurityService
- All Known Implementing Classes:
SecurityServiceSpringImpl
public interface SecurityService
Provides access to the current user's username and roles, if any.
-
Method Summary
Modifier and TypeMethodDescriptionGets the organization associated with the current thread context.getUser()Gets the current user, or the local organization's anonymous user if the user has not been authenticated.Gets the current user's IP or null if unable to determine the User's IP.voidsetOrganization(Organization organization) Sets the organization for the calling thread.voidSets the current thread's user context to another user.voidSets the current thread's user's IP address.
-
Method Details
-
getUser
Gets the current user, or the local organization's anonymous user if the user has not been authenticated.- Returns:
- the user
- Throws:
IllegalStateException- if no organization is set in the security context
-
getOrganization
Organization getOrganization()Gets the organization associated with the current thread context.- Returns:
- the organization
-
getUserIP
String getUserIP()Gets the current user's IP or null if unable to determine the User's IP.- Returns:
- The current user's IP.
-
setOrganization
Sets the organization for the calling thread.- Parameters:
organization- the organization
-
setUser
Sets the current thread's user context to another user. This is useful when spawning new threads that must contain the parent thread's user context.- Parameters:
user- the user to set for the current user context
-
setUserIP
Sets the current thread's user's IP address.- Parameters:
userIP- The IP address of the user.
-