@PublicApi public interface

JiraAuthenticationContext

com.atlassian.jira.security.JiraAuthenticationContext
Known Indirect Subclasses

@PublicApi

This interface is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Class Overview

The JiraAuthenticationContext is used for tracking a user's session in JIRA and all it's custom parameters, such as Locale and I18n.

Summary

Public Methods
void clearLoggedInUser()
Clears any logged in user from authentication scope.
@Deprecated I18nHelper getI18nBean()
This method is deprecated. Use getI18nHelper() instead. Deprecated since v4.0
I18nHelper getI18nHelper()
Useful for localisation of messages.
Locale getLocale()
Get the users locale.
@Deprecated User getLoggedInUser()
This method is deprecated. use getUser(). Since v6.0
@Deprecated OutlookDate getOutlookDate()
This method is deprecated. Use DateTimeFormatter instead. Since v5.0.
@Deprecated String getText(String key)
This method is deprecated. Use getText() method on getI18nHelper().
@IncompatibleReturnType ApplicationUser getUser()
Returns the currently logged in User.
boolean isLoggedInUser()
Returns a boolean indicating whether there is a currently logged in user.
void setLoggedInUser(ApplicationUser user)
This is used in places like Jelly where we need to switch the identity of a user during execution.
void setLoggedInUser(User user)
This method is deprecated. use setLoggedInUser(com.atlassian.jira.user.ApplicationUser). Since v6.0

Public Methods

public 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

@Deprecated public I18nHelper getI18nBean ()

This method is deprecated.
Use getI18nHelper() instead. Deprecated since v4.0

Useful for localisation of messages.

Returns

public I18nHelper getI18nHelper ()

Useful for localisation of messages.

Returns

public Locale getLocale ()

Get the users locale.

Returns
  • The user's locale, or the default system locale.

@Deprecated public User getLoggedInUser ()

This method is deprecated.
use getUser(). Since v6.0

Returns the currently logged in User.

Returns
  • The logged in User, or null

@Deprecated public OutlookDate getOutlookDate ()

This method is deprecated.
Use DateTimeFormatter instead. Since v5.0.

Method used to get a nice representation of a date using a user's locale.

Returns

@Deprecated public String getText (String key)

This method is deprecated.
Use getText() method on getI18nHelper().

Parameters
key the text key
Returns
  • the translated text

@IncompatibleReturnType public ApplicationUser getUser ()

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 an ApplicationUser instead. That class has different semantics for equals(Object) and therefore does not extend the User 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, or null

public boolean isLoggedInUser ()

Returns a boolean indicating whether there is a currently logged in user.

Returns
  • true if there is a currently logged in user

public void setLoggedInUser (ApplicationUser user)

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

public void setLoggedInUser (User user)

This method is deprecated.
use setLoggedInUser(com.atlassian.jira.user.ApplicationUser). Since v6.0

This id usedin places like Jelly where we need to switch the identity of a user during execution.

Parameters
user the currently logged in user