diff --git a/client/src/pages/Role.js b/client/src/pages/Role.js index 79160b3c..c12996e1 100644 --- a/client/src/pages/Role.js +++ b/client/src/pages/Role.js @@ -164,7 +164,7 @@ export const Role = () => { rel="noreferrer" target="_blank"> {`${role.applicationName}`} - {` (${role.applicationOrganizationName})`} + {role.applicationOrganizationName && {` (${role.applicationOrganizationName})`}} diff --git a/client/src/tabs/Invitations.scss b/client/src/tabs/Invitations.scss index 0616eac2..0f86f94f 100644 --- a/client/src/tabs/Invitations.scss +++ b/client/src/tabs/Invitations.scss @@ -48,6 +48,10 @@ tbody { td { + &.email { + word-break: keep-all; + } + &.check { text-align: center; } diff --git a/server/src/main/java/access/api/ManageController.java b/server/src/main/java/access/api/ManageController.java index 729f17d6..433aab21 100644 --- a/server/src/main/java/access/api/ManageController.java +++ b/server/src/main/java/access/api/ManageController.java @@ -55,25 +55,6 @@ public ResponseEntity> providerById(@PathVariable("type") En return ResponseEntity.ok(provider); } - @GetMapping("provisioning/{id}") - public ResponseEntity>> provisioning(@PathVariable("id") String id, - @Parameter(hidden = true) User user) { - LOG.debug("provisioning"); - UserPermissions.assertManagerRole(Map.of("id", id), user); - List> provisioning = manage.provisioning(List.of(id)); - if (!user.isSuperUser()) { - provisioning.forEach(prov -> { - Map data = (Map) prov.get("data"); - Map metaDataFields = (Map) data.getOrDefault("metaDataFields", Collections.emptyMap()); - List.of("scim_url", "scim_user", "scim_password", - "eva_url", "eva_token", - "graph_url", "graph_tenant", "graph_secret", "graph_client_id") - .forEach(metaDataFields::remove); - }); - } - return ResponseEntity.ok(provisioning); - } - @GetMapping("providers") public ResponseEntity>> providers(@Parameter(hidden = true) User user) { LOG.debug("/providers"); diff --git a/server/src/main/java/access/api/UserController.java b/server/src/main/java/access/api/UserController.java index dc3ee3cf..f9d4eebf 100644 --- a/server/src/main/java/access/api/UserController.java +++ b/server/src/main/java/access/api/UserController.java @@ -155,17 +155,6 @@ public View msAcceptReturn(@PathVariable("manageId") String manageId, @PathVaria return new RedirectView(redirectReference.get()); } - @GetMapping("switch") - public View switchApp(@Param(value = "app") String app, @Parameter(hidden = true) User user) { - boolean welcome = app.equals("welcome"); - UserPermissions.assertAuthority(user, welcome ? Authority.GUEST : Authority.INVITER); - SecurityContext securityContext = SecurityContextHolder.getContext(); - Authentication authentication = securityContext.getAuthentication(); - //This will force a cookie to authenticate - securityContext.setAuthentication(authentication); - return new RedirectView(welcome ? config.getWelcomeUrl() : config.getClientUrl(), false); - } - @PostMapping("error") public ResponseEntity> error(@RequestBody Map payload, @Parameter(hidden = true) User user) throws diff --git a/server/src/test/java/access/api/ManageControllerTest.java b/server/src/test/java/access/api/ManageControllerTest.java index 9057a6ca..a9e7fe48 100644 --- a/server/src/test/java/access/api/ManageControllerTest.java +++ b/server/src/test/java/access/api/ManageControllerTest.java @@ -92,55 +92,4 @@ void providerById() throws Exception { assertEquals("1", result.get("id")); } - @Test - void provisioningBySuperUser() throws Exception { - AccessCookieFilter accessCookieFilter = openIDConnectFlow("/api/v1/users/login", SUPER_SUB); - - String spBody = objectMapper.writeValueAsString(localManage.provisioning(List.of("1"))); - stubFor(post(urlPathMatching("/manage/api/internal/provisioning")).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withBody(spBody))); - List> result = given() - .when() - .filter(accessCookieFilter.cookieFilter()) - .accept(ContentType.JSON) - .header(accessCookieFilter.csrfToken().getHeaderName(), accessCookieFilter.csrfToken().getToken()) - .contentType(ContentType.JSON) - .get("/api/v1/manage/provisioning/1") - .as(new TypeRef<>() { - }); - assertEquals(1, result.size()); - - Map data = (Map) result.get(0).get("data"); - Map metaDataFields = (Map) data.get("metaDataFields"); - assertTrue(Stream.of("scim_url", "scim_user", "scim_password") - .allMatch(metaDataFields::containsKey)); - } - - @Test - void provisioningByManager() throws Exception { - AccessCookieFilter accessCookieFilter = openIDConnectFlow("/api/v1/users/login", MANAGE_SUB); - - String spBody = objectMapper.writeValueAsString(localManage.provisioning(List.of("1"))); - stubFor(post(urlPathMatching("/manage/api/internal/provisioning")).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withBody(spBody))); - List> result = given() - .when() - .filter(accessCookieFilter.cookieFilter()) - .accept(ContentType.JSON) - .header(accessCookieFilter.csrfToken().getHeaderName(), accessCookieFilter.csrfToken().getToken()) - .contentType(ContentType.JSON) - .get("/api/v1/manage/provisioning/1") - .as(new TypeRef<>() { - }); - assertEquals(1, result.size()); - - Map data = (Map) result.get(0).get("data"); - Map metaDataFields = (Map) data.get("metaDataFields"); - assertTrue(Stream.of("scim_url", "scim_user", "scim_password", "graph_token", "eva_token") - .noneMatch(metaDataFields::containsKey)); - assertTrue(Stream.of("name:en") - .allMatch(metaDataFields::containsKey)); - } } \ No newline at end of file diff --git a/server/src/test/java/access/api/UserControllerTest.java b/server/src/test/java/access/api/UserControllerTest.java index a3763d6b..34184fe4 100644 --- a/server/src/test/java/access/api/UserControllerTest.java +++ b/server/src/test/java/access/api/UserControllerTest.java @@ -290,38 +290,6 @@ void searchOwl() throws Exception { assertEquals(5, users.size()); } - @Test - void switchApp() throws Exception { - AccessCookieFilter accessCookieFilter = openIDConnectFlow("/api/v1/users/login", SUPER_SUB); - - given().redirects() - .follow(false) - .when() - .filter(accessCookieFilter.cookieFilter()) - .accept(ContentType.JSON) - .contentType(ContentType.JSON) - .queryParam("app", "welcome") - .get("/api/v1/users/switch") - .then() - .header("Location", "http://localhost:4000"); - } - - @Test - void switchAppToClient() throws Exception { - AccessCookieFilter accessCookieFilter = openIDConnectFlow("/api/v1/users/login", SUPER_SUB); - - given().redirects() - .follow(false) - .when() - .filter(accessCookieFilter.cookieFilter()) - .accept(ContentType.JSON) - .contentType(ContentType.JSON) - .queryParam("app", "client") - .get("/api/v1/users/switch") - .then() - .header("Location", "http://localhost:3000"); - } - @Test void other() throws Exception { AccessCookieFilter accessCookieFilter = openIDConnectFlow("/api/v1/users/login", SUPER_SUB);