Skip to content

Commit

Permalink
Merge pull request #21 from OpenConext/bugfix/deprovision-endpoint
Browse files Browse the repository at this point in the history
Some fixes for the lifecycle (deprovision) endpoint
  • Loading branch information
oharsta authored Feb 26, 2024
2 parents 182f7da + 058c32b commit 0e2ac68
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion server/src/main/java/access/lifecycle/LifeCycleResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public class LifeCycleResult {

private final String status = "OK";
private final String name = "OpenConext-access-server";
private final String name = "OpenConext-invite-server";
private List<Attribute> data = new ArrayList<>();

public void setData(List<Attribute> data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import static access.SwaggerOpenIdConfig.LIFE_CYCLE_SCHEME_NAME;

@RestController
@RequestMapping(value = {"/api/deprovisioning", "/api/external/v1/deprovisioning"}, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = {"/api/deprovision", "/api/external/v1/deprovision"}, produces = MediaType.APPLICATION_JSON_VALUE)
@SecurityRequirement(name = LIFE_CYCLE_SCHEME_NAME)
public class UserLifeCycleController {

Expand Down
8 changes: 4 additions & 4 deletions server/src/main/java/access/security/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public SecurityConfig(ClientRegistrationRepository clientRegistrationRepository,
@Value("${oidcng.resource-server-secret}") String secret,
@Value("${voot.user}") String vootUser,
@Value("${voot.password}") String vootPassword,
@Value("${lifecyle.user}") String lifeCycleUser,
@Value("${lifecyle.password}") String lifeCyclePassword,
@Value("${lifecycle.user}") String lifeCycleUser,
@Value("${lifecycle.password}") String lifeCyclePassword,
@Value("${teams.user}") String teamsUser,
@Value("${teams.password}") String teamsPassword,
@Value("${attribute-aggregation.user}") String attributeAggregationUser,
Expand Down Expand Up @@ -203,8 +203,8 @@ SecurityFilterChain basicAuthenticationSecurityFilterChain(HttpSecurity http) th
"/api/external/v1/teams/**",
"/api/aa/**",
"/api/external/v1/aa/**",
"/api/deprovisioning/**",
"/api/external/v1/deprovisioning/**")
"/api/deprovision/**",
"/api/external/v1/deprovision/**")
.sessionManagement(c -> c
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
)
Expand Down
4 changes: 2 additions & 2 deletions server/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ attribute-aggregation:
user: aa
password: secret

lifecyle:
user: lifecyle
lifecycle:
user: lifecycle
password: secret

email:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class UserLifeCycleControllerTest extends AbstractTest {
void preview() {
LifeCycleResult lifeCycleResult = given()
.when()
.auth().basic("lifecyle", "secret")
.auth().basic("lifecycle", "secret")
.accept(ContentType.JSON)
.contentType(ContentType.JSON)
.pathParam("sub", GUEST_SUB)
.get("/api/deprovisioning/{sub}")
.get("/api/deprovision/{sub}")
.as(new TypeRef<>() {
});
List<String> memberships = lifeCycleResult.getData().stream().filter(attribute -> attribute.getName().equals("membership"))
Expand All @@ -40,7 +40,7 @@ void lifeCycleRole() {
.accept(ContentType.JSON)
.contentType(ContentType.JSON)
.pathParam("sub", GUEST_SUB)
.get("/api/deprovisioning/{sub}")
.get("/api/deprovision/{sub}")
.then()
.statusCode(400);
}
Expand All @@ -49,11 +49,11 @@ void lifeCycleRole() {
void dryRun() {
LifeCycleResult lifeCycleResult = given()
.when()
.auth().basic("lifecyle", "secret")
.auth().basic("lifecycle", "secret")
.accept(ContentType.JSON)
.contentType(ContentType.JSON)
.pathParam("sub", GUEST_SUB)
.delete("/api/deprovisioning/{sub}/dry-run")
.delete("/api/deprovision/{sub}/dry-run")
.as(new TypeRef<>() {
});
List<String> memberships = lifeCycleResult.getData().stream().filter(attribute -> attribute.getName().equals("membership"))
Expand All @@ -72,11 +72,11 @@ void deprovision() throws JsonProcessingException {
super.stubForDeleteScimUser();
LifeCycleResult lifeCycleResult = given()
.when()
.auth().basic("lifecyle", "secret")
.auth().basic("lifecycle", "secret")
.accept(ContentType.JSON)
.contentType(ContentType.JSON)
.pathParam("sub", GUEST_SUB)
.delete("/api/deprovisioning/{sub}")
.delete("/api/deprovision/{sub}")
.as(new TypeRef<>() {
});
List<String> memberships = lifeCycleResult.getData().stream().filter(attribute -> attribute.getName().equals("membership"))
Expand All @@ -87,4 +87,4 @@ void deprovision() throws JsonProcessingException {
}


}
}

0 comments on commit 0e2ac68

Please sign in to comment.