Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add integration Test for obo Resource Server With Session #23477

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ public void testAllowedEndpointsForSingleTenantByAccessToken() {
@Test
public void testAllowedEndpointsForSingleTenantByCookie() {
assertEquals("home",
singleTenantITHelper.httpGetCookieByAccessTokenThenGetStringByCookie("home", "home"));
singleTenantITHelper.httpGetCookieByVisitEndpointsByCookie("home", "home"));
assertEquals("api/all",
singleTenantITHelper.httpGetCookieByAccessTokenThenGetStringByCookie("home", "api/all"));
singleTenantITHelper.httpGetCookieByVisitEndpointsByCookie("home", "api/all"));
assertEquals("api/group1",
singleTenantITHelper.httpGetCookieByAccessTokenThenGetStringByCookie("home", "api/group1"));
singleTenantITHelper.httpGetCookieByVisitEndpointsByCookie("home", "api/group1"));
}

@Test
Expand All @@ -96,11 +96,11 @@ public void testAllowedEndpointsForMultiTenantByAccessToken() {
@Test
public void testAllowedEndpointsForMultipleTenantByCookie() {
assertEquals("home",
multiTenantITHelper.httpGetCookieByAccessTokenThenGetStringByCookie("home", "home"));
multiTenantITHelper.httpGetCookieByVisitEndpointsByCookie("home", "home"));
assertEquals("api/all",
multiTenantITHelper.httpGetCookieByAccessTokenThenGetStringByCookie("home", "api/all"));
multiTenantITHelper.httpGetCookieByVisitEndpointsByCookie("home", "api/all"));
assertEquals("api/group1",
multiTenantITHelper.httpGetCookieByAccessTokenThenGetStringByCookie("home", "api/group1"));
multiTenantITHelper.httpGetCookieByVisitEndpointsByCookie("home", "api/group1"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ public void testCallGraphApiOfResourceServer() {
aadWebApiITHelper.httpGetStringByAccessToken("/api/call-graph"));
}

@Test
public void testCallGraphApiOfResourceServerWithSession() {
zhichengliu12581 marked this conversation as resolved.
Show resolved Hide resolved
AADWebApiITHelper aadWebApiITHelper = new AADWebApiITHelper(
DumbApp.class,
properties,
AAD_MULTI_TENANT_CLIENT_ID,
AAD_MULTI_TENANT_CLIENT_SECRET,
Collections.singletonList(MULTI_TENANT_SCOPE_GRAPH_READ));
assertEquals("Graph response success.",
aadWebApiITHelper.httpGetCookieByVisitEndpointsByCookie("/api/call-graph", "/api/call-graph"));
}

@SpringBootApplication
@ImportAutoConfiguration(AADWebApplicationAndResourceServerITConfig.class)
public static class DumbApp {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public AADWebApiITHelper(Class<?> appClass,
String.join(" ", accessTokenScopes));
}

public String httpGetCookieByAccessTokenThenGetStringByCookie(String accessTokenEndpoint, String cookieEndpoint) {
public String httpGetCookieByVisitEndpointsByCookie(String accessTokenEndpoint, String cookieEndpoint) {
zhichengliu12581 marked this conversation as resolved.
Show resolved Hide resolved
ResponseEntity<String> responseEntity =
httpGetResponseByToken(accessTokenEndpoint, oAuth2ROPCResponse.getAccessToken());
String jSessionIdCookie = responseEntity
Expand Down