From dc5e2da6a255eb2173f4d1016a0d9ee265bc9cfe Mon Sep 17 00:00:00 2001 From: Tomasz Gruszewski Date: Wed, 11 Mar 2026 13:00:10 +0100 Subject: [PATCH 1/4] App2App additional service implementation (#39) * App2App additional service -rest and cli initial implementation * App2App additional service -soap implementation * App2App additional service SignatureRequest model enhancements, refactoring and code quality checks --- docs/use-the-client-via-cli.md | 22 ++ .../client/config/DefaultConfiguration.java | 1 + .../ch/swisscom/mid/client/impl/Loggers.java | 2 + .../ch/swisscom/mid/client/model/App2App.java | 38 ++ .../mid/client/model/SignatureRequest.java | 50 +-- .../{ => service}/AdditionalService.java | 110 +++--- .../service/App2AppAdditionalService.java | 62 ++++ .../App2AppAdditionalServiceResponse.java | 52 +++ .../GeofencingAdditionalService.java | 222 +++++------ .../GeofencingAdditionalServiceResponse.java | 264 +++++++------- .../SignatureValidationAdditionalService.java | 70 ++-- .../UserLangAdditionalService.java | 85 +++-- .../rest/SignatureRequestModelUtils.java | 77 ++-- .../client/rest/StatusQueryModelUtils.java | 39 +- .../signreq/AdditionalServiceApp2App.java | 46 +++ .../rest/model/signreq/App2AppRequest.java | 48 +++ .../rest/model/signresp/ServiceResponse.java | 28 +- .../client/rest/model/statusresp/App2App.java | 44 +++ .../model/statusresp/ServiceResponse.java | 39 +- .../mid/client/rest/AsyncSignatureTest.java | 344 +++++++++++++----- .../mid/client/rest/SyncSignatureTest.java | 14 +- ...e-async-signature-app2app-EN-language.json | 43 +++ ...response-async-signature-app2app-only.json | 37 ++ .../rest-response-async-signature.json | 60 +-- .../samples/rest-response-signature.json | 78 ++-- ...nse-status-signature-app2app-language.json | 37 ++ ...est-response-status-signature-app2app.json | 37 ++ .../rest-response-status-signature.json | 80 ++-- .../mid/client/soap/SoapTrafficHandler.java | 25 +- .../soap/adapter/MssRequestBuilder.java | 31 +- .../soap/adapter/MssResponseProcessor.java | 149 ++++---- .../resources/wsdl/schema/ficom/ficom.xsd | 148 ++++---- .../schema/methics/MSS-App2AppAsResponse.xsd | 17 + .../schema/methics/MSS-SubscriberInfo.xsd | 3 +- .../schema/methics/MSS-plus-Mobile-Ink.xsd | 11 +- .../resources/wsdl/schema/w3/soap-rpc.xsd | 33 ++ .../mid/client/soap/AsyncSignatureTest.java | 128 +------ ...p-response-async-signature-app2app-geo.xml | 51 +++ .../soap-response-async-signature-app2app.xml | 40 ++ ...response-status-signature-app2app-only.xml | 41 +++ ...soap-response-status-signature-app2app.xml | 52 +++ ...status-signature-expected-app2app-geo.json | 36 ++ ...tatus-signature-expected-app2app-only.json | 26 ++ .../java/ch/swisscom/mid/client/cli/Cli.java | 81 ++++- .../mid/client/samples/AsyncSignature.java | 12 +- .../mid/client/samples/SyncSignature.java | 2 +- .../samples/SyncSignatureWithReceipt.java | 1 + .../src/main/resources/cli-files/usage.txt | 4 + 48 files changed, 2007 insertions(+), 913 deletions(-) create mode 100644 mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/App2App.java rename mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/{ => service}/AdditionalService.java (62%) create mode 100644 mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/App2AppAdditionalService.java create mode 100644 mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/App2AppAdditionalServiceResponse.java rename mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/{ => service}/GeofencingAdditionalService.java (81%) rename mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/{ => service}/GeofencingAdditionalServiceResponse.java (71%) rename mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/{ => service}/SignatureValidationAdditionalService.java (55%) rename mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/{ => service}/UserLangAdditionalService.java (58%) create mode 100644 mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/model/signreq/AdditionalServiceApp2App.java create mode 100644 mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/model/signreq/App2AppRequest.java create mode 100644 mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/model/statusresp/App2App.java create mode 100644 mid-java-client-rest/src/test/resources/samples/rest-response-async-signature-app2app-EN-language.json create mode 100644 mid-java-client-rest/src/test/resources/samples/rest-response-async-signature-app2app-only.json create mode 100644 mid-java-client-rest/src/test/resources/samples/rest-response-status-signature-app2app-language.json create mode 100644 mid-java-client-rest/src/test/resources/samples/rest-response-status-signature-app2app.json create mode 100644 mid-java-client-soap/src/main/resources/wsdl/schema/methics/MSS-App2AppAsResponse.xsd create mode 100644 mid-java-client-soap/src/main/resources/wsdl/schema/w3/soap-rpc.xsd create mode 100644 mid-java-client-soap/src/test/resources/samples/soap-response-async-signature-app2app-geo.xml create mode 100644 mid-java-client-soap/src/test/resources/samples/soap-response-async-signature-app2app.xml create mode 100644 mid-java-client-soap/src/test/resources/samples/soap-response-status-signature-app2app-only.xml create mode 100644 mid-java-client-soap/src/test/resources/samples/soap-response-status-signature-app2app.xml create mode 100644 mid-java-client-soap/src/test/resources/samples/soap-response-status-signature-expected-app2app-geo.json create mode 100644 mid-java-client-soap/src/test/resources/samples/soap-response-status-signature-expected-app2app-only.json diff --git a/docs/use-the-client-via-cli.md b/docs/use-the-client-via-cli.md index 540dac5..dbe7596 100644 --- a/docs/use-the-client-via-cli.md +++ b/docs/use-the-client-via-cli.md @@ -42,6 +42,9 @@ Arguments: -receipt - For sign operation. Send a receipt after the signature is acquired successfully -geofencing - For sign operation. Request additional geofencing data + + -app2app="myapp://example" - For sign operation (async only). Request App2App service which allows an Application Provider to automatically switch from + their App to the Mobile ID App (and the Mobile ID App to automatically switch back to the originating App) -validate - For sign operation. Validate the signature once it is successfully acquired @@ -78,6 +81,7 @@ Use cases: - ./bin/mid-client.sh -profile-query -msisdn=41790000000 -soap - ./bin/mid-client.sh -sign -receipt -msisdn=41790000000 -lang=en -dtbs="Do you want to login?" -req-timeout=120 - ./bin/mid-client.sh -sign -sync -receipt -msisdn=41790000000 -lang=en -dtbs="Do you want to login?" -soap -vv + - ./bin/mid-client.sh -sign -async -msisdn=41790000000 -lang=en -app2app="myapp://example" -dtbs="Do you want to login?" -rest -vv - ./bin/mid-client.sh \ -config=my-config.properties \ -sign -sync -receipt -geofencing \ @@ -95,46 +99,64 @@ Use the _-v_, _-vv_ and _-vvv_ arguments for increasingly detailed log levels, i exchanged packets. ## Examples + Start with a fresh set of configuration files: + ```shell ./bin/mid-client.sh -init ``` Get the profile information for a particular phone number (MSISDN) that your application provider is controlling: + ```shell ./bin/mid-client.sh -profile-query -msisdn 41790000000 ``` Get the same profile information using a particular configuration file and the SOAP interface of Mobile ID: + ```shell ./bin/mid-client.sh -profile-query -msisdn 41790000000 -config local-config.properties -soap ``` Request a digital signature to a particular phone number (MSISDN), in sync mode: + ```shell ./bin/mid-client.sh -sign -msisdn=41790000000 -geofencing -lang=en -dtbs "Do you want to login?" -sync ``` Request a digital signature to a particular phone number (MSISDN), in async mode (this is the default mode) and with signature receipt: + ```shell ./bin/mid-client.sh -sign -msisdn=41790000000 -lang=en -dtbs "Do you want to login?" -receipt -req-timeout 120 ``` +Request a digital signature to a particular phone number (MSISDN), in async mode (this is the default mode) and with app2app service: + +```shell +./bin/mid-client.sh -sign -msisdn=41790000000 -lang=en -app2app="myapp://example" -req-timeout 120 +``` + Request a Mobile ID Serial number based on particular phone number (MSISDN), in async mode: + ```shell ./bin/mid-client.sh -get-mid-sn -msisdn=41790000000 -rest ``` Note: when working with arguments that have values (such as _-msisdn_) you can pass the value either as the next argument: + ```shell ./bin/mid-client.sh -sign -msisdn 41790000000 ``` + or in the form _name=value_: + ```shell ./bin/mid-client.sh -sign -msisdn=41790000000 ``` + Please note that the _-dtbs_ argument is a bit more special, as it will most likely contain spaces, so either the entire name=value construct is enclosed in double quotes or, if you use the namevalue form, then the value is enclosed in double quotes: + ```shell ./bin/mid-client.sh -sign -msisdn=41790000000 -dtbs "Do you want to login?" ./bin/mid-client.sh -sign -msisdn=41790000000 "-dtbs=Do you want to login?" diff --git a/mid-java-client-core/src/main/java/ch/swisscom/mid/client/config/DefaultConfiguration.java b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/config/DefaultConfiguration.java index dbb78fc..554ea7e 100644 --- a/mid-java-client-core/src/main/java/ch/swisscom/mid/client/config/DefaultConfiguration.java +++ b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/config/DefaultConfiguration.java @@ -32,6 +32,7 @@ public class DefaultConfiguration { public static final String ADDITIONAL_SERVICE_USER_LANG_URI = "http://mss.ficom.fi/TS102204/v1.0.0#userLang"; public static final String ADDITIONAL_SERVICE_SIGNATURE_VALIDATION_URI = "http://uri.etsi.org/TS102204/v1.1.2#validate"; public static final String ADDITIONAL_SERVICE_GEOFENCING = "http://mid.swisscom.ch/as#geofencing"; + public static final String ADDITIONAL_SERVICE_APP2APP = "http://mid.swisscom.ch/as#app2app"; public static final String SIGNATURE_REQUEST_MAJOR_VERSION = "1"; public static final String SIGNATURE_REQUEST_MINOR_VERSION = "2"; diff --git a/mid-java-client-core/src/main/java/ch/swisscom/mid/client/impl/Loggers.java b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/impl/Loggers.java index adb68a8..bacbaa9 100644 --- a/mid-java-client-core/src/main/java/ch/swisscom/mid/client/impl/Loggers.java +++ b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/impl/Loggers.java @@ -29,6 +29,8 @@ public class Loggers { public static final String REQUEST_RESPONSE = "ch.swisscom.mid.client.requestResponse"; public static final String FULL_REQUEST_RESPONSE = "ch.swisscom.mid.client.fullRequestResponse"; public static final String SIGNATURE_VALIDATOR = "ch.swisscom.mid.signatureValidator"; + public static final String STATUS_QUERY_MODEL_UTILS = "ch.swisscom.mid.client.rest.statusQueryModelUtils"; + public static final String SIGN_REQ_MODEL_UTILS = "ch.swisscom.mid.client.rest.signatureRequestModelUtils"; // ---------------------------------------------------------------------------------------------------- diff --git a/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/App2App.java b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/App2App.java new file mode 100644 index 0000000..b1a6f09 --- /dev/null +++ b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/App2App.java @@ -0,0 +1,38 @@ +/* + * + * * Copyright 2021-2026 Swisscom (Schweiz) AG + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package ch.swisscom.mid.client.model; + +public class App2App { + private String redirectUri; + + public String getRedirectUri() { + return redirectUri; + } + + public void setRedirectUri(String redirectUri) { + this.redirectUri = redirectUri; + } + + @Override + public String toString() { + return "App2App{" + + "redirectUri='" + redirectUri + '\'' + + '}'; + } +} diff --git a/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/SignatureRequest.java b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/SignatureRequest.java index a7998db..4680393 100644 --- a/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/SignatureRequest.java +++ b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/SignatureRequest.java @@ -15,15 +15,15 @@ */ package ch.swisscom.mid.client.model; -import java.util.ArrayList; -import java.util.List; - import ch.swisscom.mid.client.config.DefaultConfiguration; import ch.swisscom.mid.client.config.TrafficObserver; +import ch.swisscom.mid.client.model.service.AdditionalService; +import ch.swisscom.mid.client.model.service.UserLangAdditionalService; -import static ch.swisscom.mid.client.utils.Utils.dataNotEmpty; -import static ch.swisscom.mid.client.utils.Utils.dataNotNull; -import static ch.swisscom.mid.client.utils.Utils.dataTrue; +import java.util.ArrayList; +import java.util.List; + +import static ch.swisscom.mid.client.utils.Utils.*; public class SignatureRequest { @@ -35,7 +35,7 @@ public class SignatureRequest { * If this is not set then the ID from {@link ch.swisscom.mid.client.config.ClientConfiguration} is used. */ private String overrideApId; - + /** * Optional custom AP password that will override the AP password configured via {@link ch.swisscom.mid.client.config.ClientConfiguration}. * If this is not set then the password from {@link ch.swisscom.mid.client.config.ClientConfiguration} is used. @@ -152,22 +152,22 @@ public void validateYourself() { dataNotEmpty(majorVersion, "The major version cannot be null or empty (see DefaultConfiguration for default values)"); dataNotEmpty(minorVersion, "The minor version cannot be null or empty (see DefaultConfiguration for default values)"); dataNotEmpty(additionalServices, "Invalid signature request configuration. " + - "At least the UserLang additional service needs to be configured (call setUserLanguage)."); + "At least the UserLang additional service needs to be configured (call setUserLanguage)."); dataNotNull(dataToBeSigned, "The data to be signed cannot be null (call setDataToBeSigned)"); dataToBeSigned.validateYourself(); dataNotNull(mobileUser, "The target mobile user cannot be null"); mobileUser.validateYourself(); dataNotEmpty(signatureProfile, "The signature profile cannot be null or empty. See " + - SignatureProfiles.class.getSimpleName() + - " for a list of possible profiles to choose from"); + SignatureProfiles.class.getSimpleName() + + " for a list of possible profiles to choose from"); dataTrue(userResponseTimeOutInSeconds >= DefaultConfiguration.SIGNATURE_MINIMUM_TIME_OUT_IN_SECONDS, - "The user response timeout cannot be lower than " + - DefaultConfiguration.SIGNATURE_MINIMUM_TIME_OUT_IN_SECONDS + - " seconds"); + "The user response timeout cannot be lower than " + + DefaultConfiguration.SIGNATURE_MINIMUM_TIME_OUT_IN_SECONDS + + " seconds"); dataTrue(userResponseTimeOutInSeconds <= DefaultConfiguration.SIGNATURE_MAXIMUM_TIME_OUT_IN_SECONDS, - "The user response timeout cannot be higher than " + - DefaultConfiguration.SIGNATURE_MAXIMUM_TIME_OUT_IN_SECONDS + - " seconds"); + "The user response timeout cannot be higher than " + + DefaultConfiguration.SIGNATURE_MAXIMUM_TIME_OUT_IN_SECONDS + + " seconds"); } // ---------------------------------------------------------------------------------------------------- @@ -177,14 +177,14 @@ public void validateYourself() { @Override public String toString() { return "SignatureRequest{" + - "majorVersion='" + majorVersion + '\'' + - ", minorVersion='" + minorVersion + '\'' + - ", additionalServices=" + additionalServices + - ", dataToBeSigned=" + dataToBeSigned + - ", mobileUser=" + mobileUser + - ", userResponseTimeOutInSeconds=" + userResponseTimeOutInSeconds + - ", signatureProfile='" + signatureProfile + '\'' + - ", trafficObserver=" + trafficObserver + - '}'; + "majorVersion='" + majorVersion + '\'' + + ", minorVersion='" + minorVersion + '\'' + + ", additionalServices=" + additionalServices + + ", dataToBeSigned=" + dataToBeSigned + + ", mobileUser=" + mobileUser + + ", userResponseTimeOutInSeconds=" + userResponseTimeOutInSeconds + + ", signatureProfile='" + signatureProfile + '\'' + + ", trafficObserver=" + trafficObserver + + '}'; } } diff --git a/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/AdditionalService.java b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/AdditionalService.java similarity index 62% rename from mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/AdditionalService.java rename to mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/AdditionalService.java index af918e3..5872a49 100644 --- a/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/AdditionalService.java +++ b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/AdditionalService.java @@ -1,45 +1,65 @@ -/* - * Copyright 2021 Swisscom (Schweiz) AG - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package ch.swisscom.mid.client.model; - -/** - * Base class for requesting additional services via requests to the Mobile ID service. You can either make an instance of this class - * and set the URI by yourself, or use one of the provided subclasses. There is also a corresponding {@link AdditionalServiceResponse} - * that contains, as expected, the data that is returned as part of the requested additional service payload. - * - * @see UserLangAdditionalService - * @see SignatureValidationAdditionalService - * @see GeofencingAdditionalService - */ -public class AdditionalService { - - private final String uri; - - public AdditionalService(String uri) { - this.uri = uri; - } - - public String getUri() { - return uri; - } - - @Override - public String toString() { - return "AdditionalService{" + - "uri='" + uri + '\'' + - '}'; - } -} +/* + * + * * Copyright 2021-2026 Swisscom (Schweiz) AG + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +/* + * Copyright 2021 Swisscom (Schweiz) AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ch.swisscom.mid.client.model.service; + +import ch.swisscom.mid.client.model.AdditionalServiceResponse; + +/** + * Base class for requesting additional services via requests to the Mobile ID service. You can either make an instance of this class + * and set the URI by yourself, or use one of the provided subclasses. There is also a corresponding {@link AdditionalServiceResponse} + * that contains, as expected, the data that is returned as part of the requested additional service payload. + * + * @see UserLangAdditionalService + * @see SignatureValidationAdditionalService + * @see GeofencingAdditionalService + */ +public class AdditionalService { + + private final String uri; + + public AdditionalService(String uri) { + this.uri = uri; + } + + public String getUri() { + return uri; + } + + @Override + public String toString() { + return "AdditionalService{" + + "uri='" + uri + '\'' + + '}'; + } +} diff --git a/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/App2AppAdditionalService.java b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/App2AppAdditionalService.java new file mode 100644 index 0000000..1f31ce4 --- /dev/null +++ b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/App2AppAdditionalService.java @@ -0,0 +1,62 @@ +/* + * + * * Copyright 2021-2026 Swisscom (Schweiz) AG + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +/* + * Copyright 2021 Swisscom (Schweiz) AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ch.swisscom.mid.client.model.service; + +import ch.swisscom.mid.client.config.DefaultConfiguration; +import ch.swisscom.mid.client.model.App2App; + +public class App2AppAdditionalService extends AdditionalService { + + private App2App app2app; + + public App2AppAdditionalService() { + super(DefaultConfiguration.ADDITIONAL_SERVICE_APP2APP); + + } + + public App2AppAdditionalService(String redirectUri) { + super(DefaultConfiguration.ADDITIONAL_SERVICE_APP2APP); + this.app2app = new App2App(); + this.app2app.setRedirectUri(redirectUri); + + } + + public App2App getApp2app() { + return app2app; + } + + public void setApp2app(App2App app2app) { + this.app2app = app2app; + } +} diff --git a/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/App2AppAdditionalServiceResponse.java b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/App2AppAdditionalServiceResponse.java new file mode 100644 index 0000000..1893383 --- /dev/null +++ b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/App2AppAdditionalServiceResponse.java @@ -0,0 +1,52 @@ +/* + * + * * Copyright 2021-2026 Swisscom (Schweiz) AG + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package ch.swisscom.mid.client.model.service; + +import ch.swisscom.mid.client.config.DefaultConfiguration; +import ch.swisscom.mid.client.model.AdditionalServiceResponse; + +/** + * The information returned when the App2App additional service is requested to Mobile ID. + */ +public class App2AppAdditionalServiceResponse extends AdditionalServiceResponse { + + /** + * The URI to which the user should be redirected to start the authentication process in the Mobile ID app. + */ + private String authUri; + + public App2AppAdditionalServiceResponse() { + super(DefaultConfiguration.ADDITIONAL_SERVICE_APP2APP); + } + + public String getAuthUri() { + return authUri; + } + + public void setAuthUri(String authUri) { + this.authUri = authUri; + } + + @Override + public String toString() { + return "App2AppAdditionalServiceResponse{" + + "authUri='" + authUri + '\'' + + '}' + super.toString(); + } +} diff --git a/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/GeofencingAdditionalService.java b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/GeofencingAdditionalService.java similarity index 81% rename from mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/GeofencingAdditionalService.java rename to mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/GeofencingAdditionalService.java index 1bcca15..68e9769 100644 --- a/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/GeofencingAdditionalService.java +++ b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/GeofencingAdditionalService.java @@ -1,102 +1,120 @@ -/* - * Copyright 2021-2025 Swisscom (Schweiz) AG - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package ch.swisscom.mid.client.model; - -import ch.swisscom.mid.client.config.DefaultConfiguration; - -import java.util.ArrayList; -import java.util.List; - -/** - * Specific class to use when requesting the Geofencing additional service to Mobile ID. Please also see the - * {@link GeofencingAdditionalServiceResponse} class for the content that is returned from Mobile ID when this additional service - * is requested. - */ -public class GeofencingAdditionalService extends AdditionalService { - - public GeofencingAdditionalService() { - super(DefaultConfiguration.ADDITIONAL_SERVICE_GEOFENCING); - } - - private List countryWhiteList = new ArrayList<>(); - private List countryBlackList = new ArrayList<>(); - private String minDeviceConfidence; - private String minLocationConfidence; - private String maxTimestampMinutes; - private String maxAccuracyMeters; - - public List getCountryWhiteList() { - return countryWhiteList; - } - - public void setCountryWhiteList(List countryWhiteList) { - this.countryWhiteList = countryWhiteList; - } - - public List getCountryBlackList() { - return countryBlackList; - } - - public void setCountryBlackList(List countryBlackList) { - this.countryBlackList = countryBlackList; - } - - public String getMinDeviceConfidence() { - return minDeviceConfidence; - } - - public void setMinDeviceConfidence(String minDeviceConfidence) { - this.minDeviceConfidence = minDeviceConfidence; - } - - public String getMinLocationConfidence() { - return minLocationConfidence; - } - - public void setMinLocationConfidence(String minLocationConfidence) { - this.minLocationConfidence = minLocationConfidence; - } - - public String getMaxTimestampMinutes() { - return maxTimestampMinutes; - } - - public void setMaxTimestampMinutes(String maxTimestampMinutes) { - this.maxTimestampMinutes = maxTimestampMinutes; - } - - public String getMaxAccuracyMeters() { - return maxAccuracyMeters; - } - - public void setMaxAccuracyMeters(String maxAccuracyMeters) { - this.maxAccuracyMeters = maxAccuracyMeters; - } - - - public boolean isDefined() { - if (countryWhiteList != null && !countryWhiteList.isEmpty()) return true; - if (countryBlackList != null && !countryBlackList.isEmpty()) return true; - if (minDeviceConfidence != null && !minDeviceConfidence.isEmpty() && !minDeviceConfidence.equalsIgnoreCase("0")) - return true; - if (minLocationConfidence != null && !minLocationConfidence.isEmpty() && !minLocationConfidence.equalsIgnoreCase("0")) - return true; - if (maxAccuracyMeters != null && !maxAccuracyMeters.isEmpty()) return true; - if (maxTimestampMinutes != null && !maxTimestampMinutes.isEmpty()) return true; - return false; - } -} - +/* + * + * * Copyright 2021-2026 Swisscom (Schweiz) AG + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +/* + * Copyright 2021-2025 Swisscom (Schweiz) AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ch.swisscom.mid.client.model.service; + +import ch.swisscom.mid.client.config.DefaultConfiguration; + +import java.util.ArrayList; +import java.util.List; + +/** + * Specific class to use when requesting the Geofencing additional service to Mobile ID. Please also see the + * {@link GeofencingAdditionalServiceResponse} class for the content that is returned from Mobile ID when this additional service + * is requested. + */ +public class GeofencingAdditionalService extends AdditionalService { + + public GeofencingAdditionalService() { + super(DefaultConfiguration.ADDITIONAL_SERVICE_GEOFENCING); + } + + private List countryWhiteList = new ArrayList<>(); + private List countryBlackList = new ArrayList<>(); + private String minDeviceConfidence; + private String minLocationConfidence; + private String maxTimestampMinutes; + private String maxAccuracyMeters; + + public List getCountryWhiteList() { + return countryWhiteList; + } + + public void setCountryWhiteList(List countryWhiteList) { + this.countryWhiteList = countryWhiteList; + } + + public List getCountryBlackList() { + return countryBlackList; + } + + public void setCountryBlackList(List countryBlackList) { + this.countryBlackList = countryBlackList; + } + + public String getMinDeviceConfidence() { + return minDeviceConfidence; + } + + public void setMinDeviceConfidence(String minDeviceConfidence) { + this.minDeviceConfidence = minDeviceConfidence; + } + + public String getMinLocationConfidence() { + return minLocationConfidence; + } + + public void setMinLocationConfidence(String minLocationConfidence) { + this.minLocationConfidence = minLocationConfidence; + } + + public String getMaxTimestampMinutes() { + return maxTimestampMinutes; + } + + public void setMaxTimestampMinutes(String maxTimestampMinutes) { + this.maxTimestampMinutes = maxTimestampMinutes; + } + + public String getMaxAccuracyMeters() { + return maxAccuracyMeters; + } + + public void setMaxAccuracyMeters(String maxAccuracyMeters) { + this.maxAccuracyMeters = maxAccuracyMeters; + } + + + public boolean isDefined() { + if (countryWhiteList != null && !countryWhiteList.isEmpty()) return true; + if (countryBlackList != null && !countryBlackList.isEmpty()) return true; + if (minDeviceConfidence != null && !minDeviceConfidence.isEmpty() && !minDeviceConfidence.equalsIgnoreCase("0")) + return true; + if (minLocationConfidence != null && !minLocationConfidence.isEmpty() && !minLocationConfidence.equalsIgnoreCase("0")) + return true; + if (maxAccuracyMeters != null && !maxAccuracyMeters.isEmpty()) return true; + + return maxTimestampMinutes != null && !maxTimestampMinutes.isEmpty(); + } +} + diff --git a/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/GeofencingAdditionalServiceResponse.java b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/GeofencingAdditionalServiceResponse.java similarity index 71% rename from mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/GeofencingAdditionalServiceResponse.java rename to mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/GeofencingAdditionalServiceResponse.java index 1251f48..36158d2 100644 --- a/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/GeofencingAdditionalServiceResponse.java +++ b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/GeofencingAdditionalServiceResponse.java @@ -1,122 +1,142 @@ -package ch.swisscom.mid.client.model; - -import ch.swisscom.mid.client.config.DefaultConfiguration; - -/** - * The information returned when the Geofencing additional service is requested to Mobile ID. - */ -public class GeofencingAdditionalServiceResponse extends AdditionalServiceResponse { - - /** - * The error code that might be returned if the Geofencing service failed to gather requested data. If this field - * is null, things are OK. See {@link GeofencingErrorCode}. - */ - private GeofencingErrorCode errorCode; - - /** - * The error message description. This this is null and if also {@link #errorCode} is null, things are OK. - */ - private String errorMessage; - - /** - * Current device location as a two-letter code country code (ISO-3166-1 alpha-2). - */ - private String country; - - /** - * Location data accuracy, in meters. - */ - private int accuracy; - - /** - * Location acquiring timestamp (formatting of "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"). - */ - private String timestamp; - - /** - * Floating point value of the confidence in the security of the used device (e.g. jailbroken devices vs normal secured devices). - * Values range from 0 (means location data is very likely from a rooted or jailbroken device) to 1 (no abnormalities found in relation - * to rooted or jailbroken devices). - */ - private String deviceConfidence; - - /** - * Floating point value of the confidence in the location acquiring quality. Values range from 0 (= location data is very likely falsified) - * to 1 (no abnormalities found in relation to falsified data). - */ - private String locationConfidence; - - public GeofencingAdditionalServiceResponse() { - super(DefaultConfiguration.ADDITIONAL_SERVICE_GEOFENCING); - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - - public int getAccuracy() { - return accuracy; - } - - public void setAccuracy(int accuracy) { - this.accuracy = accuracy; - } - - public String getTimestamp() { - return timestamp; - } - - public void setTimestamp(String timestamp) { - this.timestamp = timestamp; - } - - public String getDeviceConfidence() { - return deviceConfidence; - } - - public void setDeviceConfidence(String deviceConfidence) { - this.deviceConfidence = deviceConfidence; - } - - public String getLocationConfidence() { - return locationConfidence; - } - - public void setLocationConfidence(String locationConfidence) { - this.locationConfidence = locationConfidence; - } - - public GeofencingErrorCode getErrorCode() { - return errorCode; - } - - public void setErrorCode(GeofencingErrorCode errorCode) { - this.errorCode = errorCode; - } - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - @Override - public String toString() { - return "GeofencingAdditionalServiceResponse{" + - "errorCode=" + errorCode + - ", errorMessage='" + errorMessage + '\'' + - ", country='" + country + '\'' + - ", accuracy=" + accuracy + - ", timestamp='" + timestamp + '\'' + - ", deviceConfidence='" + deviceConfidence + '\'' + - ", locationConfidence='" + locationConfidence + '\'' + - "} " + super.toString(); - } - -} +/* + * + * * Copyright 2021-2026 Swisscom (Schweiz) AG + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package ch.swisscom.mid.client.model.service; + +import ch.swisscom.mid.client.config.DefaultConfiguration; +import ch.swisscom.mid.client.model.AdditionalServiceResponse; +import ch.swisscom.mid.client.model.GeofencingErrorCode; + +/** + * The information returned when the Geofencing additional service is requested to Mobile ID. + */ +public class GeofencingAdditionalServiceResponse extends AdditionalServiceResponse { + + /** + * The error code that might be returned if the Geofencing service failed to gather requested data. If this field + * is null, things are OK. See {@link GeofencingErrorCode}. + */ + private GeofencingErrorCode errorCode; + + /** + * The error message description. This this is null and if also {@link #errorCode} is null, things are OK. + */ + private String errorMessage; + + /** + * Current device location as a two-letter code country code (ISO-3166-1 alpha-2). + */ + private String country; + + /** + * Location data accuracy, in meters. + */ + private int accuracy; + + /** + * Location acquiring timestamp (formatting of "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"). + */ + private String timestamp; + + /** + * Floating point value of the confidence in the security of the used device (e.g. jailbroken devices vs normal secured devices). + * Values range from 0 (means location data is very likely from a rooted or jailbroken device) to 1 (no abnormalities found in relation + * to rooted or jailbroken devices). + */ + private String deviceConfidence; + + /** + * Floating point value of the confidence in the location acquiring quality. Values range from 0 (= location data is very likely falsified) + * to 1 (no abnormalities found in relation to falsified data). + */ + private String locationConfidence; + + public GeofencingAdditionalServiceResponse() { + super(DefaultConfiguration.ADDITIONAL_SERVICE_GEOFENCING); + } + + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country; + } + + public int getAccuracy() { + return accuracy; + } + + public void setAccuracy(int accuracy) { + this.accuracy = accuracy; + } + + public String getTimestamp() { + return timestamp; + } + + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } + + public String getDeviceConfidence() { + return deviceConfidence; + } + + public void setDeviceConfidence(String deviceConfidence) { + this.deviceConfidence = deviceConfidence; + } + + public String getLocationConfidence() { + return locationConfidence; + } + + public void setLocationConfidence(String locationConfidence) { + this.locationConfidence = locationConfidence; + } + + public GeofencingErrorCode getErrorCode() { + return errorCode; + } + + public void setErrorCode(GeofencingErrorCode errorCode) { + this.errorCode = errorCode; + } + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + @Override + public String toString() { + return "GeofencingAdditionalServiceResponse{" + + "errorCode=" + errorCode + + ", errorMessage='" + errorMessage + '\'' + + ", country='" + country + '\'' + + ", accuracy=" + accuracy + + ", timestamp='" + timestamp + '\'' + + ", deviceConfidence='" + deviceConfidence + '\'' + + ", locationConfidence='" + locationConfidence + '\'' + + "} " + super.toString(); + } + +} diff --git a/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/SignatureValidationAdditionalService.java b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/SignatureValidationAdditionalService.java similarity index 55% rename from mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/SignatureValidationAdditionalService.java rename to mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/SignatureValidationAdditionalService.java index cdbb74e..24ff558 100644 --- a/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/SignatureValidationAdditionalService.java +++ b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/SignatureValidationAdditionalService.java @@ -1,26 +1,44 @@ -/* - * Copyright 2021 Swisscom (Schweiz) AG - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package ch.swisscom.mid.client.model; - -import ch.swisscom.mid.client.config.DefaultConfiguration; - -public class SignatureValidationAdditionalService extends AdditionalService { - - public SignatureValidationAdditionalService() { - super(DefaultConfiguration.ADDITIONAL_SERVICE_SIGNATURE_VALIDATION_URI); - } - -} +/* + * + * * Copyright 2021-2026 Swisscom (Schweiz) AG + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +/* + * Copyright 2021 Swisscom (Schweiz) AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ch.swisscom.mid.client.model.service; + +import ch.swisscom.mid.client.config.DefaultConfiguration; + +public class SignatureValidationAdditionalService extends AdditionalService { + + public SignatureValidationAdditionalService() { + super(DefaultConfiguration.ADDITIONAL_SERVICE_SIGNATURE_VALIDATION_URI); + } + +} diff --git a/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/UserLangAdditionalService.java b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/UserLangAdditionalService.java similarity index 58% rename from mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/UserLangAdditionalService.java rename to mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/UserLangAdditionalService.java index e784a36..621e284 100644 --- a/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/UserLangAdditionalService.java +++ b/mid-java-client-core/src/main/java/ch/swisscom/mid/client/model/service/UserLangAdditionalService.java @@ -1,33 +1,52 @@ -/* - * Copyright 2021 Swisscom (Schweiz) AG - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package ch.swisscom.mid.client.model; - -import ch.swisscom.mid.client.config.DefaultConfiguration; - -public class UserLangAdditionalService extends AdditionalService { - - private final UserLanguage userLanguage; - - public UserLangAdditionalService(UserLanguage userLanguage) { - super(DefaultConfiguration.ADDITIONAL_SERVICE_USER_LANG_URI); - this.userLanguage = userLanguage; - } - - public UserLanguage getUserLanguage() { - return userLanguage; - } - -} +/* + * + * * Copyright 2021-2026 Swisscom (Schweiz) AG + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +/* + * Copyright 2021 Swisscom (Schweiz) AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ch.swisscom.mid.client.model.service; + +import ch.swisscom.mid.client.config.DefaultConfiguration; +import ch.swisscom.mid.client.model.UserLanguage; + +public class UserLangAdditionalService extends AdditionalService { + + private final UserLanguage userLanguage; + + public UserLangAdditionalService(UserLanguage userLanguage) { + super(DefaultConfiguration.ADDITIONAL_SERVICE_USER_LANG_URI); + this.userLanguage = userLanguage; + } + + public UserLanguage getUserLanguage() { + return userLanguage; + } + +} diff --git a/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/SignatureRequestModelUtils.java b/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/SignatureRequestModelUtils.java index de2c021..5d32c09 100644 --- a/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/SignatureRequestModelUtils.java +++ b/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/SignatureRequestModelUtils.java @@ -15,28 +15,34 @@ */ package ch.swisscom.mid.client.rest; -import java.util.ArrayList; -import java.util.List; - import ch.swisscom.mid.client.MIDFlowException; import ch.swisscom.mid.client.config.ClientConfiguration; import ch.swisscom.mid.client.config.DefaultConfiguration; import ch.swisscom.mid.client.config.TrafficObserver; +import ch.swisscom.mid.client.impl.Loggers; import ch.swisscom.mid.client.model.*; +import ch.swisscom.mid.client.model.Status; +import ch.swisscom.mid.client.model.StatusCode; +import ch.swisscom.mid.client.model.service.*; +import ch.swisscom.mid.client.rest.model.signreq.*; +import ch.swisscom.mid.client.rest.model.signreq.APInfo; import ch.swisscom.mid.client.rest.model.signreq.AdditionalService; import ch.swisscom.mid.client.rest.model.signreq.DataToBeSigned; +import ch.swisscom.mid.client.rest.model.signreq.MSSPInfo; import ch.swisscom.mid.client.rest.model.signreq.MobileUser; -import ch.swisscom.mid.client.rest.model.signreq.*; -import ch.swisscom.mid.client.rest.model.signresp.Geofencing; -import ch.swisscom.mid.client.rest.model.signresp.MSSSignature; -import ch.swisscom.mid.client.rest.model.signresp.MSSSignatureResp; -import ch.swisscom.mid.client.rest.model.signresp.MSSSignatureResponse; -import ch.swisscom.mid.client.rest.model.signresp.ServiceResponse; +import ch.swisscom.mid.client.rest.model.signreq.MsspId; +import ch.swisscom.mid.client.rest.model.signresp.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; import static ch.swisscom.mid.client.utils.Utils.generateInstantAsString; import static ch.swisscom.mid.client.utils.Utils.generateTransId; public class SignatureRequestModelUtils { + private static final Logger log = LoggerFactory.getLogger(Loggers.SIGN_REQ_MODEL_UTILS); public static MSSSignatureRequest createSignatureRequest(ClientConfiguration config, SignatureRequest clientRequest, @@ -49,8 +55,8 @@ public static MSSSignatureRequest createSignatureRequest(ClientConfiguration con signatureReq.setMajorVersion(clientRequest.getMajorVersion()); signatureReq.setMinorVersion(clientRequest.getMinorVersion()); signatureReq.setMessagingMode(sync ? - DefaultConfiguration.SIGNATURE_MODE_SYNC : - DefaultConfiguration.SIGNATURE_MODE_ASYNC); + DefaultConfiguration.SIGNATURE_MODE_SYNC : + DefaultConfiguration.SIGNATURE_MODE_ASYNC); signatureReq.setMobileUser(createMobileUser(clientRequest)); signatureReq.setSignatureProfile(clientRequest.getSignatureProfile()); signatureReq.setTimeOut(String.valueOf(clientRequest.getUserResponseTimeOutInSeconds())); @@ -75,9 +81,9 @@ public static SignatureResponse processSignatureResponse(MSSSignatureResponse re result.setAdditionalServiceResponses(processAdditionalServiceResponses(response)); } else { throw new MIDFlowException("Invalid MSS response received. " + - "Cannot parse it and convert it to a valid " + - SignatureResponse.class.getSimpleName(), - new FaultProcessor().processFailure(FailureReason.MID_INVALID_RESPONSE_FAILURE)); + "Cannot parse it and convert it to a valid " + + SignatureResponse.class.getSimpleName(), + new FaultProcessor().processFailure(FailureReason.MID_INVALID_RESPONSE_FAILURE)); } return result; } @@ -97,9 +103,9 @@ public static SignatureTracking createSignatureTracking(MSSSignatureResponse res return result; } else { throw new MIDFlowException("Invalid MSS response received. " + - "Cannot parse it and convert it to a valid " + - SignatureTracking.class.getSimpleName(), - new FaultProcessor().processFailure(FailureReason.MID_INVALID_RESPONSE_FAILURE)); + "Cannot parse it and convert it to a valid " + + SignatureTracking.class.getSimpleName(), + new FaultProcessor().processFailure(FailureReason.MID_INVALID_RESPONSE_FAILURE)); } } @@ -131,9 +137,9 @@ private static APInfo createApInfo(ClientConfiguration config, String overrideAp private static List createAdditionalServices(SignatureRequest clientRequest) { List processedAdditionalServices = new ArrayList<>(); - List requestedAdditionalService = clientRequest.getAdditionalServices(); - for (ch.swisscom.mid.client.model.AdditionalService currentAS : requestedAdditionalService) { - AdditionalService additionalService = null; + List requestedAdditionalService = clientRequest.getAdditionalServices(); + for (ch.swisscom.mid.client.model.service.AdditionalService currentAS : requestedAdditionalService) { + AdditionalService additionalService; if (currentAS instanceof UserLangAdditionalService) { AdditionalServiceLanguage additionalServiceLang = new AdditionalServiceLanguage(); UserLang userLang = new UserLang(); @@ -145,8 +151,8 @@ private static List createAdditionalServices(SignatureRequest GeofencingAdditionalService gfc = (GeofencingAdditionalService) currentAS; AdditionalServiceGeofencing asg = new AdditionalServiceGeofencing(); asg.setDescription(currentAS.getUri()); - if(gfc.isDefined()) { - // If any geo-fencing parameter is set, then we need to create a GeoFencingRequest object + if (gfc.isDefined()) { + // If any geofencing parameter is set, then we need to create a GeoFencingRequest object asg.setGeoFencingReqeust(GeoFencingRequest.builder() .countryWhiteList(gfc.getCountryWhiteList()) .countryBlackList(gfc.getCountryBlackList()) @@ -159,9 +165,18 @@ private static List createAdditionalServices(SignatureRequest asg.setGeoFencingReqeust(null); } additionalService = asg; + } else if (currentAS instanceof App2AppAdditionalService) { + final App2AppAdditionalService app2SrvModel = (App2AppAdditionalService) currentAS; + final AdditionalServiceApp2App app2appSignReq = new AdditionalServiceApp2App(); + final App2AppRequest app2appReq = new App2AppRequest(); + app2appReq.setRedirectUri(app2SrvModel.getApp2app().getRedirectUri()); + app2appSignReq.setDescription(currentAS.getUri()); + app2appSignReq.setApp2AppRequest(app2appReq); + additionalService = app2appSignReq; } else { additionalService = new AdditionalService(); additionalService.setDescription(currentAS.getUri()); + } processedAdditionalServices.add(additionalService); } @@ -171,10 +186,13 @@ private static List createAdditionalServices(SignatureRequest private static List processAdditionalServiceResponses(MSSSignatureResp response) { List resultList = new ArrayList<>(); List serviceResponseList = response.getServiceResponses(); + log.debug("processAdditionalServiceResponses has serviceResponseList=[{}]", serviceResponseList); if (serviceResponseList != null) { for (ServiceResponse serviceResponse : serviceResponseList) { + log.debug("Processing service response with description=[{}]", serviceResponse.getDescription()); + if (DefaultConfiguration.ADDITIONAL_SERVICE_GEOFENCING.equals(serviceResponse.getDescription()) - && serviceResponse.getGeofencing() != null) { + && serviceResponse.getGeofencing() != null) { Geofencing geofencing = serviceResponse.getGeofencing(); GeofencingAdditionalServiceResponse geoResponse = new GeofencingAdditionalServiceResponse(); @@ -189,6 +207,19 @@ private static List processAdditionalServiceResponses geoResponse.setErrorMessage(geofencing.getErrorMessage()); } resultList.add(geoResponse); + continue; + } + + if (DefaultConfiguration.ADDITIONAL_SERVICE_APP2APP.equals(serviceResponse.getDescription())) { + + ch.swisscom.mid.client.rest.model.statusresp.App2App app2app = serviceResponse.getApp2app(); + final App2AppAdditionalServiceResponse a2aResponse = new App2AppAdditionalServiceResponse(); + + if (serviceResponse.getApp2app() != null) { + a2aResponse.setAuthUri(app2app.getAuthUri()); + } + + resultList.add(a2aResponse); } } } diff --git a/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/StatusQueryModelUtils.java b/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/StatusQueryModelUtils.java index 4358053..73a9023 100644 --- a/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/StatusQueryModelUtils.java +++ b/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/StatusQueryModelUtils.java @@ -15,24 +15,30 @@ */ package ch.swisscom.mid.client.rest; -import java.util.ArrayList; -import java.util.List; - import ch.swisscom.mid.client.MIDFlowException; import ch.swisscom.mid.client.config.ClientConfiguration; import ch.swisscom.mid.client.config.DefaultConfiguration; +import ch.swisscom.mid.client.impl.Loggers; import ch.swisscom.mid.client.model.*; +import ch.swisscom.mid.client.model.service.App2AppAdditionalServiceResponse; +import ch.swisscom.mid.client.model.service.GeofencingAdditionalServiceResponse; import ch.swisscom.mid.client.rest.model.statusreq.MSSStatusReq; import ch.swisscom.mid.client.rest.model.statusreq.MSSStatusRequest; import ch.swisscom.mid.client.rest.model.statusresp.Geofencing; import ch.swisscom.mid.client.rest.model.statusresp.MSSStatusResp; import ch.swisscom.mid.client.rest.model.statusresp.MSSStatusResponse; import ch.swisscom.mid.client.rest.model.statusresp.ServiceResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; import static ch.swisscom.mid.client.utils.Utils.generateInstantAsString; import static ch.swisscom.mid.client.utils.Utils.generateTransId; public class StatusQueryModelUtils { + private static final Logger log = LoggerFactory.getLogger(Loggers.STATUS_QUERY_MODEL_UTILS); public static MSSStatusRequest createStatusQueryRequest(ClientConfiguration config, SignatureTracking signatureTracking) { @@ -78,9 +84,9 @@ public static SignatureResponse processStatusQueryResponse(MSSStatusResponse res return result; } else { throw new MIDFlowException("Invalid MSS status response received. " + - "Cannot parse it and convert it to a valid " + - SignatureResponse.class.getSimpleName(), - new FaultProcessor().processFailure(FailureReason.MID_INVALID_RESPONSE_FAILURE)); + "Cannot parse it and convert it to a valid " + + SignatureResponse.class.getSimpleName(), + new FaultProcessor().processFailure(FailureReason.MID_INVALID_RESPONSE_FAILURE)); } } @@ -104,13 +110,16 @@ private static Status processStatusRespStatus(MSSStatusResp response) { private static List processAdditionalServiceResponses(MSSStatusResp response) { List resultList = new ArrayList<>(); List serviceResponseList = response.getServiceResponses(); + log.debug("processAdditionalServiceResponses has serviceResponseList=[{}]", serviceResponseList); if (serviceResponseList != null) { for (ServiceResponse serviceResponse : serviceResponseList) { + log.debug("Processing service response with description=[{}]", serviceResponse.getDescription()); + if (DefaultConfiguration.ADDITIONAL_SERVICE_GEOFENCING.equals(serviceResponse.getDescription()) - && serviceResponse.getGeofencing() != null) { + && serviceResponse.getGeofencing() != null) { - Geofencing geofencing = serviceResponse.getGeofencing(); - GeofencingAdditionalServiceResponse geoResponse = new GeofencingAdditionalServiceResponse(); + final Geofencing geofencing = serviceResponse.getGeofencing(); + final GeofencingAdditionalServiceResponse geoResponse = new GeofencingAdditionalServiceResponse(); if (geofencing.getErrorCode() == null) { geoResponse.setCountry(geofencing.getCountry()); geoResponse.setAccuracy(geofencing.getAccuracy() == null ? 0 : Integer.parseInt(geofencing.getAccuracy())); @@ -122,6 +131,18 @@ private static List processAdditionalServiceResponses geoResponse.setErrorMessage(geofencing.getErrorMessage()); } resultList.add(geoResponse); + continue; + } + + if (DefaultConfiguration.ADDITIONAL_SERVICE_APP2APP.equals(serviceResponse.getDescription())) { + final ch.swisscom.mid.client.rest.model.statusresp.App2App app2app = serviceResponse.getApp2app(); + final App2AppAdditionalServiceResponse a2aResponse = new App2AppAdditionalServiceResponse(); + + if (serviceResponse.getApp2app() != null) { + a2aResponse.setAuthUri(app2app.getAuthUri()); + } + + resultList.add(a2aResponse); } } } diff --git a/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/model/signreq/AdditionalServiceApp2App.java b/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/model/signreq/AdditionalServiceApp2App.java new file mode 100644 index 0000000..15cd4b3 --- /dev/null +++ b/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/model/signreq/AdditionalServiceApp2App.java @@ -0,0 +1,46 @@ +package ch.swisscom.mid.client.rest.model.signreq; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "Description", + "App2App" +}) +public class AdditionalServiceApp2App extends AdditionalService { + + @JsonProperty("App2App") + private App2AppRequest app2appRequest; + + @JsonProperty("App2App") + public App2AppRequest getApp2appRequest() { + return app2appRequest; + } + + public void setApp2AppRequest(App2AppRequest app2appRequest) { + this.app2appRequest = app2appRequest; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(AdditionalServiceApp2App.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('['); + sb.append("description"); + sb.append('='); + sb.append(((this.getDescription() == null) ? "" : this.getDescription())); + sb.append(','); + sb.append("app2app"); + sb.append('='); + sb.append(((this.app2appRequest == null) ? "" : this.app2appRequest)); + sb.append(','); + if (sb.charAt((sb.length() - 1)) == ',') { + sb.setCharAt((sb.length() - 1), ']'); + } else { + sb.append(']'); + } + return sb.toString(); + } + +} diff --git a/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/model/signreq/App2AppRequest.java b/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/model/signreq/App2AppRequest.java new file mode 100644 index 0000000..040b635 --- /dev/null +++ b/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/model/signreq/App2AppRequest.java @@ -0,0 +1,48 @@ +package ch.swisscom.mid.client.rest.model.signreq; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import lombok.ToString; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "RedirectUri" +}) +@ToString(includeFieldNames = true) +public class App2AppRequest { + + @JsonProperty("RedirectUri") + private String redirectUri; + + @JsonProperty("RedirectUri") + public String getRedirectUri() { + return redirectUri; + } + + @JsonProperty("RedirectUri") + public void setRedirectUri(String redirectUri) { + this.redirectUri = redirectUri; + } + + public App2AppRequest withRedirectUri(String value) { + this.redirectUri = value; + return this; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(App2AppRequest.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('['); + sb.append("RedirectUri"); + sb.append('='); + sb.append(((this.redirectUri == null) ? "" : this.redirectUri)); + sb.append(','); + if (sb.charAt((sb.length() - 1)) == ',') { + sb.setCharAt((sb.length() - 1), ']'); + } else { + sb.append(']'); + } + return sb.toString(); + } +} diff --git a/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/model/signresp/ServiceResponse.java b/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/model/signresp/ServiceResponse.java index fc624da..d995499 100644 --- a/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/model/signresp/ServiceResponse.java +++ b/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/model/signresp/ServiceResponse.java @@ -1,14 +1,15 @@ - package ch.swisscom.mid.client.rest.model.signresp; +import ch.swisscom.mid.client.rest.model.statusresp.App2App; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ - "Description", - "Geofencing" + "Description", + "Geofencing", + "App2App" }) public class ServiceResponse { @@ -18,6 +19,9 @@ public class ServiceResponse { @JsonProperty("Geofencing") private Geofencing geofencing; + @JsonProperty("App2App") + private App2App app2app; + @JsonProperty("Description") public String getDescription() { return description; @@ -48,20 +52,30 @@ public ServiceResponse withGeofencing(Geofencing geofencing) { return this; } + @JsonProperty("App2App") + public App2App getApp2app() { + return app2app; + } + + @JsonProperty("App2App") + public void setApp2app(App2App app2app) { + this.app2app = app2app; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(ServiceResponse.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('['); sb.append("description"); sb.append('='); - sb.append(((this.description == null)?"":this.description)); + sb.append(((this.description == null) ? "" : this.description)); sb.append(','); sb.append("geofencing"); sb.append('='); - sb.append(((this.geofencing == null)?"":this.geofencing)); + sb.append(((this.geofencing == null) ? "" : this.geofencing)); sb.append(','); - if (sb.charAt((sb.length()- 1)) == ',') { - sb.setCharAt((sb.length()- 1), ']'); + if (sb.charAt((sb.length() - 1)) == ',') { + sb.setCharAt((sb.length() - 1), ']'); } else { sb.append(']'); } diff --git a/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/model/statusresp/App2App.java b/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/model/statusresp/App2App.java new file mode 100644 index 0000000..5ecf68f --- /dev/null +++ b/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/model/statusresp/App2App.java @@ -0,0 +1,44 @@ +package ch.swisscom.mid.client.rest.model.statusresp; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "AuthUri", +}) +public class App2App { + + @JsonProperty("AuthUri") + private String authUri; + + + @JsonProperty("AuthUri") + public String getAuthUri() { + return authUri; + } + + @JsonProperty("AuthUri") + public void setAuthUri(String authUri) { + this.authUri = authUri; + } + + public App2App withAuthUri(String authUri) { + this.authUri = authUri; + return this; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(App2App.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('['); + sb.append("authUri"); + sb.append('='); + sb.append(((this.authUri == null) ? "" : this.authUri)); + sb.append(']'); + + return sb.toString(); + } + +} diff --git a/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/model/statusresp/ServiceResponse.java b/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/model/statusresp/ServiceResponse.java index 4f49b95..8a88b25 100644 --- a/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/model/statusresp/ServiceResponse.java +++ b/mid-java-client-rest/src/main/java/ch/swisscom/mid/client/rest/model/statusresp/ServiceResponse.java @@ -1,4 +1,3 @@ - package ch.swisscom.mid.client.rest.model.statusresp; import com.fasterxml.jackson.annotation.JsonInclude; @@ -7,16 +6,23 @@ @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ - "Description", - "Geofencing" + "Description", + "Geofencing", + "App2App" }) public class ServiceResponse { + public static final String NULL = ""; + @JsonProperty("Description") private String description; + @JsonProperty("Geofencing") private Geofencing geofencing; + @JsonProperty("App2App") + private App2App app2app; + @JsonProperty("Description") public String getDescription() { return description; @@ -47,20 +53,39 @@ public ServiceResponse withGeofencing(Geofencing geofencing) { return this; } + @JsonProperty("App2App") + public App2App getApp2app() { + return app2app; + } + + @JsonProperty("App2App") + public void setApp2app(App2App app2app) { + this.app2app = app2app; + } + + public ServiceResponse withApp2App(App2App app2app) { + this.app2app = app2app; + return this; + } + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(ServiceResponse.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('['); sb.append("description"); sb.append('='); - sb.append(((this.description == null)?"":this.description)); + sb.append(((this.description == null) ? NULL : this.description)); sb.append(','); sb.append("geofencing"); sb.append('='); - sb.append(((this.geofencing == null)?"":this.geofencing)); + sb.append(((this.geofencing == null) ? NULL : this.geofencing)); + sb.append(','); + sb.append("app2app"); + sb.append('='); + sb.append(((this.app2app == null) ? NULL : this.app2app)); sb.append(','); - if (sb.charAt((sb.length()- 1)) == ',') { - sb.setCharAt((sb.length()- 1), ']'); + if (sb.charAt((sb.length() - 1)) == ',') { + sb.setCharAt((sb.length() - 1), ']'); } else { sb.append(']'); } diff --git a/mid-java-client-rest/src/test/java/ch/swisscom/mid/client/rest/AsyncSignatureTest.java b/mid-java-client-rest/src/test/java/ch/swisscom/mid/client/rest/AsyncSignatureTest.java index db34c85..aed9805 100644 --- a/mid-java-client-rest/src/test/java/ch/swisscom/mid/client/rest/AsyncSignatureTest.java +++ b/mid-java-client-rest/src/test/java/ch/swisscom/mid/client/rest/AsyncSignatureTest.java @@ -15,32 +15,25 @@ */ package ch.swisscom.mid.client.rest; -import ch.swisscom.mid.client.config.TlsConfiguration; +import ch.swisscom.mid.client.MIDClient; +import ch.swisscom.mid.client.config.DefaultConfiguration; +import ch.swisscom.mid.client.impl.MIDClientImpl; +import ch.swisscom.mid.client.model.*; +import ch.swisscom.mid.client.model.service.*; import com.github.tomakehurst.wiremock.WireMockServer; import com.github.tomakehurst.wiremock.http.MimeType; import com.github.tomakehurst.wiremock.stubbing.Scenario; - import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import ch.swisscom.mid.client.MIDClient; -import ch.swisscom.mid.client.config.DefaultConfiguration; -import ch.swisscom.mid.client.impl.MIDClientImpl; -import ch.swisscom.mid.client.model.*; - import static ch.swisscom.mid.client.rest.TestData.*; import static ch.swisscom.mid.client.rest.TestSupport.*; -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.*; import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.hamcrest.Matchers.nullValue; +import static org.hamcrest.Matchers.*; public class AsyncSignatureTest { @@ -69,44 +62,45 @@ public static void tearDownThisClass() { // ---------------------------------------------------------------------------------------------------- @Test - public void testSignature_success() { + void testAsyncSignature_success() { + // given server.stubFor( - post(urlEqualTo(DefaultConfiguration.REST_ENDPOINT_SUB_URL)) - .inScenario("Async signature") - .whenScenarioStateIs(Scenario.STARTED) - .willReturn( - aResponse() - .withHeader("Content-Type", MimeType.JSON.toString()) - .withBody(fileToString("/samples/rest-response-async-signature.json"))) - .willSetStateTo("Signature running - poll 0")); + post(urlEqualTo(DefaultConfiguration.REST_ENDPOINT_SUB_URL)) + .inScenario("Async signature") + .whenScenarioStateIs(Scenario.STARTED) + .willReturn( + aResponse() + .withHeader("Content-Type", MimeType.JSON.toString()) + .withBody(fileToString("/samples/rest-response-async-signature.json"))) + .willSetStateTo("Signature running - poll 0")); server.stubFor( - post(urlEqualTo("/rest/service")) - .inScenario("Async signature") - .whenScenarioStateIs("Signature running - poll 0") - .willReturn( - aResponse() - .withHeader("Content-Type", MimeType.JSON.toString()) - .withBody(fileToString("/samples/rest-response-status-outstanding.json"))) - .willSetStateTo("Signature running - poll 1") + post(urlEqualTo("/rest/service")) + .inScenario("Async signature") + .whenScenarioStateIs("Signature running - poll 0") + .willReturn( + aResponse() + .withHeader("Content-Type", MimeType.JSON.toString()) + .withBody(fileToString("/samples/rest-response-status-outstanding.json"))) + .willSetStateTo("Signature running - poll 1") ); server.stubFor( - post(urlEqualTo("/rest/service")) - .inScenario("Async signature") - .whenScenarioStateIs("Signature running - poll 1") - .willReturn( - aResponse() - .withHeader("Content-Type", MimeType.JSON.toString()) - .withBody(fileToString("/samples/rest-response-status-signature.json"))) - .willSetStateTo("Signature finished") + post(urlEqualTo("/rest/service")) + .inScenario("Async signature") + .whenScenarioStateIs("Signature running - poll 1") + .willReturn( + aResponse() + .withHeader("Content-Type", MimeType.JSON.toString()) + .withBody(fileToString("/samples/rest-response-status-signature.json"))) + .willSetStateTo("Signature finished") ); - SignatureRequest signatureRequest = buildSignatureRequest(); + //when + SignatureRequest signatureRequest = buildDefaultSignatureRequest(); SignatureResponse response = client.requestAsyncSignature(signatureRequest); - assertThat(response.getStatus().getStatusCode(), is(StatusCode.REQUEST_OK)); - assertThat(response.getStatus().getStatusCodeString(), is("100")); - assertThat(response.getStatus().getStatusMessage(), is("REQUEST_OK")); + // then + assertInitialDefaultStatus(response); assertThat(response.getSignatureProfile(), is(CUSTOM_SIGNATURE_PROFILE)); assertThat(response.getTracking(), is(notNullValue())); assertThat(response.getTracking().getMobileUserMsisdn(), is(TrialNumbers.ONE_THAT_GIVES_MISSING_PARAM)); @@ -121,67 +115,64 @@ public void testSignature_success() { assertThat(response.getStatus().getStatusCodeString(), is("500")); assertThat(response.getBase64Signature(), is(notNullValue())); assertThat(response.getBase64Signature().length(), is(BASE64_SIGNATURE_LENGTH)); - assertThat(response.getAdditionalServiceResponses().size(), is(1)); + assertThat(response.getAdditionalServiceResponses().size(), greaterThanOrEqualTo(2)); + + final GeofencingAdditionalServiceResponse geofencingResponse = (GeofencingAdditionalServiceResponse) response.getAdditionalServiceResponses().get(0); + assertOnGeofencingResponse(geofencingResponse, "RO", 10, "0.5", "1.0", "2021-01-01T11:00:00.000+01:00"); - GeofencingAdditionalServiceResponse geofencingResponse = - (GeofencingAdditionalServiceResponse) response.getAdditionalServiceResponses().get(0); - assertThat(geofencingResponse.getCountry(), is("RO")); - assertThat(geofencingResponse.getAccuracy(), is(10)); - assertThat(geofencingResponse.getDeviceConfidence(), is("0.5")); - assertThat(geofencingResponse.getLocationConfidence(), is("1.0")); - assertThat(geofencingResponse.getTimestamp(), is("2021-01-01T11:00:00.000+01:00")); - assertThat(geofencingResponse.getErrorCode(), is(nullValue())); - assertThat(geofencingResponse.getErrorMessage(), is(nullValue())); + final App2AppAdditionalServiceResponse app2appResponse = (App2AppAdditionalServiceResponse) response.getAdditionalServiceResponses().get(1); + assertOnApp2AppResponse(app2appResponse, "mobileid://auth?mobile_auth_redirect_uri=myapp%3A%2F%2Fapp.open%23access_\ntoken%3DABCD&session_token=32ffc297-0YLukZtgoRVz_wbJJfLnViViEhzk9aXM8\ndkHoOnhqf158&user_id=32ffc297-ac33-4be2-b3f4-42588502ea0f"); } @Test - public void testSignature_success_overrideApIdAndPassword() { + void testAsyncSignature_success_overrideApIdAndPassword() { + // given server.stubFor( - post(urlEqualTo(DefaultConfiguration.REST_ENDPOINT_SUB_URL)) - .withRequestBody(containing("\"" + CUSTOM_AP_ID + "\"")) - .withRequestBody(containing("\"" + CUSTOM_AP_PASSWORD + "\"")) - .inScenario("Async signature") - .whenScenarioStateIs(Scenario.STARTED) - .willReturn( - aResponse() - .withHeader("Content-Type", MimeType.JSON.toString()) - .withBody(fileToString("/samples/rest-response-async-signature.json"))) - .willSetStateTo("Signature running - poll 0")); + post(urlEqualTo(DefaultConfiguration.REST_ENDPOINT_SUB_URL)) + .withRequestBody(containing("\"" + CUSTOM_AP_ID + "\"")) + .withRequestBody(containing("\"" + CUSTOM_AP_PASSWORD + "\"")) + .inScenario("Async signature") + .whenScenarioStateIs(Scenario.STARTED) + .willReturn( + aResponse() + .withHeader("Content-Type", MimeType.JSON.toString()) + .withBody(fileToString("/samples/rest-response-async-signature.json"))) + .willSetStateTo("Signature running - poll 0")); server.stubFor( - post(urlEqualTo("/rest/service")) - .withRequestBody(containing("\"" + CUSTOM_AP_ID + "\"")) - .withRequestBody(containing("\"" + CUSTOM_AP_PASSWORD + "\"")) - .inScenario("Async signature") - .whenScenarioStateIs("Signature running - poll 0") - .willReturn( - aResponse() - .withHeader("Content-Type", MimeType.JSON.toString()) - .withBody(fileToString("/samples/rest-response-status-outstanding.json"))) - .willSetStateTo("Signature running - poll 1") + post(urlEqualTo("/rest/service")) + .withRequestBody(containing("\"" + CUSTOM_AP_ID + "\"")) + .withRequestBody(containing("\"" + CUSTOM_AP_PASSWORD + "\"")) + .inScenario("Async signature") + .whenScenarioStateIs("Signature running - poll 0") + .willReturn( + aResponse() + .withHeader("Content-Type", MimeType.JSON.toString()) + .withBody(fileToString("/samples/rest-response-status-outstanding.json"))) + .willSetStateTo("Signature running - poll 1") ); server.stubFor( - post(urlEqualTo("/rest/service")) - .withRequestBody(containing("\"" + CUSTOM_AP_ID + "\"")) - .withRequestBody(containing("\"" + CUSTOM_AP_PASSWORD + "\"")) - .inScenario("Async signature") - .whenScenarioStateIs("Signature running - poll 1") - .willReturn( - aResponse() - .withHeader("Content-Type", MimeType.JSON.toString()) - .withBody(fileToString("/samples/rest-response-status-signature.json"))) - .willSetStateTo("Signature finished") + post(urlEqualTo("/rest/service")) + .withRequestBody(containing("\"" + CUSTOM_AP_ID + "\"")) + .withRequestBody(containing("\"" + CUSTOM_AP_PASSWORD + "\"")) + .inScenario("Async signature") + .whenScenarioStateIs("Signature running - poll 1") + .willReturn( + aResponse() + .withHeader("Content-Type", MimeType.JSON.toString()) + .withBody(fileToString("/samples/rest-response-status-signature.json"))) + .willSetStateTo("Signature finished") ); - SignatureRequest signatureRequest = buildSignatureRequest(); + SignatureRequest signatureRequest = buildSignatureRequestWithApp2AppService(); + addServiceToRequest(signatureRequest, new GeofencingAdditionalService()); + signatureRequest.setOverrideApId(CUSTOM_AP_ID); signatureRequest.setOverrideApPassword(CUSTOM_AP_PASSWORD); SignatureResponse response = client.requestAsyncSignature(signatureRequest); - assertThat(response.getStatus().getStatusCode(), is(StatusCode.REQUEST_OK)); - assertThat(response.getStatus().getStatusCodeString(), is("100")); - assertThat(response.getStatus().getStatusMessage(), is("REQUEST_OK")); + assertInitialDefaultStatus(response); assertThat(response.getSignatureProfile(), is(CUSTOM_SIGNATURE_PROFILE)); assertThat(response.getTracking(), is(notNullValue())); assertThat(response.getTracking().getMobileUserMsisdn(), is(TrialNumbers.ONE_THAT_GIVES_MISSING_PARAM)); @@ -200,24 +191,146 @@ public void testSignature_success_overrideApIdAndPassword() { assertThat(response.getStatus().getStatusCodeString(), is("500")); assertThat(response.getBase64Signature(), is(notNullValue())); assertThat(response.getBase64Signature().length(), is(BASE64_SIGNATURE_LENGTH)); - assertThat(response.getAdditionalServiceResponses().size(), is(1)); + assertThat(response.getAdditionalServiceResponses().size(), is(2)); assertThat(response.getTracking().getOverrideApId(), is(CUSTOM_AP_ID)); assertThat(response.getTracking().getOverrideApPassword(), is(CUSTOM_AP_PASSWORD)); - GeofencingAdditionalServiceResponse geofencingResponse = - (GeofencingAdditionalServiceResponse) response.getAdditionalServiceResponses().get(0); - assertThat(geofencingResponse.getCountry(), is("RO")); - assertThat(geofencingResponse.getAccuracy(), is(10)); - assertThat(geofencingResponse.getDeviceConfidence(), is("0.5")); - assertThat(geofencingResponse.getLocationConfidence(), is("1.0")); - assertThat(geofencingResponse.getTimestamp(), is("2021-01-01T11:00:00.000+01:00")); - assertThat(geofencingResponse.getErrorCode(), is(nullValue())); - assertThat(geofencingResponse.getErrorMessage(), is(nullValue())); + assertThat(response.getAdditionalServiceResponses().size(), greaterThanOrEqualTo(2)); + + final GeofencingAdditionalServiceResponse geofencingResponse = (GeofencingAdditionalServiceResponse) response.getAdditionalServiceResponses().get(0); + assertOnGeofencingResponse(geofencingResponse, "RO", 10, "0.5", "1.0", "2021-01-01T11:00:00.000+01:00"); + + final App2AppAdditionalServiceResponse app2appResponse = (App2AppAdditionalServiceResponse) response.getAdditionalServiceResponses().get(1); + assertOnApp2AppResponse(app2appResponse, "mobileid://auth?mobile_auth_redirect_uri=myapp%3A%2F%2Fapp.open%23access_\ntoken%3DABCD&session_token=32ffc297-0YLukZtgoRVz_wbJJfLnViViEhzk9aXM8\ndkHoOnhqf158&user_id=32ffc297-ac33-4be2-b3f4-42588502ea0f"); } // ---------------------------------------------------------------------------------------------------- - private static SignatureRequest buildSignatureRequest() { + @Test + void testAsyncSignature_successWithOnlyApp2AppService() { + // given + server.stubFor( + post(urlEqualTo(DefaultConfiguration.REST_ENDPOINT_SUB_URL)) + .inScenario("Async signature") + .whenScenarioStateIs(Scenario.STARTED) + .willReturn( + aResponse() + .withHeader("Content-Type", MimeType.JSON.toString()) + .withBody(fileToString("/samples/rest-response-async-signature.json"))) + .willSetStateTo("Signature running - poll 0")); + + server.stubFor( + post(urlEqualTo("/rest/service")) + .inScenario("Async signature") + .whenScenarioStateIs("Signature running - poll 0") + .willReturn( + aResponse() + .withHeader("Content-Type", MimeType.JSON.toString()) + .withBody(fileToString("/samples/rest-response-status-outstanding.json"))) + .willSetStateTo("Signature running - poll 1") + ); + + server.stubFor( + post(urlEqualTo("/rest/service")) + .inScenario("Async signature") + .whenScenarioStateIs("Signature running - poll 1") + .willReturn( + aResponse() + .withHeader("Content-Type", MimeType.JSON.toString()) + .withBody(fileToString("/samples/rest-response-status-signature-app2app.json"))) + .willSetStateTo("Signature finished") + ); + + SignatureRequest signatureRequest = buildSignatureRequestWithApp2AppService(); + SignatureResponse response = client.requestAsyncSignature(signatureRequest); + assertInitialDefaultStatus(response); + assertThat(response.getSignatureProfile(), is(CUSTOM_SIGNATURE_PROFILE)); + assertThat(response.getTracking(), is(notNullValue())); + assertThat(response.getTracking().getMobileUserMsisdn(), is(TrialNumbers.ONE_THAT_GIVES_MISSING_PARAM)); + assertThat(response.getTracking().getTransactionId(), is(CUSTOM_TRANS_ID)); + + response = client.pollForSignatureStatus(response.getTracking()); + assertThat(response.getStatus().getStatusCode(), is(StatusCode.OUTSTANDING_TRANSACTION)); + assertThat(response.getStatus().getStatusCodeString(), is("504")); + + response = client.pollForSignatureStatus(response.getTracking()); + assertThat(response.getStatus().getStatusCode(), is(StatusCode.SIGNATURE)); + assertThat(response.getStatus().getStatusCodeString(), is("500")); + assertThat(response.getBase64Signature(), is(notNullValue())); + assertThat(response.getBase64Signature().length(), is(BASE64_SIGNATURE_LENGTH)); + assertThat(response.getAdditionalServiceResponses().size(), greaterThanOrEqualTo(1)); + + final App2AppAdditionalServiceResponse app2appResponse = (App2AppAdditionalServiceResponse) response.getAdditionalServiceResponses().get(0); + assertOnApp2AppResponse(app2appResponse, "mobileid://auth?mobile_auth_redirect_uri=myauthapp%3A%2F%2Fapp.open%23access_\ntoken%3DABCD&session_token=32ffc297-0YLukZtgoRVz_wbJJfLnViViEhzk9aXM8\ndkHoOnhqf158&user_id=32ffc297-ac33-4be2-b3f4-42588502ea0f"); + } + + @Test + void testSignature_successWithLanguageAndApp2AppService() { + // given + server.stubFor( + post(urlEqualTo(DefaultConfiguration.REST_ENDPOINT_SUB_URL)) + .inScenario("Async signature") + .whenScenarioStateIs(Scenario.STARTED) + .willReturn( + aResponse() + .withHeader("Content-Type", MimeType.JSON.toString()) + .withBody(fileToString("/samples/rest-response-async-signature-app2app-EN-language.json"))) + .willSetStateTo("Signature running - poll 0")); + + server.stubFor( + post(urlEqualTo("/rest/service")) + .inScenario("Async signature") + .whenScenarioStateIs("Signature running - poll 0") + .willReturn( + aResponse() + .withHeader("Content-Type", MimeType.JSON.toString()) + .withBody(fileToString("/samples/rest-response-status-outstanding.json"))) + .willSetStateTo("Signature running - poll 1") + ); + + server.stubFor( + post(urlEqualTo("/rest/service")) + .inScenario("Async signature") + .whenScenarioStateIs("Signature running - poll 1") + .willReturn( + aResponse() + .withHeader("Content-Type", MimeType.JSON.toString()) + .withBody(fileToString("/samples/rest-response-status-signature-app2app.json"))) + .willSetStateTo("Signature finished") + ); + // when + SignatureRequest signatureRequest = buildSignatureRequestWithApp2AppService(); + SignatureResponse response = client.requestAsyncSignature(signatureRequest); + // then + assertInitialDefaultStatus(response); + + assertThat(response.getSignatureProfile(), is(CUSTOM_SIGNATURE_PROFILE)); + assertThat(response.getTracking(), is(notNullValue())); + assertThat(response.getTracking().getMobileUserMsisdn(), is(TrialNumbers.ONE_THAT_GIVES_MISSING_PARAM)); + assertThat(response.getTracking().getTransactionId(), is(CUSTOM_TRANS_ID)); + + response = client.pollForSignatureStatus(response.getTracking()); + assertThat(response.getStatus().getStatusCode(), is(StatusCode.OUTSTANDING_TRANSACTION)); + assertThat(response.getStatus().getStatusCodeString(), is("504")); + + response = client.pollForSignatureStatus(response.getTracking()); + assertThat(response.getStatus().getStatusCode(), is(StatusCode.SIGNATURE)); + assertThat(response.getStatus().getStatusCodeString(), is("500")); + assertThat(response.getBase64Signature(), is(notNullValue())); + assertThat(response.getBase64Signature().length(), is(BASE64_SIGNATURE_LENGTH)); + assertThat(response.getAdditionalServiceResponses().size(), is(1)); + + final App2AppAdditionalServiceResponse app2appResponse = (App2AppAdditionalServiceResponse) response.getAdditionalServiceResponses().get(0); + assertOnApp2AppResponse(app2appResponse, "mobileid://auth?mobile_auth_redirect_uri=myauthapp%3A%2F%2Fapp.open%23access_\ntoken%3DABCD&session_token=32ffc297-0YLukZtgoRVz_wbJJfLnViViEhzk9aXM8\ndkHoOnhqf158&user_id=32ffc297-ac33-4be2-b3f4-42588502ea0f"); + } + + private static void assertInitialDefaultStatus(SignatureResponse response) { + assertThat(response.getStatus().getStatusCode(), is(StatusCode.REQUEST_OK)); + assertThat(response.getStatus().getStatusCodeString(), is("100")); + assertThat(response.getStatus().getStatusMessage(), is("REQUEST_OK")); + } + + private static SignatureRequest buildDefaultSignatureRequest() { SignatureRequest request = new SignatureRequest(); request.setUserLanguage(UserLanguage.ENGLISH); request.getDataToBeSigned().setData("Test: Do you want to login?"); @@ -228,4 +341,37 @@ private static SignatureRequest buildSignatureRequest() { request.addAdditionalService(new GeofencingAdditionalService()); return request; } + + private static SignatureRequest buildSignatureRequestWithApp2AppService() { + SignatureRequest request = new SignatureRequest(); + request.setUserLanguage(UserLanguage.ENGLISH); + request.getDataToBeSigned().setData("Test: Do you want to login?"); + request.getDataToBeSigned().setEncodingToUtf8(); + request.getDataToBeSigned().setMimeTypeToTextPlain(); + request.getMobileUser().setMsisdn(TrialNumbers.ONE_THAT_GIVES_MISSING_PARAM); + request.setSignatureProfile(SignatureProfiles.DEFAULT_PROFILE); + request.addAdditionalService(new App2AppAdditionalService("myapp://example")); + return request; + } + + private static void addServiceToRequest(SignatureRequest request, AdditionalService additionalService) { + request.addAdditionalService(additionalService); + } + + private void assertOnGeofencingResponse(GeofencingAdditionalServiceResponse geoResp, String country, int accuracy, String deviceConfidence, String locationConfidence, String timestamp) { + assertThat(geoResp.getCountry(), is(country)); + assertThat(geoResp.getAccuracy(), is(accuracy)); + assertThat(geoResp.getDeviceConfidence(), is(deviceConfidence)); + assertThat(geoResp.getLocationConfidence(), is(locationConfidence)); + assertThat(geoResp.getTimestamp(), is(timestamp)); + assertThat(geoResp.getErrorCode(), is(nullValue())); + assertThat(geoResp.getErrorMessage(), is(nullValue())); + } + + private void assertOnApp2AppResponse(App2AppAdditionalServiceResponse a2a, String authUri) { + assertThat(a2a, is(notNullValue())); + assertThat(a2a, instanceOf(App2AppAdditionalServiceResponse.class)); + assertThat(a2a.getAuthUri(), is(notNullValue())); + assertThat(a2a.getAuthUri(), is(authUri)); + } } diff --git a/mid-java-client-rest/src/test/java/ch/swisscom/mid/client/rest/SyncSignatureTest.java b/mid-java-client-rest/src/test/java/ch/swisscom/mid/client/rest/SyncSignatureTest.java index e0ef60b..d4b6197 100644 --- a/mid-java-client-rest/src/test/java/ch/swisscom/mid/client/rest/SyncSignatureTest.java +++ b/mid-java-client-rest/src/test/java/ch/swisscom/mid/client/rest/SyncSignatureTest.java @@ -20,6 +20,8 @@ import ch.swisscom.mid.client.config.DefaultConfiguration; import ch.swisscom.mid.client.impl.MIDClientImpl; import ch.swisscom.mid.client.model.*; +import ch.swisscom.mid.client.model.service.GeofencingAdditionalService; +import ch.swisscom.mid.client.model.service.GeofencingAdditionalServiceResponse; import com.github.tomakehurst.wiremock.WireMockServer; import com.github.tomakehurst.wiremock.http.MimeType; import org.junit.jupiter.api.AfterAll; @@ -32,8 +34,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.*; import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; +import static org.hamcrest.Matchers.*; import static org.junit.jupiter.api.Assertions.*; public class SyncSignatureTest { @@ -75,6 +76,15 @@ public void testSignature_success() { assertThat(response.getSignatureProfile(), is(TestData.CUSTOM_SIGNATURE_PROFILE)); assertThat(response.getBase64Signature(), is(notNullValue())); assertThat(response.getBase64Signature().length(), is(TestData.BASE64_SIGNATURE_LENGTH)); + assertThat(response.getAdditionalServiceResponses(), is(notNullValue())); + assertThat(response.getAdditionalServiceResponses().size(), is(1)); + assertThat(response.getAdditionalServiceResponses().get(0), is(notNullValue())); + assertThat(response.getAdditionalServiceResponses().get(0), instanceOf(GeofencingAdditionalServiceResponse.class)); + assertThat(((GeofencingAdditionalServiceResponse) response.getAdditionalServiceResponses().get(0)).getAccuracy(), is(16)); + assertThat(((GeofencingAdditionalServiceResponse) response.getAdditionalServiceResponses().get(0)).getCountry(), is("CH")); + assertThat(((GeofencingAdditionalServiceResponse) response.getAdditionalServiceResponses().get(0)).getDeviceConfidence(), is("1.0")); + assertThat(((GeofencingAdditionalServiceResponse) response.getAdditionalServiceResponses().get(0)).getLocationConfidence(), is("1.0")); + assertThat(((GeofencingAdditionalServiceResponse) response.getAdditionalServiceResponses().get(0)).getTimestamp(), is("2021-01-01T11:00:00.000+01:00")); } @Test diff --git a/mid-java-client-rest/src/test/resources/samples/rest-response-async-signature-app2app-EN-language.json b/mid-java-client-rest/src/test/resources/samples/rest-response-async-signature-app2app-EN-language.json new file mode 100644 index 0000000..768c18b --- /dev/null +++ b/mid-java-client-rest/src/test/resources/samples/rest-response-async-signature-app2app-EN-language.json @@ -0,0 +1,43 @@ +{ + "MSS_SignatureResp": { + "AP_Info": { + "AP_ID": "mid://test.swisscom.ch", + "AP_TransID": "ID-b19c7955-0036-49d8-8fde-768a96f6c0c2", + "Instant": "2020-12-02T15:19:18.642Z" + }, + "AdditionalServices": [ + { + "Description": "http://mss.ficom.fi/TS102204/v1.0.0#userLang", + "UserLang": { + "Value": "EN" + } + }, + { + "Description": "http://mid.swisscom.ch/as#app2app", + "App2App": { + "RedirectUri": "myapp://example" + } + } + ], + "MSSP_Info": { + "Instant": "2020-12-02T15:19:19.341Z", + "MSSP_ID": { + "URI": "http://mid.swisscom.ch/" + } + }, + "MSSP_TransID": "CAFE_BABE", + "MajorVersion": "1", + "MinorVersion": "1", + "MessagingMode": "asynch", + "MobileUser": { + "MSISDN": "41000092102" + }, + "SignatureProfile": "http://mid.swisscom.ch/My-Custom-Profile", + "Status": { + "StatusCode": { + "Value": "100" + }, + "StatusMessage": "REQUEST_OK" + } + } +} \ No newline at end of file diff --git a/mid-java-client-rest/src/test/resources/samples/rest-response-async-signature-app2app-only.json b/mid-java-client-rest/src/test/resources/samples/rest-response-async-signature-app2app-only.json new file mode 100644 index 0000000..c4fe0d1 --- /dev/null +++ b/mid-java-client-rest/src/test/resources/samples/rest-response-async-signature-app2app-only.json @@ -0,0 +1,37 @@ +{ + "MSS_SignatureResp": { + "AP_Info": { + "AP_ID": "mid://test.swisscom.ch", + "AP_TransID": "ID-b19c7955-0036-49d8-8fde-768a96f6c0c2", + "Instant": "2020-12-02T15:19:18.642Z" + }, + "AdditionalServices": [ + { + "Description": "http://mid.swisscom.ch/as#app2app", + "App2App": { + "RedirectUri": "myapp://example" + } + } + ], + "MSSP_Info": { + "Instant": "2020-12-02T15:19:19.341Z", + "MSSP_ID": { + "URI": "http://mid.swisscom.ch/" + } + }, + "MSSP_TransID": "CAFE_BABE", + "MajorVersion": "1", + "MinorVersion": "1", + "MessagingMode": "asynch", + "MobileUser": { + "MSISDN": "41000092102" + }, + "SignatureProfile": "http://mid.swisscom.ch/My-Custom-Profile", + "Status": { + "StatusCode": { + "Value": "100" + }, + "StatusMessage": "REQUEST_OK" + } + } +} \ No newline at end of file diff --git a/mid-java-client-rest/src/test/resources/samples/rest-response-async-signature.json b/mid-java-client-rest/src/test/resources/samples/rest-response-async-signature.json index 92dcb5e..e99df98 100644 --- a/mid-java-client-rest/src/test/resources/samples/rest-response-async-signature.json +++ b/mid-java-client-rest/src/test/resources/samples/rest-response-async-signature.json @@ -1,28 +1,40 @@ { - "MSS_SignatureResp": { - "AP_Info": { - "AP_ID": "mid://test.swisscom.ch", - "AP_TransID": "ID-b19c7955-0036-49d8-8fde-768a96f6c0c2", - "Instant": "2020-12-02T15:19:18.642Z" - }, - "MSSP_Info": { - "Instant": "2020-12-02T15:19:19.341Z", - "MSSP_ID": { - "URI": "http://mid.swisscom.ch/" - } - }, - "MSSP_TransID": "CAFE_BABE", - "MajorVersion": "1", - "MinorVersion": "1", - "MobileUser": { - "MSISDN": "41000092102" - }, - "SignatureProfile": "http://mid.swisscom.ch/My-Custom-Profile", - "Status": { - "StatusCode": { - "Value": "100" - }, - "StatusMessage": "REQUEST_OK" + "MSS_SignatureResp": { + "AP_Info": { + "AP_ID": "mid://test.swisscom.ch", + "AP_TransID": "ID-b19c7955-0036-49d8-8fde-768a96f6c0c2", + "Instant": "2020-12-02T15:19:18.642Z" + }, + "AdditionalServices": [ + { + "Description": "http://mss.ficom.fi/TS102204/v1.0.0#userLang", + "UserLang": { + "Value": "DE" } + }, + { + "Description": "http://mid.swisscom.ch/as#geofencing" + } + ], + "MSSP_Info": { + "Instant": "2020-12-02T15:19:19.341Z", + "MSSP_ID": { + "URI": "http://mid.swisscom.ch/" + } + }, + "MSSP_TransID": "CAFE_BABE", + "MajorVersion": "1", + "MinorVersion": "1", + "MessagingMode": "asynch", + "MobileUser": { + "MSISDN": "41000092102" + }, + "SignatureProfile": "http://mid.swisscom.ch/My-Custom-Profile", + "Status": { + "StatusCode": { + "Value": "100" + }, + "StatusMessage": "REQUEST_OK" } + } } \ No newline at end of file diff --git a/mid-java-client-rest/src/test/resources/samples/rest-response-signature.json b/mid-java-client-rest/src/test/resources/samples/rest-response-signature.json index 820b928..5c76b47 100644 --- a/mid-java-client-rest/src/test/resources/samples/rest-response-signature.json +++ b/mid-java-client-rest/src/test/resources/samples/rest-response-signature.json @@ -1,43 +1,43 @@ { - "MSS_SignatureResp": { - "AP_Info": { - "AP_ID": "mid://test.swisscom.ch", - "AP_TransID": "ID-495381fa-ae4d-4d7a-bba6-28b46df88f75", - "Instant": "2020-11-24T10:54:06.141Z" - }, - "MSSP_Info": { - "Instant": "2020-11-24T10:54:19.882Z", - "MSSP_ID": { - "URI": "http://mid.swisscom.ch/" - } - }, - "MSSP_TransID": "HE826ht", - "MSS_Signature": { - "Base64Signature": "TG9yZW0gSXBzdW0gaXMgc2ltcGx5IGR1bW15IHRleHQgb2YgdGhlIHByaW50aW5nIGFuZCB0eXBlc2V0dGluZyBpbmR1c3RyeS4gTG9yZW0gSXBzdW0gaGFzIGJlZW4gdGhlIGluZHVzdHJ5J3Mgc3RhbmRhcmQgZHVtbXkgdGV4dCBldmVyIHNpbmNlIHRoZSAxNTAwcywgd2hlbiBhbiB1bmtub3duIHByaW50ZXIgdG9vayBhIGdhbGxleSBvZiB0eXBlIGFuZCBzY3JhbWJsZWQgaXQgdG8gbWFrZSBhIHR5cGUgc3BlY2ltZW4gYm9vay4gSXQgaGFzIHN1cnZpdmVkIG5vdCBvbmx5IGZpdmUgY2VudHVyaWVzLCBidXQgYWxzbyB0aGUgbGVhcCBpbnRvIGVsZWN0cm9uaWMgdHlwZXNldHRpbmcsIHJlbWFpbmluZyBlc3NlbnRpYWxseSB1bmNoYW5nZWQuIEl0IHdhcyBwb3B1bGFyaXNlZCBpbiB0aGUgMTk2MHMgd2l0aCB0aGUgcmVsZWFzZSBvZiBMZXRyYXNldCBzaGVldHMgY29udGFpbmluZyBMb3JlbSBJcHN1bSBwYXNzYWdlcywgYW5kIG1vcmUgcmVjZW50bHkgd2l0aCBkZXNrdG9wIHB1Ymxpc2hpbmcgc29mdHdhcmUgbGlrZSBBbGR1cyBQYWdlTWFrZXIgaW5jbHVkaW5nIHZlcnNpb25zIG9mIExvcmVtIElwc3VtLg==" - }, - "MajorVersion": "1", - "MinorVersion": "1", - "MobileUser": { - "MSISDN": "418888888888" - }, - "ServiceResponses": [ - { - "Description": "http://mid.swisscom.ch/as#geofencing", - "Geofencing": { - "Accuracy": "16", - "Country": "CH", - "DeviceConfidence": "1.0", - "LocationConfidence": "1.0", - "Timestamp": "2021-01-01T11:00:00.000+01:00" - } - } - ], - "SignatureProfile": "http://mid.swisscom.ch/My-Custom-Profile", - "Status": { - "StatusCode": { - "Value": "500" - }, - "StatusMessage": "SIGNATURE" + "MSS_SignatureResp": { + "AP_Info": { + "AP_ID": "mid://test.swisscom.ch", + "AP_TransID": "ID-495381fa-ae4d-4d7a-bba6-28b46df88f75", + "Instant": "2020-11-24T10:54:06.141Z" + }, + "MSSP_Info": { + "Instant": "2020-11-24T10:54:19.882Z", + "MSSP_ID": { + "URI": "http://mid.swisscom.ch/" + } + }, + "MSSP_TransID": "HE826ht", + "MSS_Signature": { + "Base64Signature": "TG9yZW0gSXBzdW0gaXMgc2ltcGx5IGR1bW15IHRleHQgb2YgdGhlIHByaW50aW5nIGFuZCB0eXBlc2V0dGluZyBpbmR1c3RyeS4gTG9yZW0gSXBzdW0gaGFzIGJlZW4gdGhlIGluZHVzdHJ5J3Mgc3RhbmRhcmQgZHVtbXkgdGV4dCBldmVyIHNpbmNlIHRoZSAxNTAwcywgd2hlbiBhbiB1bmtub3duIHByaW50ZXIgdG9vayBhIGdhbGxleSBvZiB0eXBlIGFuZCBzY3JhbWJsZWQgaXQgdG8gbWFrZSBhIHR5cGUgc3BlY2ltZW4gYm9vay4gSXQgaGFzIHN1cnZpdmVkIG5vdCBvbmx5IGZpdmUgY2VudHVyaWVzLCBidXQgYWxzbyB0aGUgbGVhcCBpbnRvIGVsZWN0cm9uaWMgdHlwZXNldHRpbmcsIHJlbWFpbmluZyBlc3NlbnRpYWxseSB1bmNoYW5nZWQuIEl0IHdhcyBwb3B1bGFyaXNlZCBpbiB0aGUgMTk2MHMgd2l0aCB0aGUgcmVsZWFzZSBvZiBMZXRyYXNldCBzaGVldHMgY29udGFpbmluZyBMb3JlbSBJcHN1bSBwYXNzYWdlcywgYW5kIG1vcmUgcmVjZW50bHkgd2l0aCBkZXNrdG9wIHB1Ymxpc2hpbmcgc29mdHdhcmUgbGlrZSBBbGR1cyBQYWdlTWFrZXIgaW5jbHVkaW5nIHZlcnNpb25zIG9mIExvcmVtIElwc3VtLg==" + }, + "MajorVersion": "1", + "MinorVersion": "1", + "MobileUser": { + "MSISDN": "418888888888" + }, + "ServiceResponses": [ + { + "Description": "http://mid.swisscom.ch/as#geofencing", + "Geofencing": { + "Accuracy": "16", + "Country": "CH", + "DeviceConfidence": "1.0", + "LocationConfidence": "1.0", + "Timestamp": "2021-01-01T11:00:00.000+01:00" } + } + ], + "SignatureProfile": "http://mid.swisscom.ch/My-Custom-Profile", + "Status": { + "StatusCode": { + "Value": "500" + }, + "StatusMessage": "SIGNATURE" } + } } \ No newline at end of file diff --git a/mid-java-client-rest/src/test/resources/samples/rest-response-status-signature-app2app-language.json b/mid-java-client-rest/src/test/resources/samples/rest-response-status-signature-app2app-language.json new file mode 100644 index 0000000..2084a9c --- /dev/null +++ b/mid-java-client-rest/src/test/resources/samples/rest-response-status-signature-app2app-language.json @@ -0,0 +1,37 @@ +{ + "MSS_StatusResp": { + "AP_Info": { + "AP_ID": "mid://test.swisscom.ch", + "AP_TransID": "ID-ee3aaa79-efd5-4828-8708-5e7b2c6cecf0", + "Instant": "2020-12-02T15:19:25.512Z" + }, + "MSSP_Info": { + "Instant": "2020-12-02T15:19:25.879Z", + "MSSP_ID": { + "URI": "http://mid.swisscom.ch/" + } + }, + "MSS_Signature": { + "Base64Signature": "TG9yZW0gSXBzdW0gaXMgc2ltcGx5IGR1bW15IHRleHQgb2YgdGhlIHByaW50aW5nIGFuZCB0eXBlc2V0dGluZyBpbmR1c3RyeS4gTG9yZW0gSXBzdW0gaGFzIGJlZW4gdGhlIGluZHVzdHJ5J3Mgc3RhbmRhcmQgZHVtbXkgdGV4dCBldmVyIHNpbmNlIHRoZSAxNTAwcywgd2hlbiBhbiB1bmtub3duIHByaW50ZXIgdG9vayBhIGdhbGxleSBvZiB0eXBlIGFuZCBzY3JhbWJsZWQgaXQgdG8gbWFrZSBhIHR5cGUgc3BlY2ltZW4gYm9vay4gSXQgaGFzIHN1cnZpdmVkIG5vdCBvbmx5IGZpdmUgY2VudHVyaWVzLCBidXQgYWxzbyB0aGUgbGVhcCBpbnRvIGVsZWN0cm9uaWMgdHlwZXNldHRpbmcsIHJlbWFpbmluZyBlc3NlbnRpYWxseSB1bmNoYW5nZWQuIEl0IHdhcyBwb3B1bGFyaXNlZCBpbiB0aGUgMTk2MHMgd2l0aCB0aGUgcmVsZWFzZSBvZiBMZXRyYXNldCBzaGVldHMgY29udGFpbmluZyBMb3JlbSBJcHN1bSBwYXNzYWdlcywgYW5kIG1vcmUgcmVjZW50bHkgd2l0aCBkZXNrdG9wIHB1Ymxpc2hpbmcgc29mdHdhcmUgbGlrZSBBbGR1cyBQYWdlTWFrZXIgaW5jbHVkaW5nIHZlcnNpb25zIG9mIExvcmVtIElwc3VtLg==" + }, + "MajorVersion": "1", + "MinorVersion": "1", + "MobileUser": { + "MSISDN": "41000092102" + }, + "ServiceResponses": [ + { + "Description": "http://mid.swisscom.ch/as#app2app", + "App2App": { + "AuthUri": "mobileid://auth?mobile_auth_redirect_uri=myauthapp%3A%2F%2Fapp.open%23access_\ntoken%3DABCD&session_token=32ffc297-0YLukZtgoRVz_wbJJfLnViViEhzk9aXM8\ndkHoOnhqf158&user_id=32ffc297-ac33-4be2-b3f4-42588502ea0f" + } + } + ], + "Status": { + "StatusCode": { + "Value": "500" + }, + "StatusMessage": "SIGNATURE" + } + } +} \ No newline at end of file diff --git a/mid-java-client-rest/src/test/resources/samples/rest-response-status-signature-app2app.json b/mid-java-client-rest/src/test/resources/samples/rest-response-status-signature-app2app.json new file mode 100644 index 0000000..2084a9c --- /dev/null +++ b/mid-java-client-rest/src/test/resources/samples/rest-response-status-signature-app2app.json @@ -0,0 +1,37 @@ +{ + "MSS_StatusResp": { + "AP_Info": { + "AP_ID": "mid://test.swisscom.ch", + "AP_TransID": "ID-ee3aaa79-efd5-4828-8708-5e7b2c6cecf0", + "Instant": "2020-12-02T15:19:25.512Z" + }, + "MSSP_Info": { + "Instant": "2020-12-02T15:19:25.879Z", + "MSSP_ID": { + "URI": "http://mid.swisscom.ch/" + } + }, + "MSS_Signature": { + "Base64Signature": "TG9yZW0gSXBzdW0gaXMgc2ltcGx5IGR1bW15IHRleHQgb2YgdGhlIHByaW50aW5nIGFuZCB0eXBlc2V0dGluZyBpbmR1c3RyeS4gTG9yZW0gSXBzdW0gaGFzIGJlZW4gdGhlIGluZHVzdHJ5J3Mgc3RhbmRhcmQgZHVtbXkgdGV4dCBldmVyIHNpbmNlIHRoZSAxNTAwcywgd2hlbiBhbiB1bmtub3duIHByaW50ZXIgdG9vayBhIGdhbGxleSBvZiB0eXBlIGFuZCBzY3JhbWJsZWQgaXQgdG8gbWFrZSBhIHR5cGUgc3BlY2ltZW4gYm9vay4gSXQgaGFzIHN1cnZpdmVkIG5vdCBvbmx5IGZpdmUgY2VudHVyaWVzLCBidXQgYWxzbyB0aGUgbGVhcCBpbnRvIGVsZWN0cm9uaWMgdHlwZXNldHRpbmcsIHJlbWFpbmluZyBlc3NlbnRpYWxseSB1bmNoYW5nZWQuIEl0IHdhcyBwb3B1bGFyaXNlZCBpbiB0aGUgMTk2MHMgd2l0aCB0aGUgcmVsZWFzZSBvZiBMZXRyYXNldCBzaGVldHMgY29udGFpbmluZyBMb3JlbSBJcHN1bSBwYXNzYWdlcywgYW5kIG1vcmUgcmVjZW50bHkgd2l0aCBkZXNrdG9wIHB1Ymxpc2hpbmcgc29mdHdhcmUgbGlrZSBBbGR1cyBQYWdlTWFrZXIgaW5jbHVkaW5nIHZlcnNpb25zIG9mIExvcmVtIElwc3VtLg==" + }, + "MajorVersion": "1", + "MinorVersion": "1", + "MobileUser": { + "MSISDN": "41000092102" + }, + "ServiceResponses": [ + { + "Description": "http://mid.swisscom.ch/as#app2app", + "App2App": { + "AuthUri": "mobileid://auth?mobile_auth_redirect_uri=myauthapp%3A%2F%2Fapp.open%23access_\ntoken%3DABCD&session_token=32ffc297-0YLukZtgoRVz_wbJJfLnViViEhzk9aXM8\ndkHoOnhqf158&user_id=32ffc297-ac33-4be2-b3f4-42588502ea0f" + } + } + ], + "Status": { + "StatusCode": { + "Value": "500" + }, + "StatusMessage": "SIGNATURE" + } + } +} \ No newline at end of file diff --git a/mid-java-client-rest/src/test/resources/samples/rest-response-status-signature.json b/mid-java-client-rest/src/test/resources/samples/rest-response-status-signature.json index fa89084..2c86a30 100644 --- a/mid-java-client-rest/src/test/resources/samples/rest-response-status-signature.json +++ b/mid-java-client-rest/src/test/resources/samples/rest-response-status-signature.json @@ -1,41 +1,47 @@ { - "MSS_StatusResp": { - "AP_Info": { - "AP_ID": "mid://test.swisscom.ch", - "AP_TransID": "ID-ee3aaa79-efd5-4828-8708-5e7b2c6cecf0", - "Instant": "2020-12-02T15:19:25.512Z" - }, - "MSSP_Info": { - "Instant": "2020-12-02T15:19:25.879Z", - "MSSP_ID": { - "URI": "http://mid.swisscom.ch/" - } - }, - "MSS_Signature": { - "Base64Signature": "TG9yZW0gSXBzdW0gaXMgc2ltcGx5IGR1bW15IHRleHQgb2YgdGhlIHByaW50aW5nIGFuZCB0eXBlc2V0dGluZyBpbmR1c3RyeS4gTG9yZW0gSXBzdW0gaGFzIGJlZW4gdGhlIGluZHVzdHJ5J3Mgc3RhbmRhcmQgZHVtbXkgdGV4dCBldmVyIHNpbmNlIHRoZSAxNTAwcywgd2hlbiBhbiB1bmtub3duIHByaW50ZXIgdG9vayBhIGdhbGxleSBvZiB0eXBlIGFuZCBzY3JhbWJsZWQgaXQgdG8gbWFrZSBhIHR5cGUgc3BlY2ltZW4gYm9vay4gSXQgaGFzIHN1cnZpdmVkIG5vdCBvbmx5IGZpdmUgY2VudHVyaWVzLCBidXQgYWxzbyB0aGUgbGVhcCBpbnRvIGVsZWN0cm9uaWMgdHlwZXNldHRpbmcsIHJlbWFpbmluZyBlc3NlbnRpYWxseSB1bmNoYW5nZWQuIEl0IHdhcyBwb3B1bGFyaXNlZCBpbiB0aGUgMTk2MHMgd2l0aCB0aGUgcmVsZWFzZSBvZiBMZXRyYXNldCBzaGVldHMgY29udGFpbmluZyBMb3JlbSBJcHN1bSBwYXNzYWdlcywgYW5kIG1vcmUgcmVjZW50bHkgd2l0aCBkZXNrdG9wIHB1Ymxpc2hpbmcgc29mdHdhcmUgbGlrZSBBbGR1cyBQYWdlTWFrZXIgaW5jbHVkaW5nIHZlcnNpb25zIG9mIExvcmVtIElwc3VtLg==" - }, - "MajorVersion": "1", - "MinorVersion": "1", - "MobileUser": { - "MSISDN": "41000092102" - }, - "ServiceResponses": [ - { - "Description": "http://mid.swisscom.ch/as#geofencing", - "Geofencing": { - "Accuracy": "10", - "Country": "RO", - "DeviceConfidence": "0.5", - "LocationConfidence": "1.0", - "Timestamp": "2021-01-01T11:00:00.000+01:00" - } - } - ], - "Status": { - "StatusCode": { - "Value": "500" - }, - "StatusMessage": "SIGNATURE" + "MSS_StatusResp": { + "AP_Info": { + "AP_ID": "mid://test.swisscom.ch", + "AP_TransID": "ID-ee3aaa79-efd5-4828-8708-5e7b2c6cecf0", + "Instant": "2020-12-02T15:19:25.512Z" + }, + "MSSP_Info": { + "Instant": "2020-12-02T15:19:25.879Z", + "MSSP_ID": { + "URI": "http://mid.swisscom.ch/" + } + }, + "MSS_Signature": { + "Base64Signature": "TG9yZW0gSXBzdW0gaXMgc2ltcGx5IGR1bW15IHRleHQgb2YgdGhlIHByaW50aW5nIGFuZCB0eXBlc2V0dGluZyBpbmR1c3RyeS4gTG9yZW0gSXBzdW0gaGFzIGJlZW4gdGhlIGluZHVzdHJ5J3Mgc3RhbmRhcmQgZHVtbXkgdGV4dCBldmVyIHNpbmNlIHRoZSAxNTAwcywgd2hlbiBhbiB1bmtub3duIHByaW50ZXIgdG9vayBhIGdhbGxleSBvZiB0eXBlIGFuZCBzY3JhbWJsZWQgaXQgdG8gbWFrZSBhIHR5cGUgc3BlY2ltZW4gYm9vay4gSXQgaGFzIHN1cnZpdmVkIG5vdCBvbmx5IGZpdmUgY2VudHVyaWVzLCBidXQgYWxzbyB0aGUgbGVhcCBpbnRvIGVsZWN0cm9uaWMgdHlwZXNldHRpbmcsIHJlbWFpbmluZyBlc3NlbnRpYWxseSB1bmNoYW5nZWQuIEl0IHdhcyBwb3B1bGFyaXNlZCBpbiB0aGUgMTk2MHMgd2l0aCB0aGUgcmVsZWFzZSBvZiBMZXRyYXNldCBzaGVldHMgY29udGFpbmluZyBMb3JlbSBJcHN1bSBwYXNzYWdlcywgYW5kIG1vcmUgcmVjZW50bHkgd2l0aCBkZXNrdG9wIHB1Ymxpc2hpbmcgc29mdHdhcmUgbGlrZSBBbGR1cyBQYWdlTWFrZXIgaW5jbHVkaW5nIHZlcnNpb25zIG9mIExvcmVtIElwc3VtLg==" + }, + "MajorVersion": "1", + "MinorVersion": "1", + "MobileUser": { + "MSISDN": "41000092102" + }, + "ServiceResponses": [ + { + "Description": "http://mid.swisscom.ch/as#geofencing", + "Geofencing": { + "Accuracy": "10", + "Country": "RO", + "DeviceConfidence": "0.5", + "LocationConfidence": "1.0", + "Timestamp": "2021-01-01T11:00:00.000+01:00" } + }, + { + "Description": "http://mid.swisscom.ch/as#app2app", + "App2App": { + "AuthUri": "mobileid://auth?mobile_auth_redirect_uri=myapp%3A%2F%2Fapp.open%23access_\ntoken%3DABCD&session_token=32ffc297-0YLukZtgoRVz_wbJJfLnViViEhzk9aXM8\ndkHoOnhqf158&user_id=32ffc297-ac33-4be2-b3f4-42588502ea0f" + } + } + ], + "Status": { + "StatusCode": { + "Value": "500" + }, + "StatusMessage": "SIGNATURE" } + } } \ No newline at end of file diff --git a/mid-java-client-soap/src/main/java/ch/swisscom/mid/client/soap/SoapTrafficHandler.java b/mid-java-client-soap/src/main/java/ch/swisscom/mid/client/soap/SoapTrafficHandler.java index bc46084..781848c 100644 --- a/mid-java-client-soap/src/main/java/ch/swisscom/mid/client/soap/SoapTrafficHandler.java +++ b/mid-java-client-soap/src/main/java/ch/swisscom/mid/client/soap/SoapTrafficHandler.java @@ -15,12 +15,15 @@ */ package ch.swisscom.mid.client.soap; +import ch.swisscom.mid.client.config.ComProtocol; +import ch.swisscom.mid.client.config.RequestTrace; +import ch.swisscom.mid.client.config.ResponseTrace; +import ch.swisscom.mid.client.config.TrafficObserver; +import ch.swisscom.mid.client.impl.Loggers; +import ch.swisscom.mid.client.utils.Utils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.ByteArrayOutputStream; -import java.util.Set; - import javax.xml.XMLConstants; import javax.xml.namespace.QName; import javax.xml.soap.SOAPMessage; @@ -32,13 +35,8 @@ import javax.xml.ws.handler.MessageContext; import javax.xml.ws.handler.soap.SOAPHandler; import javax.xml.ws.handler.soap.SOAPMessageContext; - -import ch.swisscom.mid.client.config.ComProtocol; -import ch.swisscom.mid.client.config.RequestTrace; -import ch.swisscom.mid.client.config.ResponseTrace; -import ch.swisscom.mid.client.config.TrafficObserver; -import ch.swisscom.mid.client.impl.Loggers; -import ch.swisscom.mid.client.utils.Utils; +import java.io.ByteArrayOutputStream; +import java.util.Set; /** * SOAPHandler used to log the contents of incoming and outgoing messages. @@ -48,7 +46,6 @@ public class SoapTrafficHandler implements SOAPHandler { private static final Logger logClient = LoggerFactory.getLogger(Loggers.CLIENT); private static final Logger logRequestResponse = LoggerFactory.getLogger(Loggers.REQUEST_RESPONSE); private static final Logger logFullRequestResponse = LoggerFactory.getLogger(Loggers.FULL_REQUEST_RESPONSE); - private TrafficObserver trafficObserver; // ---------------------------------------------------------------------------------------------------- @@ -66,6 +63,8 @@ public Set getHeaders() { public boolean handleMessage(SOAPMessageContext smc) { boolean isRequestMessage = (Boolean) smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); String soapMessageString = serializeSoapMessageToString(smc); + + if (isRequestMessage) { if (logRequestResponse.isInfoEnabled()) { logRequestResponse.info("Sending SOAP request: [{}]", soapMessageString); @@ -106,7 +105,7 @@ public boolean handleFault(SOAPMessageContext smc) { } public void close(MessageContext messageContext) { - // no code here, nothing to cleanup + // no code here, nothing to clean up } // ---------------------------------------------------------------------------------------------------- @@ -138,6 +137,7 @@ private String convertToPrettyPrintedMessage(SOAPMessage soapMessage) { tff.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); tff.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, ""); tff.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, ""); + Transformer tf = tff.newTransformer(); // Set formatting tf.setOutputProperty(OutputKeys.INDENT, "yes"); @@ -152,5 +152,4 @@ private String convertToPrettyPrintedMessage(SOAPMessage soapMessage) { return null; } } - } diff --git a/mid-java-client-soap/src/main/java/ch/swisscom/mid/client/soap/adapter/MssRequestBuilder.java b/mid-java-client-soap/src/main/java/ch/swisscom/mid/client/soap/adapter/MssRequestBuilder.java index 11c171b..851fa37 100644 --- a/mid-java-client-soap/src/main/java/ch/swisscom/mid/client/soap/adapter/MssRequestBuilder.java +++ b/mid-java-client-soap/src/main/java/ch/swisscom/mid/client/soap/adapter/MssRequestBuilder.java @@ -15,18 +15,20 @@ */ package ch.swisscom.mid.client.soap.adapter; -import org.etsi.uri.ts102204.v1_1.*; - -import java.math.BigInteger; -import java.util.List; - import ch.swisscom.mid.client.config.ClientConfiguration; import ch.swisscom.mid.client.model.*; +import ch.swisscom.mid.client.model.service.AdditionalService; +import ch.swisscom.mid.client.model.service.App2AppAdditionalService; +import ch.swisscom.mid.client.model.service.UserLangAdditionalService; import ch.swisscom.mid.client.utils.Utils; import ch.swisscom.ts102204.ext.v1_0.ReceiptExtensionType; import ch.swisscom.ts102204.ext.v1_0.ReceiptMessagingModeType; import ch.swisscom.ts102204.ext.v1_0.ReceiptProfileType; import fi.ficom.mss.ts102204.v1_0.ObjectFactory; +import org.etsi.uri.ts102204.v1_1.*; + +import java.math.BigInteger; +import java.util.List; public class MssRequestBuilder { @@ -188,8 +190,8 @@ private static MSSSignatureReqType.AdditionalServices createAdditionalServiceLis return null; } MSSSignatureReqType.AdditionalServices serviceList = new MSSSignatureReqType.AdditionalServices(); - List requestedAdditionalService = signatureRequest.getAdditionalServices(); - for (ch.swisscom.mid.client.model.AdditionalService currentAS : requestedAdditionalService) { + List requestedAdditionalService = signatureRequest.getAdditionalServices(); + for (AdditionalService currentAS : requestedAdditionalService) { AdditionalServiceType additionalService = new AdditionalServiceType(); if (currentAS instanceof UserLangAdditionalService) { MssURIType serviceDescription = new MssURIType(); @@ -197,8 +199,17 @@ private static MSSSignatureReqType.AdditionalServices createAdditionalServiceLis additionalService.setDescription(serviceDescription); fi.ficom.mss.ts102204.v1_0.ObjectFactory factory = new ObjectFactory(); additionalService - .getSessionIDOrEventIDOrNoSpamCode() - .add(factory.createUserLang(((UserLangAdditionalService) currentAS).getUserLanguage().getValue())); + .getSessionIDOrEventIDOrNoSpamCode() + .add(factory.createUserLang(((UserLangAdditionalService) currentAS).getUserLanguage().getValue())); + } else if (currentAS instanceof App2AppAdditionalService) { + final MssURIType serviceDescription = new MssURIType(); + serviceDescription.setMssURI(currentAS.getUri()); + additionalService.setDescription(serviceDescription); + ch.swisscom.mid.client.model.App2App app2appRequest = ((App2AppAdditionalService) currentAS).getApp2app(); + final String redirectUri = app2appRequest != null ? app2appRequest.getRedirectUri() : ""; + final org.etsi.uri.ts102204.v1_1.App2App app2App = new org.etsi.uri.ts102204.v1_1.App2App(); + app2App.setRedirectUri(redirectUri); + additionalService.getSessionIDOrEventIDOrNoSpamCode().add(app2App); } else { MssURIType serviceDescription = new MssURIType(); serviceDescription.setMssURI(currentAS.getUri()); @@ -235,7 +246,7 @@ private static StatusDetailType createStatusDetail(ch.swisscom.mid.client.model. StatusDetailType mssStatusDetail = new StatusDetailType(); mssStatusDetail.getRegistrationOutputOrEncryptedRegistrationOutputOrEncryptionCertificates() - .add(objectFactory.createReceiptRequestExtension(mssExtension)); + .add(objectFactory.createReceiptRequestExtension(mssExtension)); return mssStatusDetail; } diff --git a/mid-java-client-soap/src/main/java/ch/swisscom/mid/client/soap/adapter/MssResponseProcessor.java b/mid-java-client-soap/src/main/java/ch/swisscom/mid/client/soap/adapter/MssResponseProcessor.java index 26249eb..0fecd17 100644 --- a/mid-java-client-soap/src/main/java/ch/swisscom/mid/client/soap/adapter/MssResponseProcessor.java +++ b/mid-java-client-soap/src/main/java/ch/swisscom/mid/client/soap/adapter/MssResponseProcessor.java @@ -15,10 +15,25 @@ */ package ch.swisscom.mid.client.soap.adapter; +import ch.swisscom.mid.client.MIDFlowException; +import ch.swisscom.mid.client.config.DefaultConfiguration; +import ch.swisscom.mid.client.config.TrafficObserver; +import ch.swisscom.mid.client.impl.Loggers; +import ch.swisscom.mid.client.model.*; +import ch.swisscom.mid.client.model.service.App2AppAdditionalServiceResponse; +import ch.swisscom.mid.client.model.service.GeofencingAdditionalServiceResponse; +import ch.swisscom.mid.ts102204.as.v1.GeoFencing; +import ch.swisscom.ts102204.ext.v1_0.ReceiptExtensionType; +import fi.ficom.mss.ts102204.v1_0.ServiceResponses; +import fi.methics.ts102204.ext.v1_0.*; +import fi.methics.ts102204.ext.v1_0.MobileUserType; import org.etsi.uri.ts102204.v1_1.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.xml.bind.JAXBElement; +import javax.xml.datatype.XMLGregorianCalendar; +import javax.xml.namespace.QName; import java.math.BigInteger; import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; @@ -29,25 +44,6 @@ import java.util.function.Supplier; import java.util.stream.Collectors; -import javax.xml.bind.JAXBElement; -import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.namespace.QName; - -import ch.swisscom.mid.client.MIDFlowException; -import ch.swisscom.mid.client.config.DefaultConfiguration; -import ch.swisscom.mid.client.config.TrafficObserver; -import ch.swisscom.mid.client.impl.Loggers; -import ch.swisscom.mid.client.model.*; -import ch.swisscom.mid.ts102204.as.v1.GeoFencing; -import ch.swisscom.ts102204.ext.v1_0.ReceiptExtensionType; -import fi.ficom.mss.ts102204.v1_0.ServiceResponses; -import fi.methics.ts102204.ext.v1_0.CertificateType; -import fi.methics.ts102204.ext.v1_0.MobileUserType; -import fi.methics.ts102204.ext.v1_0.PinStatusType; -import fi.methics.ts102204.ext.v1_0.ProfileQueryExtension; -import fi.methics.ts102204.ext.v1_0.SscdListType; -import fi.methics.ts102204.ext.v1_0.SscdType; - public class MssResponseProcessor { private static final Logger logProtocol = LoggerFactory.getLogger(Loggers.CLIENT_PROTOCOL); @@ -77,15 +73,15 @@ public static ProfileResponse processMssProfileQueryResponse(MSSProfileRespType ProfileResponse response = new ProfileResponse(); if (mssResponse.getSignatureProfile() != null) { response.setSignatureProfiles( - mssResponse.getSignatureProfile().stream().map(MssURIType::getMssURI).collect(Collectors.toList())); + mssResponse.getSignatureProfile().stream().map(MssURIType::getMssURI).collect(Collectors.toList())); } if (mssResponse.getStatus() != null && - mssResponse.getStatus().getStatusDetail() != null && - mssResponse.getStatus().getStatusDetail().getRegistrationOutputOrEncryptedRegistrationOutputOrEncryptionCertificates() != null) { + mssResponse.getStatus().getStatusDetail() != null && + mssResponse.getStatus().getStatusDetail().getRegistrationOutputOrEncryptedRegistrationOutputOrEncryptionCertificates() != null) { List profileQueryExtensions = mssResponse - .getStatus() - .getStatusDetail() - .getRegistrationOutputOrEncryptedRegistrationOutputOrEncryptionCertificates(); + .getStatus() + .getStatusDetail() + .getRegistrationOutputOrEncryptedRegistrationOutputOrEncryptionCertificates(); if (profileQueryExtensions.size() == 1) { ProfileQueryExtension mssPQExt = (ProfileQueryExtension) profileQueryExtensions.get(0); if (mssPQExt.getMobileUser() != null) { @@ -94,7 +90,7 @@ public static ProfileResponse processMssProfileQueryResponse(MSSProfileRespType if (mssPQMobileUser != null) { mobileUserInfo.setRecoveryCodeCreated(mssPQMobileUser.isRecoveryCodeCreated()); mobileUserInfo.setAutoActivation(Boolean.parseBoolean( - mssPQMobileUser.getOtherAttributes().get(new QName("AutoActivation")))); + mssPQMobileUser.getOtherAttributes().get(new QName("AutoActivation")))); } response.setMobileUser(mobileUserInfo); } @@ -105,15 +101,15 @@ public static ProfileResponse processMssProfileQueryResponse(MSSProfileRespType if (mssSscds.getSim() != null) { SscdType mssSim = mssSscds.getSim(); response.getSimDevices().add(processDeviceInfo(mssSim::getState, - mssSim::getPinStatus, - mssSim::getMobileUserCertificate)); + mssSim::getPinStatus, + mssSim::getMobileUserCertificate)); } if (mssSscds.getApp() != null && mssSscds.getApp().size() > 0) { List mssAppList = mssSscds.getApp(); for (SscdType mssApp : mssAppList) { response.getAppDevices().add(processDeviceInfo(mssApp::getState, - mssApp::getPinStatus, - mssApp::getMobileUserCertificate)); + mssApp::getPinStatus, + mssApp::getMobileUserCertificate)); } } } @@ -134,9 +130,9 @@ public static SignatureTracking createSignatureTracking(MSSSignatureRespType mss return result; } else { throw new MIDFlowException("Invalid MSS response received. " + - "Cannot parse it and convert it to a valid " + - SignatureTracking.class.getSimpleName(), - MssFaultProcessor.processFailure(FailureReason.MID_INVALID_RESPONSE_FAILURE)); + "Cannot parse it and convert it to a valid " + + SignatureTracking.class.getSimpleName(), + MssFaultProcessor.processFailure(FailureReason.MID_INVALID_RESPONSE_FAILURE)); } } @@ -156,21 +152,21 @@ public static ReceiptResponse processReceiptResponse(MSSReceiptRespType mssRespo } } if (mssStatus.getStatusDetail() != null && - mssStatus.getStatusDetail().getRegistrationOutputOrEncryptedRegistrationOutputOrEncryptionCertificates() != null) { + mssStatus.getStatusDetail().getRegistrationOutputOrEncryptedRegistrationOutputOrEncryptionCertificates() != null) { List mssResponseExtensionList = mssStatus - .getStatusDetail() - .getRegistrationOutputOrEncryptedRegistrationOutputOrEncryptionCertificates(); + .getStatusDetail() + .getRegistrationOutputOrEncryptedRegistrationOutputOrEncryptionCertificates(); if (mssResponseExtensionList.size() == 1) { @SuppressWarnings("unchecked") JAXBElement receiptExtensionTypeElement = - (JAXBElement) mssStatus.getStatusDetail() - .getRegistrationOutputOrEncryptedRegistrationOutputOrEncryptionCertificates() - .get(0); + (JAXBElement) mssStatus.getStatusDetail() + .getRegistrationOutputOrEncryptedRegistrationOutputOrEncryptionCertificates() + .get(0); receiptResponseExtension = processReceiptRespExtension(receiptExtensionTypeElement.getValue()); } else { logProtocol.warn("Expected one MSS receipt extension in the MSS Receipt response. " + - "Instead found [{}] extensions. " + - "Skipping the receipt extension processing altogether", mssResponseExtensionList.size()); + "Instead found [{}] extensions. " + + "Skipping the receipt extension processing altogether", mssResponseExtensionList.size()); } } } @@ -197,9 +193,9 @@ public static SignatureResponse processStatusQueryResponse(MSSStatusRespType mss return result; } else { throw new MIDFlowException("Invalid MSS status response received. " + - "Cannot parse it and convert it to a valid " + - SignatureResponse.class.getSimpleName(), - MssFaultProcessor.processFailure(FailureReason.MID_INVALID_RESPONSE_FAILURE)); + "Cannot parse it and convert it to a valid " + + SignatureResponse.class.getSimpleName(), + MssFaultProcessor.processFailure(FailureReason.MID_INVALID_RESPONSE_FAILURE)); } } @@ -225,38 +221,53 @@ private static Status processStatus(StatusType mssStatus) { } private static List processAdditionalServiceResponses(StatusType mssStatus) { - List resultList = new ArrayList<>(); + List additionalServiceResponses = new ArrayList<>(); if (mssStatus != null) { StatusDetailType mssStatusDetail = mssStatus.getStatusDetail(); if (mssStatusDetail != null) { List mssResponseList = mssStatusDetail.getRegistrationOutputOrEncryptedRegistrationOutputOrEncryptionCertificates(); + logProtocol.debug("processAdditionalServiceResponses(soap) has mssResponseList size=[{}]", mssResponseList.size()); for (Object mssResponse : mssResponseList) { if (mssResponse instanceof ServiceResponses) { ServiceResponses mssServiceResponses = (ServiceResponses) mssResponse; - if (mssServiceResponses.getServiceResponse() != null && - mssServiceResponses.getServiceResponse().size() > 0) { - ServiceResponses.ServiceResponse mssServiceResponse = mssServiceResponses.getServiceResponse().get(0); - if (mssServiceResponse.getDescription() != null && - mssServiceResponse.getDescription().getMssURI() != null) { - String mssServiceUri = mssServiceResponse.getDescription().getMssURI(); + if (mssServiceResponses.getServiceResponse() != null && !mssServiceResponses.getServiceResponse().isEmpty()) { + logProtocol.debug("processAdditionalServiceResponses(soap) has mssServiceResponses.getServiceResponse()=[{}]", mssServiceResponses.getServiceResponse().size()); + for (ServiceResponses.ServiceResponse mssServiceResponse : mssServiceResponses.getServiceResponse()) { + if (mssServiceResponse.getDescription() != null && + mssServiceResponse.getDescription().getMssURI() != null) { + String mssServiceUri = mssServiceResponse.getDescription().getMssURI(); + logProtocol.debug("mssServiceUri is=[{}]", mssServiceUri); + + if (DefaultConfiguration.ADDITIONAL_SERVICE_GEOFENCING.equals(mssServiceUri) + && mssServiceResponse.getGeoFencing() != null) { + final GeoFencing geofencing = mssServiceResponse.getGeoFencing(); + final GeofencingAdditionalServiceResponse geoResponse = new GeofencingAdditionalServiceResponse(); + if (geofencing.getErrorcode() == null) { + geoResponse.setCountry(geofencing.getCountry()); + geoResponse.setAccuracy(geofencing.getAccuracy() == null ? 0 : Integer.parseInt(geofencing.getAccuracy())); + geoResponse.setTimestamp(gregorianCalendarToString(geofencing.getTimestamp())); + geoResponse.setDeviceConfidence(geofencing.getDeviceconfidence()); + geoResponse.setLocationConfidence(geofencing.getLocationconfidence()); + } else { + geoResponse.setErrorCode(GeofencingErrorCode.getByCodeAsString( + geofencing.getErrorcode() == null ? null : geofencing.getErrorcode().toString())); + geoResponse.setErrorMessage(geofencing.getErrormessage()); + } + additionalServiceResponses.add(geoResponse); + } + + if (DefaultConfiguration.ADDITIONAL_SERVICE_APP2APP.equals(mssServiceUri)) { - if (DefaultConfiguration.ADDITIONAL_SERVICE_GEOFENCING.equals(mssServiceUri) - && mssServiceResponse.getGeoFencing() != null) { + fi.ficom.mss.ts102204.v1_0.App2App app2AppResp = mssServiceResponse.getApp2App(); + final App2AppAdditionalServiceResponse app2AppAdditionalServiceResponse = new App2AppAdditionalServiceResponse(); + logProtocol.debug("app2AppResp=[{}]", app2AppResp); - GeoFencing geofencing = mssServiceResponse.getGeoFencing(); - GeofencingAdditionalServiceResponse geoResponse = new GeofencingAdditionalServiceResponse(); - if (geofencing.getErrorcode() == null) { - geoResponse.setCountry(geofencing.getCountry()); - geoResponse.setAccuracy(geofencing.getAccuracy() == null ? 0 : Integer.parseInt(geofencing.getAccuracy())); - geoResponse.setTimestamp(gregorianCalendarToString(geofencing.getTimestamp())); - geoResponse.setDeviceConfidence(geofencing.getDeviceconfidence()); - geoResponse.setLocationConfidence(geofencing.getLocationconfidence()); - } else { - geoResponse.setErrorCode(GeofencingErrorCode.getByCodeAsString( - geofencing.getErrorcode() == null ? null : geofencing.getErrorcode().toString())); - geoResponse.setErrorMessage(geofencing.getErrormessage()); + if (app2AppResp != null) { + logProtocol.debug("app2AppResp.getAuthUri()=[{}]", app2AppResp.getAuthUri()); + app2AppAdditionalServiceResponse.setAuthUri(app2AppResp.getAuthUri()); + } + additionalServiceResponses.add(app2AppAdditionalServiceResponse); } - resultList.add(geoResponse); } } } @@ -264,7 +275,7 @@ private static List processAdditionalServiceResponses } } } - return resultList; + return additionalServiceResponses; } private static Status getGenericErrorStatus(String statusMessage) { @@ -294,7 +305,7 @@ private static ProfileDeviceInfo processDeviceInfo(Supplier stateSupplie if (mssCertElementList != null && mssCertElementList.size() > 0) { CertificateData certificateData = new CertificateData(); certificateData.setCertificateAsBase64( - Base64.getEncoder().encodeToString(((JAXBElement) mssCertElementList.get(0)).getValue())); + Base64.getEncoder().encodeToString(((JAXBElement) mssCertElementList.get(0)).getValue())); if (mssCertElementList.size() > 1) { certificateData.setSubjectName(((JAXBElement) mssCertElementList.get(1)).getValue()); } @@ -304,7 +315,7 @@ private static ProfileDeviceInfo processDeviceInfo(Supplier stateSupplie for (int index = 2; index < mssCertElementList.size(); index += 2) { certificateData = new CertificateData(); certificateData.setCertificateAsBase64( - Base64.getEncoder().encodeToString(((JAXBElement) mssCertElementList.get(0)).getValue())); + Base64.getEncoder().encodeToString(((JAXBElement) mssCertElementList.get(0)).getValue())); if (index + 1 < mssCertElementList.size()) { certificateData.setSubjectName(((JAXBElement) mssCertElementList.get(index + 1)).getValue()); } diff --git a/mid-java-client-soap/src/main/resources/wsdl/schema/ficom/ficom.xsd b/mid-java-client-soap/src/main/resources/wsdl/schema/ficom/ficom.xsd index e644930..6ccd111 100644 --- a/mid-java-client-soap/src/main/resources/wsdl/schema/ficom/ficom.xsd +++ b/mid-java-client-soap/src/main/resources/wsdl/schema/ficom/ficom.xsd @@ -1,84 +1,96 @@ - + xmlns:as="http://mid.swisscom.ch/TS102204/as/v1.0" + xmlns:fi="http://mss.ficom.fi/TS102204/v1.0.0#" + elementFormDefault="qualified"> - + + + + + + + - - - - - + + + + + + + + + + + - - - - - - - - - + + + - - - - - + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + - - - - - + + - - - - - - - - + + + + + + + + diff --git a/mid-java-client-soap/src/main/resources/wsdl/schema/methics/MSS-App2AppAsResponse.xsd b/mid-java-client-soap/src/main/resources/wsdl/schema/methics/MSS-App2AppAsResponse.xsd new file mode 100644 index 0000000..f471100 --- /dev/null +++ b/mid-java-client-soap/src/main/resources/wsdl/schema/methics/MSS-App2AppAsResponse.xsd @@ -0,0 +1,17 @@ + + + + + + Additional Services defined here: + - App2App URI: http://mid.swisscom.ch/as#app2app + + Revision history: + - March 2026: Initial schema for Swisscom MID additional services App2app Additional Service + + + + + diff --git a/mid-java-client-soap/src/main/resources/wsdl/schema/methics/MSS-SubscriberInfo.xsd b/mid-java-client-soap/src/main/resources/wsdl/schema/methics/MSS-SubscriberInfo.xsd index 4405553..2fed0e9 100644 --- a/mid-java-client-soap/src/main/resources/wsdl/schema/methics/MSS-SubscriberInfo.xsd +++ b/mid-java-client-soap/src/main/resources/wsdl/schema/methics/MSS-SubscriberInfo.xsd @@ -19,7 +19,7 @@ - @@ -41,5 +41,4 @@ - diff --git a/mid-java-client-soap/src/main/resources/wsdl/schema/methics/MSS-plus-Mobile-Ink.xsd b/mid-java-client-soap/src/main/resources/wsdl/schema/methics/MSS-plus-Mobile-Ink.xsd index 82688dc..ca744fe 100644 --- a/mid-java-client-soap/src/main/resources/wsdl/schema/methics/MSS-plus-Mobile-Ink.xsd +++ b/mid-java-client-soap/src/main/resources/wsdl/schema/methics/MSS-plus-Mobile-Ink.xsd @@ -388,6 +388,7 @@ + @@ -425,4 +426,12 @@ - + + + + + + + + + diff --git a/mid-java-client-soap/src/main/resources/wsdl/schema/w3/soap-rpc.xsd b/mid-java-client-soap/src/main/resources/wsdl/schema/w3/soap-rpc.xsd new file mode 100644 index 0000000..6e3d60a --- /dev/null +++ b/mid-java-client-soap/src/main/resources/wsdl/schema/w3/soap-rpc.xsd @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + diff --git a/mid-java-client-soap/src/test/java/ch/swisscom/mid/client/soap/AsyncSignatureTest.java b/mid-java-client-soap/src/test/java/ch/swisscom/mid/client/soap/AsyncSignatureTest.java index e7ae411..2069a08 100644 --- a/mid-java-client-soap/src/test/java/ch/swisscom/mid/client/soap/AsyncSignatureTest.java +++ b/mid-java-client-soap/src/test/java/ch/swisscom/mid/client/soap/AsyncSignatureTest.java @@ -1,127 +1 @@ -/* - * Copyright 2021 Swisscom (Schweiz) AG - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package ch.swisscom.mid.client.soap; - -import ch.swisscom.mid.client.MIDClient; -import ch.swisscom.mid.client.config.DefaultConfiguration; -import ch.swisscom.mid.client.impl.MIDClientImpl; -import ch.swisscom.mid.client.model.*; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.github.tomakehurst.wiremock.WireMockServer; -import com.github.tomakehurst.wiremock.stubbing.Scenario; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import static ch.swisscom.mid.client.soap.TestData.CONTENT_TYPE_SOAP_XML; -import static ch.swisscom.mid.client.soap.TestSupport.*; -import static com.github.tomakehurst.wiremock.client.WireMock.*; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; - -public class AsyncSignatureTest { - - private static WireMockServer server; - private static MIDClient client; - - @BeforeAll - public static void setUpThisClass() { - server = new WireMockServer(options().port(8089)); - server.start(); - - client = new MIDClientImpl(buildConfig(buildTlsConfig("TLSv1.2"))); - } - - @AfterAll - public static void tearDownThisClass() { - client.close(); - server.stop(); - } - - // ---------------------------------------------------------------------------------------------------- - - @Test - public void testSignature_success() throws JsonProcessingException { - server.stubFor( - post(urlEqualTo(DefaultConfiguration.SOAP_SIGNATURE_PORT_SUB_URL)) - .inScenario("Async signature") - .whenScenarioStateIs(Scenario.STARTED) - .willReturn( - aResponse() - .withHeader("Content-Type", CONTENT_TYPE_SOAP_XML) - .withBody(fileToString("/samples/soap-response-async-signature.xml"))) - .willSetStateTo("Signature running - poll 0")); - - server.stubFor( - post(urlEqualTo(DefaultConfiguration.SOAP_STATUS_QUERY_PORT_SUB_URL)) - .inScenario("Async signature") - .whenScenarioStateIs("Signature running - poll 0") - .willReturn( - aResponse() - .withHeader("Content-Type", CONTENT_TYPE_SOAP_XML) - .withBody(fileToString("/samples/soap-response-status-outstanding.xml"))) - .willSetStateTo("Signature running - poll 1") - ); - - server.stubFor( - post(urlEqualTo(DefaultConfiguration.SOAP_STATUS_QUERY_PORT_SUB_URL)) - .inScenario("Async signature") - .whenScenarioStateIs("Signature running - poll 1") - .willReturn( - aResponse() - .withHeader("Content-Type", CONTENT_TYPE_SOAP_XML) - .withBody(fileToString("/samples/soap-response-status-signature.xml"))) - .willSetStateTo("Signature finished") - ); - - SignatureRequest signatureRequest = buildSignatureRequest(); - SignatureResponse response = client.requestAsyncSignature(signatureRequest); - assertThat(response.getStatus().getStatusCode(), is(StatusCode.REQUEST_OK)); - assertThat(response.getStatus().getStatusCodeString(), is("100")); - assertThat(response.getStatus().getStatusMessage(), is("REQUEST_OK")); - assertThat(response.getSignatureProfile(), is(TestData.CUSTOM_SIGNATURE_PROFILE)); - assertThat(response.getTracking(), is(notNullValue())); - assertThat(response.getTracking().getMobileUserMsisdn(), is(TestData.MSISDN)); - assertThat(response.getTracking().getTransactionId(), is(TestData.CUSTOM_TRANS_ID)); - - response = client.pollForSignatureStatus(response.getTracking()); - assertThat(response.getStatus().getStatusCode(), is(StatusCode.OUTSTANDING_TRANSACTION)); - assertThat(response.getStatus().getStatusCodeString(), is("504")); - - response = client.pollForSignatureStatus(response.getTracking()); - assertThat(response.getStatus().getStatusCode(), is(StatusCode.SIGNATURE)); - assertThat(response.getStatus().getStatusCodeString(), is("500")); - assertThat(response.getBase64Signature(), is(notNullValue())); - assertThat(response.getBase64Signature().length(), is(TestData.BASE64_SIGNATURE_LENGTH)); - assertResponseTo(response, "/samples/soap-response-status-signature-expected.json"); - } - - // ---------------------------------------------------------------------------------------------------- - - private static SignatureRequest buildSignatureRequest() { - SignatureRequest request = new SignatureRequest(); - request.setUserLanguage(UserLanguage.ENGLISH); - request.getDataToBeSigned().setData("Test: Do you want to login?"); - request.getDataToBeSigned().setEncodingToUtf8(); - request.getDataToBeSigned().setMimeTypeToTextPlain(); - request.getMobileUser().setMsisdn(TestData.MSISDN); - request.setSignatureProfile(SignatureProfiles.DEFAULT_PROFILE); - request.addAdditionalService(new GeofencingAdditionalService()); - return request; - } -} +/* * Copyright 2026 Swisscom (Schweiz) AG * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ch.swisscom.mid.client.soap; import ch.swisscom.mid.client.MIDClient; import ch.swisscom.mid.client.config.DefaultConfiguration; import ch.swisscom.mid.client.impl.MIDClientImpl; import ch.swisscom.mid.client.model.*; import ch.swisscom.mid.client.model.service.*; import com.fasterxml.jackson.core.JsonProcessingException; import com.github.tomakehurst.wiremock.WireMockServer; import com.github.tomakehurst.wiremock.stubbing.Scenario; import org.junit.jupiter.api.*; import java.util.Arrays; import java.util.List; import static ch.swisscom.mid.client.soap.TestData.CONTENT_TYPE_SOAP_XML; import static ch.swisscom.mid.client.soap.TestSupport.*; import static com.github.tomakehurst.wiremock.client.WireMock.*; import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; /** * SOAP Async signature test class. Tests the flow of requesting an asynchronous signature and then polling for the status until the signature is ready. * Also tests the case where additional services are requested together with the signature, * and that the responses for those additional services are correctly parsed and returned in the response from the client. */ public class AsyncSignatureTest { private static WireMockServer server; private static MIDClient client; @BeforeAll public static void beforeAll() { client = new MIDClientImpl(buildConfig(buildTlsConfig("TLSv1.2"))); } @AfterAll public static void afterAll() { client.close(); } @BeforeEach public void setUp() { server = new WireMockServer(options().port(8089)); server.start(); } @AfterEach public void tearDown() { server.stop(); } // ---------------------------------------------------------------------------------------------------- @Test public void testSignature_success() throws JsonProcessingException { server.stubFor( post(urlEqualTo(DefaultConfiguration.SOAP_SIGNATURE_PORT_SUB_URL)) .inScenario("Async signature") .whenScenarioStateIs(Scenario.STARTED) .willReturn( aResponse() .withHeader("Content-Type", CONTENT_TYPE_SOAP_XML) .withBody(fileToString("/samples/soap-response-async-signature.xml"))) .willSetStateTo("Signature running - poll 0")); server.stubFor( post(urlEqualTo(DefaultConfiguration.SOAP_STATUS_QUERY_PORT_SUB_URL)) .inScenario("Async signature") .whenScenarioStateIs("Signature running - poll 0") .willReturn( aResponse() .withHeader("Content-Type", CONTENT_TYPE_SOAP_XML) .withBody(fileToString("/samples/soap-response-status-outstanding.xml"))) .willSetStateTo("Signature running - poll 1") ); server.stubFor( post(urlEqualTo(DefaultConfiguration.SOAP_STATUS_QUERY_PORT_SUB_URL)) .inScenario("Async signature") .whenScenarioStateIs("Signature running - poll 1") .willReturn( aResponse() .withHeader("Content-Type", CONTENT_TYPE_SOAP_XML) .withBody(fileToString("/samples/soap-response-status-signature.xml"))) .willSetStateTo("Signature finished") ); SignatureRequest signatureRequest = buildSignatureRequest(); SignatureResponse response = client.requestAsyncSignature(signatureRequest); assertInitialDefaultStatusOk(response); assertThat(response.getSignatureProfile(), is(TestData.CUSTOM_SIGNATURE_PROFILE)); assertThat(response.getTracking(), is(notNullValue())); assertThat(response.getTracking().getMobileUserMsisdn(), is(TestData.MSISDN)); assertThat(response.getTracking().getTransactionId(), is(TestData.CUSTOM_TRANS_ID)); response = client.pollForSignatureStatus(response.getTracking()); assertStatus(response, StatusCode.OUTSTANDING_TRANSACTION, "504"); response = client.pollForSignatureStatus(response.getTracking()); assertStatus(response, StatusCode.SIGNATURE, "500"); assertSignature(response, notNullValue(), TestData.BASE64_SIGNATURE_LENGTH); assertResponseTo(response, "/samples/soap-response-status-signature-expected.json"); } @Test public void testSignatureWithApp2AppAndGeo_success() throws JsonProcessingException { server.stubFor( post(urlEqualTo(DefaultConfiguration.SOAP_SIGNATURE_PORT_SUB_URL)) .inScenario("Async signature") .whenScenarioStateIs(Scenario.STARTED) .willReturn( aResponse() .withHeader("Content-Type", CONTENT_TYPE_SOAP_XML) // .withBody(fileToString("/samples/soap-response-async-signature.xml"))) .withBody(fileToString("/samples/soap-response-async-signature-app2app-geo.xml"))) .willSetStateTo("Signature running - poll 0")); final List additionalSrv = Arrays.asList( new GeofencingAdditionalService(), new App2AppAdditionalService("myapp://example-soap-app")); SignatureRequest signatureRequest = buildSignatureRequestWithServices(additionalSrv); SignatureResponse response = client.requestAsyncSignature(signatureRequest); assertInitialDefaultStatusOk(response); assertThat(response.getSignatureProfile(), is(TestData.CUSTOM_SIGNATURE_PROFILE)); assertThat(response.getTracking(), is(notNullValue())); assertThat(response.getTracking().getMobileUserMsisdn(), is(TestData.MSISDN)); assertThat(response.getTracking().getTransactionId(), is(TestData.CUSTOM_TRANS_ID)); assertThat(response.getAdditionalServiceResponses().size(), is(2)); // assertResponseTo(response, "/samples/soap-response-status-signature-expected-app2app-geo.json"); final GeofencingAdditionalServiceResponse geofencingResponse = (GeofencingAdditionalServiceResponse) response.getAdditionalServiceResponses().get(0); assertOnGeofencingResponse(geofencingResponse, "CH", 10, "0.5", "1.0", "2026-03-10T11:00:00.000+01:00"); final App2AppAdditionalServiceResponse app2appResponse = (App2AppAdditionalServiceResponse) response.getAdditionalServiceResponses().get(1); assertOnApp2AppResponse(app2appResponse, "mobileid://auth?mobile_auth_redirect_uri=myapp%3A%2F%2Fapp.open%23access_token%3DABCD&session_token=32ffc297-0YLukZtgoRVz_wbJJfLnViViEhzk9aXM8dkHoOnhqf158&user_id=32ffc297-ac33-4be2-b3f4-42588502ea0f"); } @Test public void testSignatureWithApp2AppOnly_success() throws JsonProcessingException { server.stubFor( post(urlEqualTo(DefaultConfiguration.SOAP_SIGNATURE_PORT_SUB_URL)) .inScenario("Async signature") .whenScenarioStateIs(Scenario.STARTED) .willReturn( aResponse() .withHeader("Content-Type", CONTENT_TYPE_SOAP_XML) .withBody(fileToString("/samples/soap-response-async-signature-app2app.xml"))) .willSetStateTo("Signature running - poll 0")); final List additionalSer = Arrays.asList(new App2AppAdditionalService("myapp://example-soap-app")); SignatureRequest signatureRequest = buildSignatureRequestWithServices(additionalSer); SignatureResponse response = client.requestAsyncSignature(signatureRequest); assertInitialDefaultStatusOk(response); assertThat(response.getSignatureProfile(), is(TestData.CUSTOM_SIGNATURE_PROFILE)); assertThat(response.getTracking(), is(notNullValue())); assertThat(response.getTracking().getMobileUserMsisdn(), is(TestData.MSISDN)); assertThat(response.getTracking().getTransactionId(), is(TestData.CUSTOM_TRANS_ID)); assertThat(response.getAdditionalServiceResponses().size(), is(1)); //assertResponseTo(response, "/samples/soap-response-status-signature-expected-app2app-only.json"); final App2AppAdditionalServiceResponse app2appResponse = (App2AppAdditionalServiceResponse) response.getAdditionalServiceResponses().get(0); assertOnApp2AppResponse(app2appResponse, "mobileid://auth?mobile_auth_redirect_uri=myapp%3A%2F%2Fapp.open%23access_token%3DABCD&session_token=32ffc297-0YLukZtgoRVz_wbJJfLnViViEhzk9aXM8dkHoOnhqf158&user_id=32ffc297-ac33-4be2-b3f4-42588502ea0f"); } // ---------------------------------------------------------------------------------------------------- private static SignatureRequest buildSignatureRequest() { SignatureRequest request = new SignatureRequest(); request.setUserLanguage(UserLanguage.ENGLISH); request.getDataToBeSigned().setData("Test: Do you want to login?"); request.getDataToBeSigned().setEncodingToUtf8(); request.getDataToBeSigned().setMimeTypeToTextPlain(); request.getMobileUser().setMsisdn(TestData.MSISDN); request.setSignatureProfile(SignatureProfiles.DEFAULT_PROFILE); request.addAdditionalService(new GeofencingAdditionalService()); return request; } private static SignatureRequest buildSignatureRequestWithServices(List services) { SignatureRequest request = new SignatureRequest(); request.setUserLanguage(UserLanguage.ENGLISH); request.getDataToBeSigned().setData("Test: Do you want to login?"); request.getDataToBeSigned().setEncodingToUtf8(); request.getDataToBeSigned().setMimeTypeToTextPlain(); request.getMobileUser().setMsisdn(TrialNumbers.ONE_THAT_GIVES_MISSING_PARAM); request.setSignatureProfile(SignatureProfiles.DEFAULT_PROFILE); for (AdditionalService service : services) { request.addAdditionalService(service); } return request; } private void assertOnGeofencingResponse(GeofencingAdditionalServiceResponse geoResp, String country, int accuracy, String deviceConfidence, String locationConfidence, String timestamp) { assertThat(geoResp.getCountry(), is(country)); assertThat(geoResp.getAccuracy(), is(accuracy)); assertThat(geoResp.getDeviceConfidence(), is(deviceConfidence)); assertThat(geoResp.getLocationConfidence(), is(locationConfidence)); assertThat(geoResp.getTimestamp(), is(timestamp)); assertThat(geoResp.getErrorCode(), is(nullValue())); assertThat(geoResp.getErrorMessage(), is(nullValue())); } private void assertOnApp2AppResponse(App2AppAdditionalServiceResponse a2a, String authUri) { assertThat(a2a, is(notNullValue())); assertThat(a2a, instanceOf(App2AppAdditionalServiceResponse.class)); assertThat(a2a.getAuthUri(), is(notNullValue())); assertThat(a2a.getAuthUri(), is(authUri)); } private static void assertInitialDefaultStatusOk(SignatureResponse response) { assertThat(response.getStatus().getStatusCode(), is(StatusCode.REQUEST_OK)); assertThat(response.getStatus().getStatusCodeString(), is("100")); assertThat(response.getStatus().getStatusMessage(), is("REQUEST_OK")); } private static void assertStatus(SignatureResponse response, StatusCode status, String code) { assertThat(response.getStatus().getStatusCode(), is(status)); assertThat(response.getStatus().getStatusCodeString(), is(code)); } private static void assertSignature(SignatureResponse response, org.hamcrest.Matcher matcher, int length) { assertThat(response.getBase64Signature(), is(matcher)); assertThat(response.getBase64Signature().length(), is(length)); } } \ No newline at end of file diff --git a/mid-java-client-soap/src/test/resources/samples/soap-response-async-signature-app2app-geo.xml b/mid-java-client-soap/src/test/resources/samples/soap-response-async-signature-app2app-geo.xml new file mode 100644 index 0000000..d4db901 --- /dev/null +++ b/mid-java-client-soap/src/test/resources/samples/soap-response-async-signature-app2app-geo.xml @@ -0,0 +1,51 @@ + + + + + + + + + + http://mid.swisscom.ch/ + + + + 418888888888 + + + http://mid.swisscom.ch/My-Custom-Profile + + + + REQUEST_OK + + + + + http://mid.swisscom.ch/as#geofencing + + + + + + http://mid.swisscom.ch/as#app2app + + + mobileid://auth?mobile_auth_redirect_uri=myapp%3A%2F%2Fapp.open%23access_token%3DABCD&session_token=32ffc297-0YLukZtgoRVz_wbJJfLnViViEhzk9aXM8dkHoOnhqf158&user_id=32ffc297-ac33-4be2-b3f4-42588502ea0f + + + + + + + + + diff --git a/mid-java-client-soap/src/test/resources/samples/soap-response-async-signature-app2app.xml b/mid-java-client-soap/src/test/resources/samples/soap-response-async-signature-app2app.xml new file mode 100644 index 0000000..244fd62 --- /dev/null +++ b/mid-java-client-soap/src/test/resources/samples/soap-response-async-signature-app2app.xml @@ -0,0 +1,40 @@ + + + + + + + + + + http://mid.swisscom.ch/ + + + + 418888888888 + + + http://mid.swisscom.ch/My-Custom-Profile + + + + REQUEST_OK + + + + + http://mid.swisscom.ch/as#app2app + + + mobileid://auth?mobile_auth_redirect_uri=myapp%3A%2F%2Fapp.open%23access_token%3DABCD&session_token=32ffc297-0YLukZtgoRVz_wbJJfLnViViEhzk9aXM8dkHoOnhqf158&user_id=32ffc297-ac33-4be2-b3f4-42588502ea0f + + + + + + + + + diff --git a/mid-java-client-soap/src/test/resources/samples/soap-response-status-signature-app2app-only.xml b/mid-java-client-soap/src/test/resources/samples/soap-response-status-signature-app2app-only.xml new file mode 100644 index 0000000..69d1b14 --- /dev/null +++ b/mid-java-client-soap/src/test/resources/samples/soap-response-status-signature-app2app-only.xml @@ -0,0 +1,41 @@ + + + + + + + + + + http://mid.swisscom.ch/ + + + + 418888888888 + + + + TG9yZW0gSXBzdW0gaXMgc2ltcGx5IGR1bW15IHRleHQgb2YgdGhlIHByaW50aW5nIGFuZCB0eXBlc2V0dGluZyBpbmR1c3RyeS4gTG9yZW0gSXBzdW0gaGFzIGJlZW4gdGhlIGluZHVzdHJ5J3Mgc3RhbmRhcmQgZHVtbXkgdGV4dCBldmVyIHNpbmNlIHRoZSAxNTAwcywgd2hlbiBhbiB1bmtub3duIHByaW50ZXIgdG9vayBhIGdhbGxleSBvZiB0eXBlIGFuZCBzY3JhbWJsZWQgaXQgdG8gbWFrZSBhIHR5cGUgc3BlY2ltZW4gYm9vay4gSXQgaGFzIHN1cnZpdmVkIG5vdCBvbmx5IGZpdmUgY2VudHVyaWVzLCBidXQgYWxzbyB0aGUgbGVhcCBpbnRvIGVsZWN0cm9uaWMgdHlwZXNldHRpbmcsIHJlbWFpbmluZyBlc3NlbnRpYWxseSB1bmNoYW5nZWQuIEl0IHdhcyBwb3B1bGFyaXNlZCBpbiB0aGUgMTk2MHMgd2l0aCB0aGUgcmVsZWFzZSBvZiBMZXRyYXNldCBzaGVldHMgY29udGFpbmluZyBMb3JlbSBJcHN1bSBwYXNzYWdlcywgYW5kIG1vcmUgcmVjZW50bHkgd2l0aCBkZXNrdG9wIHB1Ymxpc2hpbmcgc29mdHdhcmUgbGlrZSBBbGR1cyBQYWdlTWFrZXIgaW5jbHVkaW5nIHZlcnNpb25zIG9mIExvcmVtIElwc3VtLg== + + + + + SIGNATURE + + + + + http://mid.swisscom.ch/as#app2app + + + + + + + + + + \ No newline at end of file diff --git a/mid-java-client-soap/src/test/resources/samples/soap-response-status-signature-app2app.xml b/mid-java-client-soap/src/test/resources/samples/soap-response-status-signature-app2app.xml new file mode 100644 index 0000000..65f4110 --- /dev/null +++ b/mid-java-client-soap/src/test/resources/samples/soap-response-status-signature-app2app.xml @@ -0,0 +1,52 @@ + + + + + + + + + + http://mid.swisscom.ch/ + + + + 418888888888 + + + + TG9yZW0gSXBzdW0gaXMgc2ltcGx5IGR1bW15IHRleHQgb2YgdGhlIHByaW50aW5nIGFuZCB0eXBlc2V0dGluZyBpbmR1c3RyeS4gTG9yZW0gSXBzdW0gaGFzIGJlZW4gdGhlIGluZHVzdHJ5J3Mgc3RhbmRhcmQgZHVtbXkgdGV4dCBldmVyIHNpbmNlIHRoZSAxNTAwcywgd2hlbiBhbiB1bmtub3duIHByaW50ZXIgdG9vayBhIGdhbGxleSBvZiB0eXBlIGFuZCBzY3JhbWJsZWQgaXQgdG8gbWFrZSBhIHR5cGUgc3BlY2ltZW4gYm9vay4gSXQgaGFzIHN1cnZpdmVkIG5vdCBvbmx5IGZpdmUgY2VudHVyaWVzLCBidXQgYWxzbyB0aGUgbGVhcCBpbnRvIGVsZWN0cm9uaWMgdHlwZXNldHRpbmcsIHJlbWFpbmluZyBlc3NlbnRpYWxseSB1bmNoYW5nZWQuIEl0IHdhcyBwb3B1bGFyaXNlZCBpbiB0aGUgMTk2MHMgd2l0aCB0aGUgcmVsZWFzZSBvZiBMZXRyYXNldCBzaGVldHMgY29udGFpbmluZyBMb3JlbSBJcHN1bSBwYXNzYWdlcywgYW5kIG1vcmUgcmVjZW50bHkgd2l0aCBkZXNrdG9wIHB1Ymxpc2hpbmcgc29mdHdhcmUgbGlrZSBBbGR1cyBQYWdlTWFrZXIgaW5jbHVkaW5nIHZlcnNpb25zIG9mIExvcmVtIElwc3VtLg== + + + + + SIGNATURE + + + + + http://mid.swisscom.ch/as#geofencing + + + + + + + http://mid.swisscom.ch/as#app2app + + + + + + + + + \ No newline at end of file diff --git a/mid-java-client-soap/src/test/resources/samples/soap-response-status-signature-expected-app2app-geo.json b/mid-java-client-soap/src/test/resources/samples/soap-response-status-signature-expected-app2app-geo.json new file mode 100644 index 0000000..3669954 --- /dev/null +++ b/mid-java-client-soap/src/test/resources/samples/soap-response-status-signature-expected-app2app-geo.json @@ -0,0 +1,36 @@ +{ + "majorVersion": null, + "minorVersion": null, + "signatureProfile": "http://mid.swisscom.ch/My-Custom-Profile", + "base64Signature": null, + "status": { + "statusCodeString": "100", + "statusCode": "REQUEST_OK", + "statusMessage": "REQUEST_OK" + }, + "tracking": { + "majorVersion": "1", + "minorVersion": "1", + "overrideApId": null, + "overrideApPassword": null, + "transactionId": "CAFE_BABE", + "mobileUserMsisdn": "418888888888", + "trafficObserver": null + }, + "additionalServiceResponses": [ + { + "uri": "http://mid.swisscom.ch/as#geofencing", + "errorCode": null, + "errorMessage": null, + "country": "CH", + "accuracy": 10, + "timestamp": "2026-03-10T11:00:00.000+01:00", + "deviceConfidence": "0.5", + "locationConfidence": "1.0" + }, + { + "uri": "http://mid.swisscom.ch/as#app2app", + "authUri": "mobileid://auth?mobile_auth_redirect_uri=myapp%3A%2F%2Fapp.open%23access_token%3DABCD&session_token=32ffc297-0YLukZtgoRVz_wbJJfLnViViEhzk9aXM8dkHoOnhqf158&user_id=32ffc297-ac33-4be2-b3f4-42588502ea0f" + } + ] +} \ No newline at end of file diff --git a/mid-java-client-soap/src/test/resources/samples/soap-response-status-signature-expected-app2app-only.json b/mid-java-client-soap/src/test/resources/samples/soap-response-status-signature-expected-app2app-only.json new file mode 100644 index 0000000..2aeaae1 --- /dev/null +++ b/mid-java-client-soap/src/test/resources/samples/soap-response-status-signature-expected-app2app-only.json @@ -0,0 +1,26 @@ +{ + "majorVersion": null, + "minorVersion": null, + "signatureProfile": "http://mid.swisscom.ch/My-Custom-Profile", + "base64Signature": null, + "status": { + "statusCodeString": "100", + "statusCode": "REQUEST_OK", + "statusMessage": "REQUEST_OK" + }, + "tracking": { + "majorVersion": "1", + "minorVersion": "1", + "overrideApId": null, + "overrideApPassword": null, + "transactionId": "CAFE_BABE", + "mobileUserMsisdn": "418888888888", + "trafficObserver": null + }, + "additionalServiceResponses": [ + { + "uri": "http://mid.swisscom.ch/as#app2app", + "authUri": "mobileid://auth?mobile_auth_redirect_uri=myapp%3A%2F%2Fapp.open%23access_token%3DABCD&session_token=32ffc297-0YLukZtgoRVz_wbJJfLnViViEhzk9aXM8dkHoOnhqf158&user_id=32ffc297-ac33-4be2-b3f4-42588502ea0f"" \n" + } + ] +} \ No newline at end of file diff --git a/mid-java-client-usage/src/main/java/ch/swisscom/mid/client/cli/Cli.java b/mid-java-client-usage/src/main/java/ch/swisscom/mid/client/cli/Cli.java index f66170b..41236bc 100644 --- a/mid-java-client-usage/src/main/java/ch/swisscom/mid/client/cli/Cli.java +++ b/mid-java-client-usage/src/main/java/ch/swisscom/mid/client/cli/Cli.java @@ -10,8 +10,12 @@ import ch.swisscom.mid.client.impl.MIDClientImpl; import ch.swisscom.mid.client.impl.SignatureValidatorImpl; import ch.swisscom.mid.client.model.*; +import ch.swisscom.mid.client.model.service.App2AppAdditionalService; +import ch.swisscom.mid.client.model.service.App2AppAdditionalServiceResponse; +import ch.swisscom.mid.client.model.service.GeofencingAdditionalService; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -25,14 +29,16 @@ /** * Command line interface for the Mobile ID client. Allows the running of the MID Client from the command line, with most of * the configuration parameters read from a properties file and only the most important parameters given through the command arguments. - * + *

* Examples: * ./mid-client.sh -help * ./mid-client.sh -profile-query -msisdn=4071111111111 * ./mid-client.sh -sign -sync -msisdn=4071111111111 -lang=en "-dtbs=Do you want to login?" -receipt * ./mid-client.sh -sign -async -msisdn=4071111111111 -lang=en "-dtbs=Do you want to login?" -receipt * ./mid-client.sh -sign -async -msisdn 4071111111111 -lang en -dtbs "Do you want to login?" -receipt + * ./bin/mid-client.sh -sign -async -msisdn=41790000000 -lang=en -app2app="myapp://example" -dtbs="Do you want to login?" -rest -vv * ./mid-client.sh -get-mid-sn -msisdn 4071111111111 -lang en + * */ public class Cli { @@ -54,6 +60,8 @@ public class Cli { private static final String PARAM_REST = "rest"; private static final String PARAM_SOAP = "soap"; private static final String PARAM_GEO = "geofencing"; + private static final String PARAM_APP2APP = "app2app"; + private static final String PARAM_VALIDATE_SIGNATURE = "validate"; private static final String PARAM_HELP = "help"; @@ -88,6 +96,7 @@ public class Cli { private static String interfaceType; private static int verboseLevel; private static boolean addGeofencingSrv = false; + private static String app2AppSrvRedirectUri; public static void main(String[] args) { versionProvider = new ClientVersionProvider(); @@ -184,7 +193,7 @@ public static void main(String[] args) { response = midClient.pollForSignatureStatus(response.getTracking()); } } - + System.out.println(response.toString()); if (response.getStatus().getStatusCode() == StatusCode.SIGNATURE) { SignatureValidationConfiguration svConfig = new SignatureValidationConfiguration(); @@ -214,15 +223,23 @@ public static void main(String[] args) { if (syncSignature) { response = midClient.requestSyncSignature(request); } else { + // optional app2app Additional service + if (StringUtils.isNotEmpty(app2AppSrvRedirectUri)) { + request.addAdditionalService(new App2AppAdditionalService(app2AppSrvRedirectUri)); + } response = midClient.requestAsyncSignature(request); - while (response.getStatus().getStatusCode() == StatusCode.REQUEST_OK || - response.getStatus().getStatusCode() == StatusCode.OUTSTANDING_TRANSACTION) { + logClient.info("isApp2AppFlowResponse: [{}]", isApp2AppFlowResponse(response)); + while ((response.getStatus().getStatusCode() == StatusCode.REQUEST_OK || + response.getStatus().getStatusCode() == StatusCode.OUTSTANDING_TRANSACTION) && !isApp2AppFlowResponse(response)) { //noinspection BusyWait Thread.sleep(5000); response = midClient.pollForSignatureStatus(response.getTracking()); } } - System.out.println(response.toString()); + if (response == null) { + throw new MIDClientException("Response tp requestAsyncSignature is null, request was: " + request); + } + logClient.info(response.toString()); if (response.getStatus().getStatusCode() == StatusCode.SIGNATURE) { boolean signatureIsValid = false; @@ -234,7 +251,7 @@ public static void main(String[] args) { SignatureValidator validator = new SignatureValidatorImpl(svConfig); SignatureValidationResult result = - validator.validateSignature(response.getBase64Signature(), request.getDataToBeSigned().getData(), null); + validator.validateSignature(response.getBase64Signature(), request.getDataToBeSigned().getData(), null); // 4 points validation: signerCertificate, signerCertificatePath, signature, dtbsMatching if (result.isValidationSuccessful()) { @@ -244,6 +261,7 @@ public static void main(String[] args) { printValidationResult(false, result); } } + if (sendReceipt) { if (!validateSignature || signatureIsValid) { ReceiptRequest receiptRequest = new ReceiptRequest(); @@ -292,6 +310,7 @@ private static void printValidationResult(boolean isValid, SignatureValidationRe } } } + private static void parseArguments(String[] args) { if (args.length == 0) { showHelp(null); @@ -372,7 +391,7 @@ private static void parseArguments(String[] args) { case PARAM_SIGN: { if (operation != null) { showHelp("More than one operation selector was found in the calling arguments. " - + "Use either -" + PARAM_SIGN + " or -" + PARAM_PROFILE_QUERY+ " or -" + PARAM_GET_MID_SN); + + "Use either -" + PARAM_SIGN + " or -" + PARAM_PROFILE_QUERY + " or -" + PARAM_GET_MID_SN); return; } operation = OPERATION_SIGN; @@ -381,7 +400,7 @@ private static void parseArguments(String[] args) { case PARAM_PROFILE_QUERY: { if (operation != null) { showHelp("More than one operation selector was found in the calling arguments. " - + "Use either -" + PARAM_SIGN + " or -" + PARAM_PROFILE_QUERY+ " or -" + PARAM_GET_MID_SN); + + "Use either -" + PARAM_SIGN + " or -" + PARAM_PROFILE_QUERY + " or -" + PARAM_GET_MID_SN); return; } operation = OPERATION_PROFILE_QUERY; @@ -416,6 +435,19 @@ private static void parseArguments(String[] args) { addGeofencingSrv = true; break; } + case PARAM_APP2APP: { + if (argValue == null) { + if (argIndex + 1 < args.length) { + app2AppSrvRedirectUri = args[argIndex + 1]; + argIndex++; + } else { + showHelp("app2app is missing"); + } + } else { + app2AppSrvRedirectUri = argValue; + } + break; + } case PARAM_MSISDN: { if (argValue == null) { if (argIndex + 1 < args.length) { @@ -458,7 +490,7 @@ private static void parseArguments(String[] args) { case PARAM_REST: { if (interfaceType != null) { showHelp("More than one interface selector was found in the calling arguments. " - + "Use either -" + PARAM_REST + " or -" + PARAM_SOAP); + + "Use either -" + PARAM_REST + " or -" + PARAM_SOAP); return; } interfaceType = INTERFACE_REST; @@ -467,7 +499,7 @@ private static void parseArguments(String[] args) { case PARAM_SOAP: { if (interfaceType != null) { showHelp("More than one interface selector was found in the calling arguments. " - + "Use either -" + PARAM_REST + " or -" + PARAM_SOAP); + + "Use either -" + PARAM_REST + " or -" + PARAM_SOAP); return; } interfaceType = INTERFACE_SOAP; @@ -506,10 +538,10 @@ private static void showHelp(String argsValidationError) { private static void runInit() { String[][] configPairs = new String[][]{ - new String[]{"/cli-files/config-sample.properties", "config.properties"}, - new String[]{"/cli-files/keystore.jks", "keystore.jks"}, - new String[]{"/cli-files/truststore.jks", "truststore.jks"}, - new String[]{"/cli-files/signature-validation-truststore.jks", "signature-validation-truststore.jks"} + new String[]{"/cli-files/config-sample.properties", "config.properties"}, + new String[]{"/cli-files/keystore.jks", "keystore.jks"}, + new String[]{"/cli-files/truststore.jks", "truststore.jks"}, + new String[]{"/cli-files/signature-validation-truststore.jks", "signature-validation-truststore.jks"} }; for (String[] configPair : configPairs) { String inputFile = configPair[0]; @@ -535,6 +567,8 @@ private static void configureLogback() { setLoggerToLevel(Loggers.CLIENT_PROTOCOL, "info", loggerContext); setLoggerToLevel(Loggers.REQUEST_RESPONSE, "warn", loggerContext); setLoggerToLevel(Loggers.FULL_REQUEST_RESPONSE, "warn", loggerContext); + setLoggerToLevel(Loggers.STATUS_QUERY_MODEL_UTILS, "info", loggerContext); + setLoggerToLevel(Loggers.SIGN_REQ_MODEL_UTILS, "info", loggerContext); break; } case 1: { @@ -544,7 +578,9 @@ private static void configureLogback() { setLoggerToLevel(Loggers.CONFIG, "info", loggerContext); setLoggerToLevel(Loggers.CLIENT_PROTOCOL, "info", loggerContext); setLoggerToLevel(Loggers.REQUEST_RESPONSE, "debug", loggerContext); - setLoggerToLevel(Loggers.FULL_REQUEST_RESPONSE, "warn", loggerContext); + setLoggerToLevel(Loggers.FULL_REQUEST_RESPONSE, "info", loggerContext); + setLoggerToLevel(Loggers.STATUS_QUERY_MODEL_UTILS, "warn", loggerContext); + setLoggerToLevel(Loggers.SIGN_REQ_MODEL_UTILS, "warn", loggerContext); break; } case 2: // falls through @@ -560,6 +596,8 @@ private static void configureLogback() { } else { setLoggerToLevel("org.apache.hc", "trace", loggerContext); } + setLoggerToLevel(Loggers.STATUS_QUERY_MODEL_UTILS, "debug", loggerContext); + setLoggerToLevel(Loggers.SIGN_REQ_MODEL_UTILS, "debug", loggerContext); break; } default: { @@ -642,6 +680,7 @@ private static void printStartupParameters() { if (operation.equals(OPERATION_SIGN)) { System.out.println("Async operation : " + (!syncSignature)); System.out.println("Language : " + lang); + System.out.println("App2APP : " + (StringUtils.isNotEmpty(app2AppSrvRedirectUri) ? app2AppSrvRedirectUri : "Empty")); System.out.println("DTBS : " + dtbs); System.out.println("Send receipt : " + sendReceipt); } @@ -662,4 +701,16 @@ private static Properties loadConfigProperties() { closeStream(is); } } + + private static boolean isApp2AppFlowResponse(SignatureResponse response) { + if (response.getStatus().getStatusCode() == StatusCode.REQUEST_OK) { + if (response.getAdditionalServiceResponses() == null || response.getAdditionalServiceResponses().isEmpty()) { + // not App2AppAdditionalServiceResponse + logClient.info("response.getAdditionalServiceResponses: {}", response.getAdditionalServiceResponses()); + return false; + } + return response.getAdditionalServiceResponses().stream().anyMatch(App2AppAdditionalServiceResponse.class::isInstance); + } + return false; + } } diff --git a/mid-java-client-usage/src/main/java/ch/swisscom/mid/client/samples/AsyncSignature.java b/mid-java-client-usage/src/main/java/ch/swisscom/mid/client/samples/AsyncSignature.java index cdb4e83..7ee8c20 100644 --- a/mid-java-client-usage/src/main/java/ch/swisscom/mid/client/samples/AsyncSignature.java +++ b/mid-java-client-usage/src/main/java/ch/swisscom/mid/client/samples/AsyncSignature.java @@ -18,12 +18,9 @@ import ch.swisscom.mid.client.MIDClient; import ch.swisscom.mid.client.config.ClientConfiguration; import ch.swisscom.mid.client.impl.MIDClientImpl; -import ch.swisscom.mid.client.model.GeofencingAdditionalService; -import ch.swisscom.mid.client.model.SignatureProfiles; -import ch.swisscom.mid.client.model.SignatureRequest; -import ch.swisscom.mid.client.model.SignatureResponse; -import ch.swisscom.mid.client.model.StatusCode; -import ch.swisscom.mid.client.model.UserLanguage; +import ch.swisscom.mid.client.model.*; +import ch.swisscom.mid.client.model.service.App2AppAdditionalService; +import ch.swisscom.mid.client.model.service.GeofencingAdditionalService; import static ch.swisscom.mid.client.samples.Utils.prettyPrintTheException; @@ -42,11 +39,12 @@ public static void main(String[] args) { request.getMobileUser().setMsisdn("41790000000"); request.setSignatureProfile(SignatureProfiles.DEFAULT_PROFILE); request.addAdditionalService(new GeofencingAdditionalService()); + request.addAdditionalService(new App2AppAdditionalService("mobileid://auth?mobile_auth_redirect_uri")); try { SignatureResponse response = client.requestAsyncSignature(request); while (response.getStatus().getStatusCode() == StatusCode.REQUEST_OK || - response.getStatus().getStatusCode() == StatusCode.OUTSTANDING_TRANSACTION) { + response.getStatus().getStatusCode() == StatusCode.OUTSTANDING_TRANSACTION) { System.out.println("Pending: " + response); response = client.pollForSignatureStatus(response.getTracking()); Thread.sleep(1000); diff --git a/mid-java-client-usage/src/main/java/ch/swisscom/mid/client/samples/SyncSignature.java b/mid-java-client-usage/src/main/java/ch/swisscom/mid/client/samples/SyncSignature.java index 17e79ea..0c113fe 100644 --- a/mid-java-client-usage/src/main/java/ch/swisscom/mid/client/samples/SyncSignature.java +++ b/mid-java-client-usage/src/main/java/ch/swisscom/mid/client/samples/SyncSignature.java @@ -18,11 +18,11 @@ import ch.swisscom.mid.client.MIDClient; import ch.swisscom.mid.client.config.ClientConfiguration; import ch.swisscom.mid.client.impl.MIDClientImpl; -import ch.swisscom.mid.client.model.GeofencingAdditionalService; import ch.swisscom.mid.client.model.SignatureProfiles; import ch.swisscom.mid.client.model.SignatureRequest; import ch.swisscom.mid.client.model.SignatureResponse; import ch.swisscom.mid.client.model.UserLanguage; +import ch.swisscom.mid.client.model.service.GeofencingAdditionalService; import static ch.swisscom.mid.client.samples.Utils.prettyPrintTheException; diff --git a/mid-java-client-usage/src/main/java/ch/swisscom/mid/client/samples/SyncSignatureWithReceipt.java b/mid-java-client-usage/src/main/java/ch/swisscom/mid/client/samples/SyncSignatureWithReceipt.java index 3ee6fe7..6cfbbfc 100644 --- a/mid-java-client-usage/src/main/java/ch/swisscom/mid/client/samples/SyncSignatureWithReceipt.java +++ b/mid-java-client-usage/src/main/java/ch/swisscom/mid/client/samples/SyncSignatureWithReceipt.java @@ -19,6 +19,7 @@ import ch.swisscom.mid.client.config.ClientConfiguration; import ch.swisscom.mid.client.impl.MIDClientImpl; import ch.swisscom.mid.client.model.*; +import ch.swisscom.mid.client.model.service.GeofencingAdditionalService; import static ch.swisscom.mid.client.samples.Utils.prettyPrintTheException; diff --git a/mid-java-client-usage/src/main/resources/cli-files/usage.txt b/mid-java-client-usage/src/main/resources/cli-files/usage.txt index 268ec4b..d689a28 100644 --- a/mid-java-client-usage/src/main/resources/cli-files/usage.txt +++ b/mid-java-client-usage/src/main/resources/cli-files/usage.txt @@ -27,6 +27,9 @@ Arguments: -geofencing - For sign operation. Request additional geofencing data + -app2app="myapp://example" - For sign operation (async only). Request App2App service which allows an Application Provider to automatically switch from + their App to the Mobile ID App (and the Mobile ID App to automatically switch back to the originating App) + -validate - For sign operation. Validate the signature once it is successfully acquired -msisdn=41790000000 - The target MSISDN for the chosen operation @@ -61,6 +64,7 @@ Use cases: - ./bin/mid-client.sh -profile-query -msisdn=41790000000 - ./bin/mid-client.sh -profile-query -msisdn=41790000000 -soap - ./bin/mid-client.sh -sign -receipt -msisdn=41790000000 -lang=en -dtbs="Do you want to login?" -req-timeout=120 + - ./bin/mid-client.sh -sign -async -msisdn=41790000000 -lang=en -app2app="myapp://example" -dtbs="Do you want to login?" -rest -vv - ./bin/mid-client.sh -sign -sync -receipt -msisdn=41790000000 -lang=en -dtbs="Do you want to login?" -soap -vv - ./bin/mid-client.sh \ -config=my-config.properties \ From 19510abdffd8064cdf12e5614ca05ac5a7337984 Mon Sep 17 00:00:00 2001 From: Tomasz Gruszewski Date: Wed, 11 Mar 2026 13:30:25 +0100 Subject: [PATCH 2/4] Potential fix for pull request finding 'Missing catch of NumberFormatException' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- .../mid/client/soap/adapter/MssResponseProcessor.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mid-java-client-soap/src/main/java/ch/swisscom/mid/client/soap/adapter/MssResponseProcessor.java b/mid-java-client-soap/src/main/java/ch/swisscom/mid/client/soap/adapter/MssResponseProcessor.java index 0fecd17..e407400 100644 --- a/mid-java-client-soap/src/main/java/ch/swisscom/mid/client/soap/adapter/MssResponseProcessor.java +++ b/mid-java-client-soap/src/main/java/ch/swisscom/mid/client/soap/adapter/MssResponseProcessor.java @@ -244,7 +244,15 @@ private static List processAdditionalServiceResponses final GeofencingAdditionalServiceResponse geoResponse = new GeofencingAdditionalServiceResponse(); if (geofencing.getErrorcode() == null) { geoResponse.setCountry(geofencing.getCountry()); - geoResponse.setAccuracy(geofencing.getAccuracy() == null ? 0 : Integer.parseInt(geofencing.getAccuracy())); + int accuracy = 0; + if (geofencing.getAccuracy() != null) { + try { + accuracy = Integer.parseInt(geofencing.getAccuracy()); + } catch (NumberFormatException e) { + logProtocol.debug("Invalid geofencing accuracy value [{}], defaulting to 0", geofencing.getAccuracy()); + } + } + geoResponse.setAccuracy(accuracy); geoResponse.setTimestamp(gregorianCalendarToString(geofencing.getTimestamp())); geoResponse.setDeviceConfidence(geofencing.getDeviceconfidence()); geoResponse.setLocationConfidence(geofencing.getLocationconfidence()); From 560ea8a2eb5142c1ed21c9b5399fca32d64d2167 Mon Sep 17 00:00:00 2001 From: thomas4v Date: Fri, 13 Mar 2026 15:49:36 +0100 Subject: [PATCH 3/4] App2App (AS) cont'd with loop on app2app service until expire of transaction --- .../src/main/java/ch/swisscom/mid/client/cli/Cli.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mid-java-client-usage/src/main/java/ch/swisscom/mid/client/cli/Cli.java b/mid-java-client-usage/src/main/java/ch/swisscom/mid/client/cli/Cli.java index 41236bc..dd4ee77 100644 --- a/mid-java-client-usage/src/main/java/ch/swisscom/mid/client/cli/Cli.java +++ b/mid-java-client-usage/src/main/java/ch/swisscom/mid/client/cli/Cli.java @@ -230,7 +230,7 @@ public static void main(String[] args) { response = midClient.requestAsyncSignature(request); logClient.info("isApp2AppFlowResponse: [{}]", isApp2AppFlowResponse(response)); while ((response.getStatus().getStatusCode() == StatusCode.REQUEST_OK || - response.getStatus().getStatusCode() == StatusCode.OUTSTANDING_TRANSACTION) && !isApp2AppFlowResponse(response)) { + response.getStatus().getStatusCode() == StatusCode.OUTSTANDING_TRANSACTION)) { //noinspection BusyWait Thread.sleep(5000); response = midClient.pollForSignatureStatus(response.getTracking()); From 5933d18cac17f3b61fc06051b97af27b17ba2ea6 Mon Sep 17 00:00:00 2001 From: thomas4v Date: Fri, 13 Mar 2026 15:55:53 +0100 Subject: [PATCH 4/4] Version bump up to 1.6.0 --- mid-java-client-core/pom.xml | 2 +- mid-java-client-rest/pom.xml | 2 +- mid-java-client-soap/pom.xml | 2 +- mid-java-client-usage/pom.xml | 2 +- pom.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mid-java-client-core/pom.xml b/mid-java-client-core/pom.xml index df93011..24735b9 100644 --- a/mid-java-client-core/pom.xml +++ b/mid-java-client-core/pom.xml @@ -6,7 +6,7 @@ ch.mobileid.mid-java-client mid-java-client-parent - 1.5.8 + 1.6.0 mid-java-client-core diff --git a/mid-java-client-rest/pom.xml b/mid-java-client-rest/pom.xml index e5a0434..b89e5d7 100644 --- a/mid-java-client-rest/pom.xml +++ b/mid-java-client-rest/pom.xml @@ -6,7 +6,7 @@ ch.mobileid.mid-java-client mid-java-client-parent - 1.5.8 + 1.6.0 mid-java-client-rest diff --git a/mid-java-client-soap/pom.xml b/mid-java-client-soap/pom.xml index 033b963..46bfed0 100644 --- a/mid-java-client-soap/pom.xml +++ b/mid-java-client-soap/pom.xml @@ -6,7 +6,7 @@ ch.mobileid.mid-java-client mid-java-client-parent - 1.5.8 + 1.6.0 mid-java-client-soap diff --git a/mid-java-client-usage/pom.xml b/mid-java-client-usage/pom.xml index eb44b37..b529cdb 100644 --- a/mid-java-client-usage/pom.xml +++ b/mid-java-client-usage/pom.xml @@ -6,7 +6,7 @@ ch.mobileid.mid-java-client mid-java-client-parent - 1.5.8 + 1.6.0 mid-java-client-usage diff --git a/pom.xml b/pom.xml index cdc4f4f..b01e3b0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ ch.mobileid.mid-java-client mid-java-client-parent - 1.5.8 + 1.6.0 Mobile ID Java client Mobile ID client reference implementation in Java https://github.com/MobileID-Strong-Authentication/mobileid-client-java