Skip to content

Commit

Permalink
Crypto disabled for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Nov 26, 2024
1 parent 2e73d96 commit 64d89c0
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
8 changes: 4 additions & 4 deletions server/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ spring:
port: 1025

crypto:
# development-mode: True
development-mode: True

Check warning on line 72 in server/src/main/resources/application.yml

View workflow job for this annotation

GitHub Actions / Test documentation and generate openapi html documentation

72:21 [truthy] truthy value should be one of [false, true]
# private-key-location: classpath:nope

Check warning on line 73 in server/src/main/resources/application.yml

View workflow job for this annotation

GitHub Actions / Test documentation and generate openapi html documentation

73:1 [comments-indentation] comment not indented like content
# Use the commented lines when you want to test against a remote manage. Do not add the private_key to git
development-mode: False
# development-mode: False
private-key-location: classpath:/private_key_pkcs8.pem

cron:
Expand Down Expand Up @@ -192,8 +192,8 @@ email:
# configure real users / passwords and test against those. See server/src/main/java/access/manage/ManageConf.java
# and server/src/main/java/access/manage/LocalManage.java to see how it works.
manage:
enabled: True
# enabled: False
# enabled: True

Check warning on line 195 in server/src/main/resources/application.yml

View workflow job for this annotation

GitHub Actions / Test documentation and generate openapi html documentation

195:1 [comments-indentation] comment not indented like content
enabled: False

Check warning on line 196 in server/src/main/resources/application.yml

View workflow job for this annotation

GitHub Actions / Test documentation and generate openapi html documentation

196:12 [truthy] truthy value should be one of [false, true]
url: "https://manage.test2.surfconext.nl"
user: invite
password: secret
Expand Down
24 changes: 22 additions & 2 deletions server/src/test/java/access/AbstractTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import java.util.function.Consumer;
import java.util.function.UnaryOperator;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static io.restassured.RestAssured.given;
Expand Down Expand Up @@ -346,7 +347,7 @@ protected JWTClaimsSet getJwtClaimsSet(String clientId, String sub, String redir

protected void stubForManageProvisioning(List<String> identifiers) throws JsonProcessingException {
List<Map<String, Object>> providers = localManage.provisioning(identifiers);
String body = objectMapper.writeValueAsString(providers);
String body = writeValueAsString(providers);
stubFor(post(urlPathMatching("/manage/api/internal/provisioning"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(body)
Expand Down Expand Up @@ -400,12 +401,31 @@ protected void stubForManageProviderByIdNotFound(EntityType entityType, String i
protected void stubForManagerProvidersByIdIn(EntityType entityType, List<String> identifiers) {
String path = String.format("/manage/api/internal/rawSearch/%s", entityType.name().toLowerCase());
List<Map<String, Object>> providers = localManage.providersByIdIn(entityType, identifiers);
String body = objectMapper.writeValueAsString(providers);
String body = writeValueAsString(providers);
stubFor(post(urlPathMatching(path)).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBody(body)));
}

@SneakyThrows
protected void stubForManageAllProviders(EntityType... entityTypes) {
Stream.of(entityTypes).forEach(entityType -> {
String path = String.format("/manage/api/internal/search/%s", entityType.name().toLowerCase());
List<Map<String, Object>> providers = localManage.providers(entityType);
String s = writeValueAsString(providers);
String body = s;
stubFor(post(urlPathMatching(path)).willReturn(aResponse()
.withHeader("Content-Type", "application/json")
.withBody(body)));

});
}

@SneakyThrows
private String writeValueAsString(List<Map<String, Object>> providers) {
return objectMapper.writeValueAsString(providers);
}

protected void stubForManageProviderByEntityID(EntityType entityType, String entityId) throws JsonProcessingException {
String path = String.format("/manage/api/internal/rawSearch/%s", entityType.name().toLowerCase());
Optional<Map<String, Object>> provider = localManage.providerByEntityID(entityType, entityId);
Expand Down
9 changes: 6 additions & 3 deletions server/src/test/java/access/api/SystemControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ void unknownRoles() throws Exception {
@Test
void performanceSeed() throws Exception {
AccessCookieFilter accessCookieFilter = openIDConnectFlow("/api/v1/users/login", SUPER_SUB);

super.stubForManageAllProviders(EntityType.SAML20_SP, EntityType.OIDC10_RP, EntityType.SAML20_IDP);

Map<String, Object> results = given()
.when()
.filter(accessCookieFilter.cookieFilter())
Expand All @@ -90,11 +93,11 @@ void performanceSeed() throws Exception {
.queryParam("numberOfRole", 1)
.queryParam("numberOfUsers", 1)
.contentType(ContentType.JSON)
.get("/api/v1/system/performance-seed")
.put("/api/v1/system/performance-seed")
.as(new TypeRef<>() {
});
assertEquals(1, results.get("users"));
assertEquals(1, results.get("users"));
assertEquals(1, results.get("users"));
assertEquals(1, results.get("roles"));
assertEquals(1, results.get("userRoles"));
}
}

0 comments on commit 64d89c0

Please sign in to comment.