public class TokenResourceTest extends RestCrowdServiceAcceptanceTestCase
ADMIN_PASSWORD, ADMIN_USERNAME, APPLICATION_NAME, APPLICATION_PASSWORD, ATTRIBUTES_RESOURCE, AUTHENTICATION_RESOURCE, EEEEP_PASSWORD, EEEEP_USERNAME, EVENTS_RESOURCE, GROUP_BADGERS, GROUP_BADGERS_DESCRIPTION, GROUP_CROWD_ADMINS, GROUP_CROWD_TESTERS, GROUP_CROWD_USERS, GROUPS_RESOURCE, MT, NON_ADMIN_USER_NAME, NON_ADMIN_USER_PASSWORD, NON_CROWD_USER_PASSWORD, NON_CROWD_USER_USERNAME, NON_EXISTENT_GROUP, NON_EXISTENT_USER, PENNY_USERNAME, REST_SERVICE_NAME, restServer, SECOND_ADMIN_PASSWORD, SECOND_ADMIN_USERNAME, SESSION_RESOURCE, USERNAME_PARAM, USERS_RESOURCE, WEBHOOKS_RESOURCE
Constructor and Description |
---|
TokenResourceTest(String name)
Constructs a test case with the given name.
|
TokenResourceTest(String name,
RestServer restServer)
Constructs a test case with the given name, using the given RestServer.
|
Modifier and Type | Method and Description |
---|---|
protected void |
setAliasForUsername(String alias) |
void |
setUp() |
void |
testAliasChangesAreReflectedInSessionUsername() |
void |
testAliasedApplicationAlsoAcceptsUnaliasedUsername()
Log in to an aliased application using the original username.
|
void |
testAllSessionsForUserAreInvalidatedByDeleteWithUsernameSpecified() |
void |
testCreatedTokenUsesDirectoryCaseForUsername() |
void |
testGetUserFromToken()
Tests that getUserFromToken returns the correct user.
|
void |
testGetUserFromTokenEnforcesApplicationAuthenticationChecks()
Tests that a token from a login against one application cannot be used with another application
where that user has no permission.
|
void |
testInvalidateAllTokens()
Tests that all tokens get invalidated when called
|
void |
testInvalidateToken()
Tests that the token really is invalidated.
|
void |
testMultipleShortLivedSessionsShouldNotDeadlock()
See CWD-3768.
|
void |
testMultipleTokensWithDifferentPrivilegesDoNotInterfereWithEachOther()
Tests the scenario in which different tokens are issued for the same
user with different privileges.
|
void |
testSessionCannotBeCreatedWithAliasThroughUnaliasedApplication() |
void |
testSessionCreatedThroughAliasedApplicationShowsOriginalNameWhenRetrievedWithNonAliasingApplication() |
void |
testSessionCreatedThroughAliasWithDifferentCaseReturnsCorrectCase() |
void |
testSessionCreatedWithDifferentCaseReturnsCorrectCaseForUsername() |
void |
testSessionCreatedWithUnaliasedApplicationShowsAliasedNameWhenRetrievedWithAliasingApplication() |
void |
testSessionCreatedWithUnaliasedApplicationShowsAliasedNameWhenValidatedWithAliasingApplication()
The other alias tests GET the session.
|
void |
testSessionForAliasedApplicationIncludesUnaliasedUsernameAsAnExtraField() |
void |
testShortLivedTokenExpiresImmediately() |
void |
testSpecifiedUserSessionIsExcludedFromDeletionByUsername() |
void |
testStatusNotFoundWhenDeletingTokensForNonexistentUser() |
void |
testTokenIsDeletedWhenUserChangesPassword()
Tests that the token is invalidated when the user changes their own password
|
void |
testTokenIsDeletedWhenUserIsMadeInactive()
Test that the token is invalidated if the user is deactivated
|
void |
testTokenIsDeletedWhenUserIsRemoved()
Tests that the token is invalidated if the user is deleted
|
void |
testUserAuthentication_BadPassword()
Tests that if a bad user credential is given, an error response is returned.
|
void |
testUserAuthentication_InactiveUser()
Tests that an inactive user cannot create a session.
|
void |
testUserAuthentication_WithoutPasswordValidation()
Tests that a user can successfully authenticate with an application without password validation when the query
parameter "validate-password" is false.
|
void |
testUserAuthentication()
Tests that a user can successfully authenticate with an application.
|
void |
testValidateToken_InvalidToken()
Tests that when the token is invalid, a 404 (Not Found) status is returned.
|
void |
testValidateToken_InvalidValidationFactors()
Tests that when the validation factors are not correct, a 400 (Bad request) response is returned.
|
void |
testValidateToken()
Tests that when the validation factors are correct, and the token is correct, no errors are thrown.
|
authenticateUser, authenticateUser, deactivateUser, getBaseUriBuilder, getBaseUriBuilder, getBaseUriBuilder, getRootWebResource, getServerUriBuilder, getWebResource, getWebResource, requestEvents, requestEventToken, setRestServer, tearDown
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString
public TokenResourceTest(String name)
name
- the test namepublic TokenResourceTest(String name, RestServer restServer)
name
- the test namerestServer
- the RestServerpublic void setUp() throws Exception
setUp
in class RestCrowdServiceAcceptanceTestCase
Exception
public void testUserAuthentication()
public void testUserAuthentication_WithoutPasswordValidation()
public void testUserAuthentication_InactiveUser()
public void testUserAuthentication_BadPassword()
public void testGetUserFromToken()
public void testValidateToken()
public void testShortLivedTokenExpiresImmediately()
public void testMultipleShortLivedSessionsShouldNotDeadlock() throws Exception
Exception
public void testMultipleTokensWithDifferentPrivilegesDoNotInterfereWithEachOther()
public void testCreatedTokenUsesDirectoryCaseForUsername()
public void testValidateToken_InvalidToken()
public void testValidateToken_InvalidValidationFactors()
public void testInvalidateToken()
public void testInvalidateAllTokens()
public void testTokenIsDeletedWhenUserIsRemoved()
public void testTokenIsDeletedWhenUserChangesPassword()
public void testTokenIsDeletedWhenUserIsMadeInactive()
public void testGetUserFromTokenEnforcesApplicationAuthenticationChecks()
public void testAllSessionsForUserAreInvalidatedByDeleteWithUsernameSpecified()
public void testSpecifiedUserSessionIsExcludedFromDeletionByUsername()
public void testStatusNotFoundWhenDeletingTokensForNonexistentUser()
public void testSessionCreatedWithUnaliasedApplicationShowsAliasedNameWhenRetrievedWithAliasingApplication()
public void testSessionCreatedWithUnaliasedApplicationShowsAliasedNameWhenValidatedWithAliasingApplication()
public void testSessionCreatedThroughAliasedApplicationShowsOriginalNameWhenRetrievedWithNonAliasingApplication()
public void testSessionCreatedWithDifferentCaseReturnsCorrectCaseForUsername()
public void testSessionCreatedThroughAliasWithDifferentCaseReturnsCorrectCase()
public void testSessionCannotBeCreatedWithAliasThroughUnaliasedApplication()
public void testAliasedApplicationAlsoAcceptsUnaliasedUsername()
protected void setAliasForUsername(String alias)
public void testAliasChangesAreReflectedInSessionUsername()
public void testSessionForAliasedApplicationIncludesUnaliasedUsernameAsAnExtraField()
Copyright © 2021 Atlassian. All rights reserved.