Skip to content

Commit

Permalink
Merge branch 'master' into feature/docker_configs
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Jan 26, 2024
2 parents 6e161ef + cd9df34 commit 9593916
Show file tree
Hide file tree
Showing 16 changed files with 73 additions and 52 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ jira_change_requests.json
SabClientIntegrationTest.java
sso.txt
TODO.txt

11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,14 @@ Or to run all the tests and do not watch:
cd client
CI=true yarn test
```

### [Jira](#jira)
```
cd dashboard-server/src/test/resources/jira-json/
curl -u test-beheer-rpc -X POST -H 'Content-Type: application/json' -d '@query.json' 'https://servicedesk.test.surf.nl/jira/rest/api/2/search'
```
To find transitions:
```
curl -u test-beheer-rpc "https://servicedesk.test.surf.nl/jira/rest/api/2/issue/CXT-70752/transitions" | jq .
```
The Jira password can be found in the environments-external project in SURF gitlab.
2 changes: 1 addition & 1 deletion dashboard-gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>org.openconext</groupId>
<artifactId>dashboard</artifactId>
<version>12.3.14-SNAPSHOT</version>
<version>12.3.15-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
7 changes: 4 additions & 3 deletions dashboard-gui/src/javascripts/locale/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ I18n.translations.en = {
no_results: 'No results',
info: 'On this page you find all tickets related to (dis)connecting services and change requests.',
moreAwaitingTickets:
"Not all 'Awaiting Input' tickets are shown because the period in the search filter is not broad enough.",
"Not all 'Waiting for customer' tickets are shown because the period in the search filter is not broad enough.",
requestDate: 'Created',
updateDate: 'Updated',
type: 'Type',
Expand All @@ -1046,12 +1046,13 @@ I18n.translations.en = {
spEntityId: 'Service',
statuses: {
all: 'All tickets',
'To Do': 'Open',
'Open': 'Open',
'In Progress': 'In progress',
'On Hold': 'On Hold',
'Waiting for customer': 'Pending input',
'Waiting for Acceptance': 'Waiting for Acceptance',
Resolved: 'Resolved',
Reopened: 'Reopened',
Closed: 'Closed',
undefined: 'Undefined',
},
Expand Down Expand Up @@ -1096,7 +1097,7 @@ I18n.translations.en = {
search: 'Search services...',
},
invite_request: {
info: 'An invite request results in a mail send to all selected contactpersons of an Institution with an invite to connect to the selected Service or disconnect from the selected Service. A <span class="emphasize">Connection Invite</span> or <span class="emphasize">Disconnection Invite</span> Jira ticket is created with the status <span class="emphasize">Awaiting Input</span>.',
info: 'An invite request results in a mail send to all selected contactpersons of an Institution with an invite to connect to the selected Service or disconnect from the selected Service. A <span class="emphasize">Connection Invite</span> or <span class="emphasize">Disconnection Invite</span> Jira ticket is created with the status <span class="emphasize">Waiting for customer</span>.',
selectIdp: 'Search and select an Institution...',
selectSpDisabled: 'First select an Institution',
selectSp: 'Now search and select the Service...',
Expand Down
5 changes: 3 additions & 2 deletions dashboard-gui/src/javascripts/locale/nl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1045,12 +1045,13 @@ I18n.translations.nl = {
spEntityId: 'Dienst',
statuses: {
all: 'Alle tickets',
'To Do': 'Open',
'Open': 'Open',
'In Progress': 'Bezig',
'On Hold': 'In de wacht',
'Waiting for customer': 'Wachtende op goedkeuring',
'Waiting for Acceptance': 'Wachtende op acceptatie',
Resolved: 'Opgeleverd',
Reopened: 'Heropend',
Closed: 'Gesloten',
undefined: 'Onbepaald',
},
Expand Down Expand Up @@ -1095,7 +1096,7 @@ I18n.translations.nl = {
search: 'Zoek diensten...',
},
invite_request: {
info: 'Een koppelingsuitnodiging zal een e-mail versturen aan alle geselecteerde contactpersonen met daarin een uitnodiging om hun instelling te koppelen aan de geselecteerde dienst of te ontkoppelen van de de geselecteerde dienst. Daarnaast zal er een <span class="emphasize">Connection Invite</span> of <span class="emphasize">Disconnection Invite</span> Jira-ticket worden aangemaakt met de status <span class="emphasize">Awaiting Input</span>.',
info: 'Een koppelingsuitnodiging zal een e-mail versturen aan alle geselecteerde contactpersonen met daarin een uitnodiging om hun instelling te koppelen aan de geselecteerde dienst of te ontkoppelen van de de geselecteerde dienst. Daarnaast zal er een <span class="emphasize">Connection Invite</span> of <span class="emphasize">Disconnection Invite</span> Jira-ticket worden aangemaakt met de status <span class="emphasize">Waiting for customer</span>.',
selectIdp: 'Zoek en selecteer een instelling...',
selectSpDisabled: 'Selecteer eerst een instelling',
selectSp: 'Zoek en selecteer nu een dienst...',
Expand Down
5 changes: 3 additions & 2 deletions dashboard-gui/src/javascripts/locale/pt.js
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ I18n.translations.pt = {
no_results: 'No results',
info: 'Nesta página pode encontrar todos os pedidos de serviços relacionados com a (des)ativação de serviços e pedidos de alterações.',
moreAwaitingTickets:
"Not all 'Awaiting Input' tickets are shown because the period in the search filter is not broad enough.",
"Not all 'Waiting for customer' tickets are shown because the period in the search filter is not broad enough.",
requestDate: 'Criado',
updateDate: 'Atualizado',
type: 'Tipo',
Expand All @@ -1012,12 +1012,13 @@ I18n.translations.pt = {
spEntityId: 'Serviço',
statuses: {
all: 'All tickets',
'To Do': 'Abrir',
'Open': 'Abrir',
'In Progress': 'Em progresso',
'On Hold': 'Em espera',
'Waiting for customer': 'Input pendente',
'Waiting for Acceptance': 'Input pendente',
Resolved: 'Resolvido',
Reopened: 'Reaberta',
Closed: 'Fechado',
undefined: 'Indefinido',
},
Expand Down
2 changes: 1 addition & 1 deletion dashboard-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.openconext</groupId>
<artifactId>dashboard</artifactId>
<version>12.3.14-SNAPSHOT</version>
<version>12.3.15-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,15 @@ public class UrlResourceManage implements Manage {
private final RestTemplate restTemplate = new RestTemplate();
private final HttpHeaders httpHeaders;

private String requestedAttributes = "\"ALL_ATTRIBUTES\":true";
private String body = "{" + requestedAttributes + "}";
private String bodyForEntity = "{\"entityid\":\"@@entityid@@\", " + requestedAttributes + "}";
private String bodyForEid = "{\"eid\":@@eid@@, " + requestedAttributes + "}";
private String bodyForInstitutionId =
private final String requestedAttributes = "\"ALL_ATTRIBUTES\":true";
private final String body = "{" + requestedAttributes + "}";
private final String bodyForEntity = "{\"entityid\":\"@@entityid@@\", " + requestedAttributes + "}";
private final String bodyForInstitutionId =
"{\"metaDataFields.coin:institution_id\":\"@@institution_id@@\", \"ALL_ATTRIBUTES\":true}";

private String linkedQuery = "{$and: [{$or:[{\"data.allowedEntities.name\": {$in: [\"@@entityid@@\"]}}, {\"data" +
private final String linkedQuery = "{$and: [{$or:[{\"data.allowedEntities.name\": {$in: [\"@@entityid@@\"]}}, {\"data" +
".allowedall\": true}]}]}";

private String findByEntityIdIn = "{\"data.entityid\":{\"$in\":[@@entityids@@]}}";

public UrlResourceManage(
String username,
String password,
Expand Down Expand Up @@ -109,6 +106,7 @@ public Optional<ServiceProvider> getServiceProviderById(Long spId, EntityType en
if (spId == null) {
return Optional.empty();
}
String bodyForEid = "{\"eid\":@@eid@@, " + requestedAttributes + "}";
String body = bodyForEid.replace("@@eid@@", spId.toString());
List<Map<String, Object>> providers = getMaps(providerInputStream(entityType, body));
return providers.stream().map(this::transformManageMetadata).map(sp -> this.serviceProvider(sp, entityType)).findFirst();
Expand Down Expand Up @@ -163,6 +161,7 @@ public List<ServiceProvider> getLinkedServiceProviders(String idpId) {
@Override
public List<ServiceProvider> getByEntityIdin(List<String> entityIds) {
String split = entityIds.stream().map(s -> "\"" + s + "\"").collect(Collectors.joining(","));
String findByEntityIdIn = "{\"data.entityid\":{\"$in\":[@@entityids@@]}}";
String query = findByEntityIdIn.replace("@@entityids@@", split);
return rawSearchProviders(query, EntityType.saml20_sp, EntityType.oidc10_rp, EntityType.oauth20_rs);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public List<Attribute> allowedAttributes() {
RequestEntity<?> request = buildGetRequest("/protected/attributes/");

return executeWithExceptionLogging(() -> {
ResponseEntity<List<AllowedAttribute>> response = pdpRestTemplate.exchange(request, new ParameterizedTypeReference<List<AllowedAttribute>>() {
ResponseEntity<List<AllowedAttribute>> response = pdpRestTemplate.exchange(request, new ParameterizedTypeReference<>() {
});
return response.getBody().stream().map(aa -> new Attribute(aa.attributeId, aa.value)).collect(Collectors.toList());
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,16 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableMap;
import dashboard.domain.Action;
import dashboard.domain.Action.Type;
import dashboard.domain.Change;
import dashboard.domain.JiraFilter;
import dashboard.domain.JiraResponse;
import dashboard.service.impl.JiraTicketSummaryAndDescriptionBuilder.SummaryAndDescription;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.http.*;

import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.client.HttpClientErrorException;
Expand Down Expand Up @@ -140,6 +137,11 @@ public JiraResponse searchTasks(String idp, JiraFilter jiraFilter) {
"maxResults", jiraFilter.getMaxResults(),
"startAt", jiraFilter.getStartAt(),
"fields", this.standardFields);

if (LOG.isDebugEnabled()) {
LOG.debug("Sending query to Jira: " + body);
}

HttpEntity<Map<String, Object>> entity = new HttpEntity<>(body, defaultHeaders);

String url = baseUrl + "/search";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,7 @@ public class JiraClientMock implements JiraClient {

private final AtomicInteger counter = new AtomicInteger(0);

private final List<String> statuses = Arrays.asList("To Do", "In Progress", "Awaiting Input", "Resolved", "Closed");

public JiraClientMock(String idp) {
// IntStream.rangeClosed(0, 25).forEach(i -> {
// List<Action.Type> types = Arrays.asList(Action.Type.values());
// Action action = Action.builder()
// .spId("http://sp-" + i)
// .idpId(idp)
// .idpName("IDP")
// .jiraKey(generateKey())
// .requestDate(ZonedDateTime.now())
// .status(statuses.get(new Random().nextInt(statuses.size())))
// .type(types.get(new Random().nextInt(types.size())))
// .build();
// repository.put(action.getJiraKey().get(), action);
// });

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ protected Object getPreAuthenticatedPrincipal(final HttpServletRequest request)
String idpEntityId = coinUser.getIdp().getId();
JiraFilter jiraFilter = new JiraFilter();
jiraFilter.setTypes(Arrays.asList(Action.Type.LINKINVITE, Action.Type.LINKREQUEST, Action.Type.UNLINKINVITE, Action.Type.UNLINKREQUEST));
jiraFilter.setStatuses(Arrays.asList("To Do", "Awaiting Input"));
jiraFilter.setStatuses(Arrays.asList("In Progress", "Waiting for customer"));

JiraResponse jiraResponse = jiraClient.searchTasks(idpEntityId, jiraFilter);
List<Action> issues = jiraResponse.getIssues();
Expand Down
2 changes: 1 addition & 1 deletion dashboard-server/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ guestidp.entityids=https://www.onegini.me, https://idp.mpi.nl/idp-conext
dashboard.hide_tabs=none

default_loa_level=http://test2.surfconext.nl/assurance/loa1
loa_values_supported="http://{{ base_domain }}/assurance/loa1.5, http://test2.surfconext.nl/assurance/loa2, http://test2.surfconext.nl/assurance/loa3"
loa_values_supported="http://test2.surfconext.nl/assurance/loa1.5, http://test2.surfconext.nl/assurance/loa2, http://test2.surfconext.nl/assurance/loa3"

authn_context_levels=http://schemas.microsoft.com/claims/multipleauthn, https://refeds.org/profile/mfa
21 changes: 21 additions & 0 deletions dashboard-server/src/test/resources/jira-json/query.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"jql": "project = CXT AND cf[13012]~\"http://mock-idp\" AND status in (\"To Do\", \"Awaiting Input\") AND issueType in (11401, 11104, 12100, 11105)",
"maxResults": 20,
"startAt": 0,
"fields": [
"summary",
"resolution",
"status",
"assignee",
"issuetype",
"created",
"description",
"updated",
"comment",
"customfield_13018",
"customfield_13012",
"customfield_13010",
"customfield_14800",
"customfield_15300"
]
}
24 changes: 12 additions & 12 deletions dashboard-server/src/test/resources/jira-json/rejected_task.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@
"self": "https://jira-test.surfnet.nl/rest/api/2/status/10800",
"description": "",
"iconUrl": "https://jira-test.surfnet.nl/",
"name": "To Do",
"name": "In Progress",
"id": "10800",
"statusCategory": {
"self": "https://jira-test.surfnet.nl/rest/api/2/statuscategory/2",
"id": 2,
"key": "new",
"colorName": "blue-gray",
"name": "To Do"
"name": "In Progress"
}
}
}
Expand Down Expand Up @@ -316,14 +316,14 @@
"self": "https://jira-test.surfnet.nl/rest/api/2/status/10800",
"description": "",
"iconUrl": "https://jira-test.surfnet.nl/",
"name": "To Do",
"name": "In Progress",
"id": "10800",
"statusCategory": {
"self": "https://jira-test.surfnet.nl/rest/api/2/statuscategory/2",
"id": 2,
"key": "new",
"colorName": "blue-gray",
"name": "To Do"
"name": "In Progress"
}
}
}
Expand Down Expand Up @@ -456,14 +456,14 @@
"self": "https://jira-test.surfnet.nl/rest/api/2/status/10800",
"description": "",
"iconUrl": "https://jira-test.surfnet.nl/",
"name": "To Do",
"name": "In Progress",
"id": "10800",
"statusCategory": {
"self": "https://jira-test.surfnet.nl/rest/api/2/statuscategory/2",
"id": 2,
"key": "new",
"colorName": "blue-gray",
"name": "To Do"
"name": "In Progress"
}
}
}
Expand Down Expand Up @@ -596,14 +596,14 @@
"self": "https://jira-test.surfnet.nl/rest/api/2/status/10800",
"description": "",
"iconUrl": "https://jira-test.surfnet.nl/",
"name": "To Do",
"name": "In Progress",
"id": "10800",
"statusCategory": {
"self": "https://jira-test.surfnet.nl/rest/api/2/statuscategory/2",
"id": 2,
"key": "new",
"colorName": "blue-gray",
"name": "To Do"
"name": "In Progress"
}
}
}
Expand Down Expand Up @@ -764,14 +764,14 @@
"self": "https://jira-test.surfnet.nl/rest/api/2/status/10800",
"description": "",
"iconUrl": "https://jira-test.surfnet.nl/",
"name": "To Do",
"name": "In Progress",
"id": "10800",
"statusCategory": {
"self": "https://jira-test.surfnet.nl/rest/api/2/statuscategory/2",
"id": 2,
"key": "new",
"colorName": "blue-gray",
"name": "To Do"
"name": "In Progress"
}
}
}
Expand Down Expand Up @@ -904,14 +904,14 @@
"self": "https://jira-test.surfnet.nl/rest/api/2/status/10800",
"description": "",
"iconUrl": "https://jira-test.surfnet.nl/",
"name": "To Do",
"name": "In Progress",
"id": "10800",
"statusCategory": {
"self": "https://jira-test.surfnet.nl/rest/api/2/statuscategory/2",
"id": 2,
"key": "new",
"colorName": "blue-gray",
"name": "To Do"
"name": "In Progress"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<groupId>org.openconext</groupId>
<artifactId>dashboard</artifactId>
<version>12.3.14-SNAPSHOT</version>
<version>12.3.15-SNAPSHOT</version>
<name>dashboard</name>
<description>OpenConext-Dashboard</description>
<inceptionYear>2012</inceptionYear>
Expand Down

0 comments on commit 9593916

Please sign in to comment.