com.atlassian.jira.mock.security
Class MockAuthenticationContext

java.lang.Object
  extended by com.atlassian.jira.mock.security.MockAuthenticationContext
All Implemented Interfaces:
JiraAuthenticationContext

public class MockAuthenticationContext
extends Object
implements JiraAuthenticationContext


Constructor Summary
MockAuthenticationContext(com.atlassian.crowd.embedded.api.User user)
           
MockAuthenticationContext(com.atlassian.crowd.embedded.api.User user, I18nHelper i18nHelper)
           
 
Method Summary
 void clearLoggedInUser()
          Clears any logged in user from authentication scope.
 I18nHelper getI18nBean()
          Useful for localisation of messages.
 I18nHelper getI18nHelper()
          Useful for localisation of messages.
 Locale getLocale()
          Get the users locale.
 com.atlassian.crowd.embedded.api.User getLoggedInUser()
          Returns the currently logged in User.
 OutlookDate getOutlookDate()
          Method used to get a nice representation of a date using a user's locale.
 String getText(String key)
           
 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(com.atlassian.crowd.embedded.api.User user)
          This id usedin places like Jelly where we need to switch the identity of a user during execution.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockAuthenticationContext

public MockAuthenticationContext(com.atlassian.crowd.embedded.api.User user)

MockAuthenticationContext

public MockAuthenticationContext(com.atlassian.crowd.embedded.api.User user,
                                 I18nHelper i18nHelper)
Method Detail

getUser

public ApplicationUser 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 an ApplicationUser instead. That class has different semantics for Object.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.

Specified by:
getUser in interface JiraAuthenticationContext
Returns:
The logged in ApplicationUser, or null

getLoggedInUser

public com.atlassian.crowd.embedded.api.User getLoggedInUser()
Description copied from interface: JiraAuthenticationContext
Returns the currently logged in User.

Specified by:
getLoggedInUser in interface JiraAuthenticationContext
Returns:
The logged in User, or null

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 interface JiraAuthenticationContext
Returns:
true if there is a currently logged in user

getLocale

public Locale getLocale()
Description copied from interface: JiraAuthenticationContext
Get the users locale.

Specified by:
getLocale in interface JiraAuthenticationContext
Returns:
The user's locale, or the default system locale.

getOutlookDate

public OutlookDate 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 interface JiraAuthenticationContext
Returns:
A OutlookDate

getText

public String getText(String key)
Specified by:
getText in interface JiraAuthenticationContext
Parameters:
key - the text key
Returns:
the translated text

getI18nHelper

public I18nHelper getI18nHelper()
Description copied from interface: JiraAuthenticationContext
Useful for localisation of messages.

Specified by:
getI18nHelper in interface JiraAuthenticationContext
Returns:
An instance of I18nHelper

getI18nBean

public I18nHelper getI18nBean()
Description copied from interface: JiraAuthenticationContext
Useful for localisation of messages.

Specified by:
getI18nBean in interface JiraAuthenticationContext
Returns:
An instance of I18nHelper

setLoggedInUser

public void setLoggedInUser(com.atlassian.crowd.embedded.api.User user)
Description copied from interface: JiraAuthenticationContext
This id usedin places like Jelly where we need to switch the identity of a user during execution.

Specified by:
setLoggedInUser in interface JiraAuthenticationContext
Parameters:
user - the currently logged in user

setLoggedInUser

public void setLoggedInUser(ApplicationUser user)
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 interface JiraAuthenticationContext
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 interface JiraAuthenticationContext


Copyright © 2002-2014 Atlassian. All Rights Reserved.