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

Some fixes for the lifecycle (deprovision) endpoint #21

Merged
merged 3 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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 {
}


}
}
Loading