Class MockSimpleAuthenticationContext
- All Implemented Interfaces:
JiraAuthenticationContext
- Since:
- v3.13
-
Constructor Summary
ConstructorsConstructorDescriptionMockSimpleAuthenticationContext(ApplicationUser user, Locale locale) MockSimpleAuthenticationContext(ApplicationUser user, Locale locale, I18nHelper helper) -
Method Summary
Modifier and TypeMethodDescriptionvoidClears 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.booleanReturns a boolean indicating whether there is a currently logged in user.voidThis 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:JiraAuthenticationContextReturns 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 anApplicationUserinstead. That class has different semantics forObject.equals(Object)and therefore does not extend theUserclass. This means that the 6.0 version is not binary or source compatible with earlier versions when this method is used.- Specified by:
getLoggedInUserin interfaceJiraAuthenticationContext- Returns:
- The logged in
ApplicationUser, ornull
-
getUser
Description copied from interface:JiraAuthenticationContextReturns 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 anApplicationUserinstead. That class has different semantics forObject.equals(Object)and therefore does not extend theUserclass. This means that the 6.0 version is not binary or source compatible with earlier versions when this method is used.- Specified by:
getUserin interfaceJiraAuthenticationContext- Returns:
- The logged in
ApplicationUser, ornull
-
isLoggedInUser
public boolean isLoggedInUser()Description copied from interface:JiraAuthenticationContextReturns a boolean indicating whether there is a currently logged in user.- Specified by:
isLoggedInUserin interfaceJiraAuthenticationContext- Returns:
- true if there is a currently logged in user
-
getLocale
Description copied from interface:JiraAuthenticationContextGet the users locale.- Specified by:
getLocalein interfaceJiraAuthenticationContext- Returns:
- The user's locale, or the default system locale.
-
getOutlookDate
Description copied from interface:JiraAuthenticationContextMethod used to get a nice representation of a date using a user's locale.- Specified by:
getOutlookDatein interfaceJiraAuthenticationContext- Returns:
- A
OutlookDate
-
getI18nHelper
Description copied from interface:JiraAuthenticationContextUseful for localisation of messages.- Specified by:
getI18nHelperin interfaceJiraAuthenticationContext- Returns:
- An instance of
I18nHelper
-
setLoggedInUser
Description copied from interface:JiraAuthenticationContextThis is used in places like Jelly where we need to switch the identity of a user during execution.- Specified by:
setLoggedInUserin interfaceJiraAuthenticationContext- Parameters:
user- the currently logged in user
-
clearLoggedInUser
public void clearLoggedInUser()Description copied from interface:JiraAuthenticationContextClears 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:
clearLoggedInUserin interfaceJiraAuthenticationContext
-
setLocale
-
createNoopContext
-