Package io.jmix.core.security
Interface CurrentAuthentication
- All Known Implementing Classes:
CurrentAuthenticationImpl
public interface CurrentAuthentication
Provides information about the currently authenticated user.
-
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.core.Authentication
Returns current authentication object.org.springframework.security.core.userdetails.UserDetails
getUser()
Returns the authenticated user.org.springframework.security.core.userdetails.UserDetails
Returns the authenticated user using hints.boolean
isSet()
-
Method Details
-
getAuthentication
org.springframework.security.core.Authentication getAuthentication()Returns current authentication object.- Throws:
IllegalStateException
- if Authentication is not set toSecurityContext
-
getUser
org.springframework.security.core.userdetails.UserDetails getUser()Returns the authenticated user. If you need to get the user substitution information use theCurrentUserSubstitution
.- Returns:
- currently authenticated user
- Throws:
RuntimeException
- if Authentication is not set toSecurityContext
or user information cannot be extracted from current authentication
-
getUser
Returns the authenticated user using hints. If you need to get the user substitution information use theCurrentUserSubstitution
. See supported hints in theCurrentUserHints
.- Parameters:
hints
- hints with user retrieval instructions- Returns:
- currently authenticated user
- Throws:
RuntimeException
- if Authentication is not set toSecurityContext
or user information cannot be extracted from current authentication- See Also:
-
getLocale
Locale getLocale()- Returns:
- locale of the current authentication or default locale if current authentication doesn't contain locale information
- Throws:
RuntimeException
- if Authentication is not set toSecurityContext
-
getTimeZone
TimeZone getTimeZone()- Returns:
- time zone of the current authentication or default time zone if current authentication doesn't contain time zone information
- Throws:
RuntimeException
- if Authentication is not set toSecurityContext
-
isSet
boolean isSet()- Returns:
- true if authentication is set to
SecurityContext
-