Interface JiraAuthenticationContext
- All Known Implementing Classes:
BootstrapJiraAuthenticationContext
,JiraAuthenticationContextImpl
,MockAuthenticationContext
,MockSimpleAuthenticationContext
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears any logged in user from authentication scope.Useful for localisation of messages.Get the users locale.Returns the currently logged in User.Deprecated.getUser()
Deprecated.UsegetLoggedInUser()
.boolean
Returns a boolean indicating whether there is a currently logged in user.void
This is used in places like Jelly where we need to switch the identity of a user during execution.
-
Method Details
-
getUser
@Deprecated @IncompatibleReturnType(since="6.0", was="com.atlassian.crowd.embedded.api.User") ApplicationUser getUser()Deprecated.UsegetLoggedInUser()
. Since v7.0Returns the currently logged in User.Warning: previous incarnations of this method returned
com.atlassian.crowd.embedded.api.User
. This method had previously been deprecated and has been reused to return anApplicationUser
instead. That class has different semantics forObject.equals(Object)
and therefore does not extend theUser
class. This means that the 6.0 version is not binary or source compatible with earlier versions when this method is used.- Returns:
- The logged in
ApplicationUser
, ornull
-
getLoggedInUser
@IncompatibleReturnType(since="7.0", was="com.atlassian.crowd.embedded.api.User") ApplicationUser getLoggedInUser()Returns the currently logged in User.Warning: previous incarnations of this method returned
com.atlassian.crowd.embedded.api.User
. This method had previously been deprecated and has been reused to return anApplicationUser
instead. That class has different semantics forObject.equals(Object)
and therefore does not extend theUser
class. This means that the 6.0 version is not binary or source compatible with earlier versions when this method is used.- Returns:
- The logged in
ApplicationUser
, ornull
-
isLoggedInUser
boolean isLoggedInUser()Returns a boolean indicating whether there is a currently logged in user.- Returns:
- true if there is a currently logged in user
- Since:
- v5.0.4
-
getLocale
Locale getLocale()Get the users locale.- Returns:
- The user's locale, or the default system locale.
-
getOutlookDate
Deprecated.UseDateTimeFormatter
instead. Since v5.0.Method used to get a nice representation of a date using a user's locale.- Returns:
- A
OutlookDate
-
getI18nHelper
Useful for localisation of messages.- Returns:
- An instance of
I18nHelper
-
setLoggedInUser
This is used in places like Jelly where we need to switch the identity of a user during execution.- Parameters:
user
- the currently logged in user
-
clearLoggedInUser
void clearLoggedInUser()Clears any logged in user from authentication scope. After this call the anonymous user is considered to be about, ie no-one is about
-
DateTimeFormatter
instead.