Skip to content

Commit

Permalink
XRDDEV-227: change Security Server's address from Security Server UI (#…
Browse files Browse the repository at this point in the history
…1867)

* feat: addressChange managing request definition

Refs: XRDDEV-227

* feat: entity, dto, mappers

Refs: XRDDEV-227

* feat: addressChange managing request processing on central server

Refs: XRDDEV-227

* feat: addressChange managing request processing on management-service

Refs: XRDDEV-227

* feat: CS: display address change management request in the list

Refs: XRDDEV-227

* feat: SS: endpoint to change server address

Refs: XRDDEV-227

* feat: address change management request

Refs: XRDDEV-227

* chore: fix after merge with develop

Refs: XRDDEV-227

* feat: signing the address change management request

Refs: XRDDEV-227

* feat: ss ui for changing address

Refs: XRDDEV-227

* docs: address change request docs update

Refs: XRDDEV-227

* feat: show status after ss address submitted change

Refs: XRDDEV-227

* chore: test-automation version up

Refs: XRDDEV-227

* test: Security Server system test for address change

Refs: XRDDEV-227

* chore: sonar fixes

Refs: XRDDEV-227

* chore: redundant line removed

Refs: XRDDEV-227

* chore: adding apt-get update in github actions workflow

Refs: XRDDEV-227
  • Loading branch information
justasnortal authored Nov 27, 2023
1 parent 4268dfe commit 2862b48
Show file tree
Hide file tree
Showing 59 changed files with 2,429 additions and 1,067 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/run_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # SonarCloud: Shallow clones should be disabled for a better relevancy of analysis
- name: Ensure required packages
run: sudo apt-get update && sudo apt-get install -y curl software-properties-common build-essential unzip debhelper devscripts
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Ensure required packages
run: sudo apt-get install -y curl software-properties-common build-essential unzip debhelper devscripts
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
Expand Down
215 changes: 111 additions & 104 deletions doc/Manuals/ug-cs_x-road_6_central_server_user_guide.md

Large diffs are not rendered by default.

495 changes: 257 additions & 238 deletions doc/Manuals/ug-ss_x-road_6_security_server_user_guide.md

Large diffs are not rendered by default.

761 changes: 412 additions & 349 deletions doc/Protocols/pr-mserv_x-road_protocol_for_management_services.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
##
- IMPERSONATE_SECURITY_SERVER: [ XROAD_MANAGEMENT_SERVICE ]
- ADD_OWNER_CHANGE_REQUEST: [ XROAD_MANAGEMENT_SERVICE ]
- ADD_ADDRESS_CHANGE_REQUEST: [ XROAD_MANAGEMENT_SERVICE ]
##
- VIEW_VERSION: [ XROAD_SYSTEM_ADMINISTRATOR, XROAD_SECURITY_OFFICER, XROAD_REGISTRATION_OFFICER, XROAD_MANAGEMENT_SERVICE ]
- CREATE_API_KEY: [ XROAD_SYSTEM_ADMINISTRATOR ]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* The MIT License
*
* Copyright (c) 2019- Nordic Institute for Interoperability Solutions (NIIS)
* Copyright (c) 2018 Estonian Information System Authority (RIA),
* Nordic Institute for Interoperability Solutions (NIIS), Population Register Centre (VRK)
* Copyright (c) 2015-2017 Estonian Information System Authority (RIA), Population Register Centre (VRK)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

package org.niis.xroad.cs.admin.api.domain;

import ee.ria.xroad.common.identifier.SecurityServerId;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.niis.xroad.common.managementrequest.model.ManagementRequestType;

