Class MockSimpleAuthenticationContext
- All Implemented Interfaces:
JiraAuthenticationContext
- Since:
- v3.13
-
Constructor Summary
ConstructorDescriptionMockSimpleAuthenticationContext
(ApplicationUser user, Locale locale) MockSimpleAuthenticationContext
(ApplicationUser user, Locale locale, I18nHelper helper) -
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.Method used to get a nice representation of a date using a user's locale.getUser()
Returns the currently logged in User.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.
-
Constructor Details
-
MockSimpleAuthenticationContext
-
MockSimpleAuthenticationContext
-
MockSimpleAuthenticationContext
public MockSimpleAuthenticationContext(ApplicationUser user, Locale locale, @Nonnull I18nHelper helper)
-
-
Method Details
-
getLoggedInUser
Description copied from interface:JiraAuthenticationContext
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.- Specified by:
getLoggedInUser
in interfaceJiraAuthenticationContext
- Returns:
- The logged in
ApplicationUser
, ornull
-
getUser
Description copied from interface:JiraAuthenticationContext
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.- Specified by:
getUser
in interfaceJiraAuthenticationContext
- Returns:
- The logged in
ApplicationUser
, ornull
-
isLoggedInUser
public boolean isLoggedInUser()Description copied from interface:JiraAuthenticationContext
Returns a boolean indicating whether there is a currently logged in user.- Specified by:
isLoggedInUser
in interfaceJiraAuthenticationContext
- Returns:
- true if there is a currently logged in user
-
getLocale
Description copied from interface:JiraAuthenticationContext
Get the users locale.- Specified by:
getLocale
in interfaceJiraAuthenticationContext
- Returns:
- The user's locale, or the default system locale.
-
getOutlookDate
Description copied from interface:JiraAuthenticationContext
Method used to get a nice representation of a date using a user's locale.- Specified by:
getOutlookDate
in interfaceJiraAuthenticationContext
- Returns:
- A
OutlookDate
-
getI18nHelper
Description copied from interface:JiraAuthenticationContext
Useful for localisation of messages.- Specified by:
getI18nHelper
in interfaceJiraAuthenticationContext
- Returns:
- An instance of
I18nHelper
-
setLoggedInUser
Description copied from interface:JiraAuthenticationContext
This is used in places like Jelly where we need to switch the identity of a user during execution.- Specified by:
setLoggedInUser
in interfaceJiraAuthenticationContext
- Parameters:
user
- the currently logged in user
-
clearLoggedInUser
public void clearLoggedInUser()Description copied from interface:JiraAuthenticationContext
Clears any logged in user from authentication scope. After this call the anonymous user is considered to be about, ie no-one is about- Specified by:
clearLoggedInUser
in interfaceJiraAuthenticationContext
-
setLocale
-
createNoopContext
-