mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
REPO-4009: format the test class
This commit is contained in:
@@ -197,6 +197,7 @@ public class AuthenticationsTest extends AbstractSingleNetworkSiteTest
|
|||||||
// Get list of site by appending the invalidated ticket
|
// Get list of site by appending the invalidated ticket
|
||||||
getAll(SiteEntityResource.class, paging, ticket, 401);
|
getAll(SiteEntityResource.class, paging, ticket, 401);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests login (create ticket), logout (delete ticket), and validate (get ticket).
|
* Tests login (create ticket), logout (delete ticket), and validate (get ticket).
|
||||||
*
|
*
|
||||||
@@ -222,7 +223,6 @@ public class AuthenticationsTest extends AbstractSingleNetworkSiteTest
|
|||||||
// Unauthorized call
|
// Unauthorized call
|
||||||
getAll(SiteEntityResource.class, paging, null, 401);
|
getAll(SiteEntityResource.class, paging, null, 401);
|
||||||
|
|
||||||
|
|
||||||
// login request
|
// login request
|
||||||
LoginTicket loginRequest = new LoginTicket();
|
LoginTicket loginRequest = new LoginTicket();
|
||||||
// Invalid login details
|
// Invalid login details
|
||||||
@@ -280,7 +280,6 @@ public class AuthenticationsTest extends AbstractSingleNetworkSiteTest
|
|||||||
LoginTicketResponse validatedTicket = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), LoginTicketResponse.class);
|
LoginTicketResponse validatedTicket = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), LoginTicketResponse.class);
|
||||||
assertEquals(loginResponse.getId(), validatedTicket.getId());
|
assertEquals(loginResponse.getId(), validatedTicket.getId());
|
||||||
|
|
||||||
{
|
|
||||||
// now use the "bearer" keyword with the alf-ticket - should not succeed
|
// now use the "bearer" keyword with the alf-ticket - should not succeed
|
||||||
header = Collections.singletonMap("Authorization", "bearer " + encodedTicket);
|
header = Collections.singletonMap("Authorization", "bearer " + encodedTicket);
|
||||||
response = getSingle(TICKETS_URL, People.DEFAULT_USER, null, header, TICKETS_API_NAME, 401);
|
response = getSingle(TICKETS_URL, People.DEFAULT_USER, null, header, TICKETS_API_NAME, 401);
|
||||||
@@ -288,7 +287,6 @@ public class AuthenticationsTest extends AbstractSingleNetworkSiteTest
|
|||||||
// now send some junk - should not succeed
|
// now send some junk - should not succeed
|
||||||
header = Collections.singletonMap("Authorization", "junk " + encodedTicket);
|
header = Collections.singletonMap("Authorization", "junk " + encodedTicket);
|
||||||
response = getSingle(TICKETS_URL, People.DEFAULT_USER, null, header, TICKETS_API_NAME, 401);
|
response = getSingle(TICKETS_URL, People.DEFAULT_USER, null, header, TICKETS_API_NAME, 401);
|
||||||
}
|
|
||||||
|
|
||||||
// Try list children for user2 again.
|
// Try list children for user2 again.
|
||||||
// Encode Alfresco predefined userId for ticket authentication, ROLE_TICKET, and the ticket
|
// Encode Alfresco predefined userId for ticket authentication, ROLE_TICKET, and the ticket
|
||||||
@@ -300,14 +298,12 @@ public class AuthenticationsTest extends AbstractSingleNetworkSiteTest
|
|||||||
nodes = RestApiUtil.parseRestApiEntries(response.getJsonResponse(), Document.class);
|
nodes = RestApiUtil.parseRestApiEntries(response.getJsonResponse(), Document.class);
|
||||||
assertEquals(1, nodes.size());
|
assertEquals(1, nodes.size());
|
||||||
|
|
||||||
{
|
|
||||||
// now use the "bearer" keyword with the alf-ticket - should not succeed
|
// now use the "bearer" keyword with the alf-ticket - should not succeed
|
||||||
encodedUserIdAndTicket = encodeB64("ROLE_TICKET:" + loginResponse.getId());
|
encodedUserIdAndTicket = encodeB64("ROLE_TICKET:" + loginResponse.getId());
|
||||||
// Set the authorization (encoded userId:ticket) header rather than appending the ticket to the URL
|
// Set the authorization (encoded userId:ticket) header rather than appending the ticket to the URL
|
||||||
header = Collections.singletonMap("Authorization", "bearer " + encodedUserIdAndTicket);
|
header = Collections.singletonMap("Authorization", "bearer " + encodedUserIdAndTicket);
|
||||||
// Get children of user2 home folder
|
// Get children of user2 home folder
|
||||||
response = getAll(getNodeChildrenUrl(Nodes.PATH_MY), paging, null, header, 401);
|
response = getAll(getNodeChildrenUrl(Nodes.PATH_MY), paging, null, header, 401);
|
||||||
}
|
|
||||||
|
|
||||||
// Try list children for user2 again - appending ticket
|
// Try list children for user2 again - appending ticket
|
||||||
Map<String, String> ticket = Collections.singletonMap("alf_ticket", loginResponse.getId());
|
Map<String, String> ticket = Collections.singletonMap("alf_ticket", loginResponse.getId());
|
||||||
|
Reference in New Issue
Block a user