@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class AddressChangeRequest extends Request {
private String serverAddress;

public AddressChangeRequest(Origin origin, SecurityServerId identifier, String address) {
super(origin, identifier);
this.serverAddress = address;
}

@Override
public ManagementRequestType getManagementRequestType() {
return ManagementRequestType.ADDRESS_CHANGE_REQUEST;
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/*
* The MIT License
* <p>
*
* Copyright (c) 2019- Nordic Institute for Interoperability Solutions (NIIS)
* Copyright (c) 2018 Estonian Information System Authority (RIA),
* Nordic Institute for Interoperability Solutions (NIIS), Population Register Centre (VRK)
* Copyright (c) 2015-2017 Estonian Information System Authority (RIA), Population Register Centre (VRK)
* <p>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* <p>
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* <p>
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down Expand Up @@ -64,6 +64,7 @@ public enum ErrorMessage implements DeviationProvider {
MR_OWNER_MUST_BE_CLIENT("management_request_owner_must_be_client", "Owner is not registered as client on the security server"),
MR_CLIENT_ALREADY_OWNER("management_request_client_already_owner", "Client is already owner of the security server"),
MR_SERVER_CODE_EXISTS("management_request_server_code_exists", "Member already owns a security server with server code"),
MR_INVALID_SERVER_ADDRESS("management_request_invalid_server_address", "Invalid server address"),
MR_UNKNOWN_TYPE("management_request_unknown_type", "Unknown request type"),

INVALID_SERVICE_PROVIDER_ID("invalid_service_provider_id", "Invalid service provider id"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* The MIT License
*
* Copyright (c) 2019- Nordic Institute for Interoperability Solutions (NIIS)
* Copyright (c) 2018 Estonian Information System Authority (RIA),
* Nordic Institute for Interoperability Solutions (NIIS), Population Register Centre (VRK)
* Copyright (c) 2015-2017 Estonian Information System Authority (RIA), Population Register Centre (VRK)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

package org.niis.xroad.cs.admin.core.entity;

import ee.ria.xroad.common.identifier.SecurityServerId;

import jakarta.persistence.Column;
import jakarta.persistence.DiscriminatorValue;
import jakarta.persistence.Entity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.niis.xroad.common.managementrequest.model.ManagementRequestType;
import org.niis.xroad.cs.admin.api.domain.Origin;

import static org.niis.xroad.cs.admin.core.entity.AddressChangeRequestEntity.DISCRIMINATOR_VALUE;


@Entity
@NoArgsConstructor
@DiscriminatorValue(DISCRIMINATOR_VALUE)
public class AddressChangeRequestEntity extends RequestEntity {

public static final String DISCRIMINATOR_VALUE = "AddressChangeRequest";

@Column(name = "address")
@Getter
@Setter
private String address;

public AddressChangeRequestEntity(Origin origin, SecurityServerId identifier, String comments, String address) {
super(origin, identifier, comments);
this.address = address;
}

@Override
public ManagementRequestType getManagementRequestType() {
return ManagementRequestType.ADDRESS_CHANGE_REQUEST;
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/*
* The MIT License
* <p>
*
* Copyright (c) 2019- Nordic Institute for Interoperability Solutions (NIIS)
* Copyright (c) 2018 Estonian Information System Authority (RIA),
* Nordic Institute for Interoperability Solutions (NIIS), Population Register Centre (VRK)
* Copyright (c) 2015-2017 Estonian Information System Authority (RIA), Population Register Centre (VRK)
* <p>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* <p>
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* <p>
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down Expand Up @@ -52,6 +52,7 @@
import java.time.Instant;
import java.util.Map;

import static org.niis.xroad.common.managementrequest.model.ManagementRequestType.ADDRESS_CHANGE_REQUEST;
import static org.niis.xroad.common.managementrequest.model.ManagementRequestType.AUTH_CERT_DELETION_REQUEST;
import static org.niis.xroad.common.managementrequest.model.ManagementRequestType.AUTH_CERT_REGISTRATION_REQUEST;
import static org.niis.xroad.common.managementrequest.model.ManagementRequestType.CLIENT_DELETION_REQUEST;
Expand Down Expand Up @@ -150,7 +151,8 @@ public static class ManagementRequestTypeDiscriminatorMapping {
CLIENT_REGISTRATION_REQUEST, ClientRegistrationRequestEntity.DISCRIMINATOR_VALUE,
OWNER_CHANGE_REQUEST, OwnerChangeRequestEntity.DISCRIMINATOR_VALUE,
CLIENT_DELETION_REQUEST, ClientDeletionRequestEntity.DISCRIMINATOR_VALUE,
AUTH_CERT_DELETION_REQUEST, AuthenticationCertificateDeletionRequestEntity.DISCRIMINATOR_VALUE
AUTH_CERT_DELETION_REQUEST, AuthenticationCertificateDeletionRequestEntity.DISCRIMINATOR_VALUE,
ADDRESS_CHANGE_REQUEST, AddressChangeRequestEntity.DISCRIMINATOR_VALUE
);

public static ManagementRequestType getManagementRequestType(String discriminator) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/*
* The MIT License
* <p>
*
* Copyright (c) 2019- Nordic Institute for Interoperability Solutions (NIIS)
* Copyright (c) 2018 Estonian Information System Authority (RIA),
* Nordic Institute for Interoperability Solutions (NIIS), Population Register Centre (VRK)
* Copyright (c) 2015-2017 Estonian Information System Authority (RIA), Population Register Centre (VRK)
* <p>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* <p>
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* <p>
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand All @@ -24,20 +24,23 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

package org.niis.xroad.cs.admin.core.entity.mapper;


import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants;
import org.niis.xroad.cs.admin.api.converter.GenericUniDirectionalMapper;
import org.niis.xroad.cs.admin.api.domain.AddressChangeRequest;
import org.niis.xroad.cs.admin.api.domain.AuthenticationCertificateDeletionRequest;
import org.niis.xroad.cs.admin.api.domain.AuthenticationCertificateRegistrationRequest;
import org.niis.xroad.cs.admin.api.domain.ClientDeletionRequest;
import org.niis.xroad.cs.admin.api.domain.ClientRegistrationRequest;
import org.niis.xroad.cs.admin.api.domain.OwnerChangeRequest;
import org.niis.xroad.cs.admin.api.domain.Request;
import org.niis.xroad.cs.admin.api.domain.RequestWithProcessing;
import org.niis.xroad.cs.admin.core.entity.AddressChangeRequestEntity;
import org.niis.xroad.cs.admin.core.entity.AuthenticationCertificateDeletionRequestEntity;
import org.niis.xroad.cs.admin.core.entity.AuthenticationCertificateRegistrationRequestEntity;
import org.niis.xroad.cs.admin.core.entity.ClientDeletionRequestEntity;
Expand All @@ -55,14 +58,17 @@ default Request toTarget(RequestEntity source) {
if (source == null) {
return null;
}
if (source instanceof AuthenticationCertificateDeletionRequestEntity) {
return toDto((AuthenticationCertificateDeletionRequestEntity) source);
if (source instanceof AuthenticationCertificateDeletionRequestEntity authenticationCertificateDeletionRequestEntity) {
return toDto(authenticationCertificateDeletionRequestEntity);
}
if (source instanceof ClientDeletionRequestEntity clientDeletionRequestEntity) {
return toDto(clientDeletionRequestEntity);
}
if (source instanceof ClientDeletionRequestEntity) {
return toDto((ClientDeletionRequestEntity) source);
if (source instanceof AddressChangeRequestEntity addressChangeRequestEntity) {
return toDto(addressChangeRequestEntity);
}
if (source instanceof RequestWithProcessingEntity) {
return toTarget((RequestWithProcessingEntity) source);
if (source instanceof RequestWithProcessingEntity requestWithProcessingEntity) {
return toTarget(requestWithProcessingEntity);
}

throw new IllegalArgumentException("Cannot map " + source.getClass());
Expand All @@ -73,14 +79,14 @@ default RequestWithProcessing toTarget(RequestWithProcessingEntity source) {
return null;
}

if (source instanceof AuthenticationCertificateRegistrationRequestEntity) {
return toDto((AuthenticationCertificateRegistrationRequestEntity) source);
if (source instanceof AuthenticationCertificateRegistrationRequestEntity authenticationCertificateRegistrationRequestEntity) {
return toDto(authenticationCertificateRegistrationRequestEntity);
}
if (source instanceof ClientRegistrationRequestEntity) {
return toDto((ClientRegistrationRequestEntity) source);
if (source instanceof ClientRegistrationRequestEntity clientRegistrationRequestEntity) {
return toDto(clientRegistrationRequestEntity);
}
if (source instanceof OwnerChangeRequestEntity) {
return toDto((OwnerChangeRequestEntity) source);
if (source instanceof OwnerChangeRequestEntity ownerChangeRequestEntity) {
return toDto(ownerChangeRequestEntity);
}

throw new IllegalArgumentException("Cannot map " + source.getClass());
Expand All @@ -99,4 +105,7 @@ default RequestWithProcessing toTarget(RequestWithProcessingEntity source) {
@Mapping(target = "processingStatus", source = "requestProcessing.status")
OwnerChangeRequest toDto(OwnerChangeRequestEntity source);

@Mapping(target = "serverAddress", source = "address")
AddressChangeRequest toDto(AddressChangeRequestEntity source);

}
Loading

0 comments on commit 2862b48

Please sign in to comment.