com.atlassian.jira.mock.security
Class MockSimpleAuthenticationContext

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

public class MockSimpleAuthenticationContext
extends Object
implements JiraAuthenticationContext

Simple authentication context that can be used for testing.

Since:
v3.13

Constructor Summary
MockSimpleAuthenticationContext(com.atlassian.crowd.embedded.api.User user)
           
MockSimpleAuthenticationContext(com.atlassian.crowd.embedded.api.User user, Locale locale)
           
MockSimpleAuthenticationContext(com.atlassian.crowd.embedded.api.User user, Locale locale, I18nHelper helper)
           
 
Method Summary
 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)
           
 com.atlassian.crowd.embedded.api.User getUser()
          Returns the currently logged in User.
 boolean isLoggedInUser()
          Returns a boolean indicating whether there is a currently logged in user.
 void setLoggedInUser(com.atlassian.crowd.embedded.api.User user)
          This comes to use in 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

MockSimpleAuthenticationContext

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

MockSimpleAuthenticationContext

public MockSimpleAuthenticationContext(com.atlassian.crowd.embedded.api.User user,
                                       Locale locale)

MockSimpleAuthenticationContext

public MockSimpleAuthenticationContext(com.atlassian.crowd.embedded.api.User user,
                                       Locale locale,
                                       I18nHelper helper)
Method Detail

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

getUser

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

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

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 comes to use 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


Copyright © 2002-2013 Atlassian. All Rights Reserved.