Skip to content

Commit d177043

Browse files
App2App additional service implementation (#39, #40)
* 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 * 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> * App2App (AS) cont'd with loop on app2app service until expire of transaction * Version bump up to 1.6.0 Signed-off-by: thomas4v <thomas4v@gmail.com> * keep services at model package level, correct for license formatting --------- Signed-off-by: thomas4v <thomas4v@gmail.com> Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
1 parent 3958cd8 commit d177043

53 files changed

Lines changed: 1950 additions & 916 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/use-the-client-via-cli.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ Arguments:
4242
-receipt - For sign operation. Send a receipt after the signature is acquired successfully
4343
4444
-geofencing - For sign operation. Request additional geofencing data
45+
46+
-app2app="myapp://example" - For sign operation (async only). Request App2App service which allows an Application Provider to automatically switch from
47+
their App to the Mobile ID App (and the Mobile ID App to automatically switch back to the originating App)
4548
4649
-validate - For sign operation. Validate the signature once it is successfully acquired
4750
@@ -78,6 +81,7 @@ Use cases:
7881
- ./bin/mid-client.sh -profile-query -msisdn=41790000000 -soap
7982
- ./bin/mid-client.sh -sign -receipt -msisdn=41790000000 -lang=en -dtbs="Do you want to login?" -req-timeout=120
8083
- ./bin/mid-client.sh -sign -sync -receipt -msisdn=41790000000 -lang=en -dtbs="Do you want to login?" -soap -vv
84+
- ./bin/mid-client.sh -sign -async -msisdn=41790000000 -lang=en -app2app="myapp://example" -dtbs="Do you want to login?" -rest -vv
8185
- ./bin/mid-client.sh \
8286
-config=my-config.properties \
8387
-sign -sync -receipt -geofencing \
@@ -95,46 +99,64 @@ Use the _-v_, _-vv_ and _-vvv_ arguments for increasingly detailed log levels, i
9599
exchanged packets.
96100

97101
## Examples
102+
98103
Start with a fresh set of configuration files:
104+
99105
```shell
100106
./bin/mid-client.sh -init
101107
```
102108

103109
Get the profile information for a particular phone number (MSISDN) that your application provider is controlling:
110+
104111
```shell
105112
./bin/mid-client.sh -profile-query -msisdn 41790000000
106113
```
107114

108115
Get the same profile information using a particular configuration file and the SOAP interface of Mobile ID:
116+
109117
```shell
110118
./bin/mid-client.sh -profile-query -msisdn 41790000000 -config local-config.properties -soap
111119
```
112120

113121
Request a digital signature to a particular phone number (MSISDN), in sync mode:
122+
114123
```shell
115124
./bin/mid-client.sh -sign -msisdn=41790000000 -geofencing -lang=en -dtbs "Do you want to login?" -sync
116125
```
117126

118127
Request a digital signature to a particular phone number (MSISDN), in async mode (this is the default mode) and with signature receipt:
128+
119129
```shell
120130
./bin/mid-client.sh -sign -msisdn=41790000000 -lang=en -dtbs "Do you want to login?" -receipt -req-timeout 120
121131
```
122132

133+
Request a digital signature to a particular phone number (MSISDN), in async mode (this is the default mode) and with app2app service:
134+
135+
```shell
136+
./bin/mid-client.sh -sign -msisdn=41790000000 -lang=en -app2app="myapp://example" -req-timeout 120
137+
```
138+
123139
Request a Mobile ID Serial number based on particular phone number (MSISDN), in async mode:
140+
124141
```shell
125142
./bin/mid-client.sh -get-mid-sn -msisdn=41790000000 -rest
126143
```
127144

128145
Note: when working with arguments that have values (such as _-msisdn_) you can pass the value either as the next argument:
146+
129147
```shell
130148
./bin/mid-client.sh -sign -msisdn 41790000000
131149
```
150+
132151
or in the form _name=value_:
152+
133153
```shell
134154
./bin/mid-client.sh -sign -msisdn=41790000000
135155
```
156+
136157
Please note that the _-dtbs_ argument is a bit more special, as it will most likely contain spaces, so either the entire name=value
137158
construct is enclosed in double quotes or, if you use the name<space>value form, then the value is enclosed in double quotes:
159+
138160
```shell
139161
./bin/mid-client.sh -sign -msisdn=41790000000 -dtbs "Do you want to login?"
140162
./bin/mid-client.sh -sign -msisdn=41790000000 "-dtbs=Do you want to login?"

mid-java-client-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>ch.mobileid.mid-java-client</groupId>
88
<artifactId>mid-java-client-parent</artifactId>
9-
<version>1.5.8</version>
9+
<version>1.6.0</version>
1010
</parent>
1111

1212
<artifactId>mid-java-client-core</artifactId>

mid-java-client-core/src/main/java/ch/swisscom/mid/client/config/DefaultConfiguration.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public class DefaultConfiguration {
3232
public static final String ADDITIONAL_SERVICE_USER_LANG_URI = "http://mss.ficom.fi/TS102204/v1.0.0#userLang";
3333
public static final String ADDITIONAL_SERVICE_SIGNATURE_VALIDATION_URI = "http://uri.etsi.org/TS102204/v1.1.2#validate";
3434
public static final String ADDITIONAL_SERVICE_GEOFENCING = "http://mid.swisscom.ch/as#geofencing";
35+
public static final String ADDITIONAL_SERVICE_APP2APP = "http://mid.swisscom.ch/as#app2app";
3536

3637
public static final String SIGNATURE_REQUEST_MAJOR_VERSION = "1";
3738
public static final String SIGNATURE_REQUEST_MINOR_VERSION = "2";

mid-java-client-core/src/main/java/ch/swisscom/mid/client/impl/Loggers.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public class Loggers {
2929
public static final String REQUEST_RESPONSE = "ch.swisscom.mid.client.requestResponse";
3030
public static final String FULL_REQUEST_RESPONSE = "ch.swisscom.mid.client.fullRequestResponse";
3131
public static final String SIGNATURE_VALIDATOR = "ch.swisscom.mid.signatureValidator";
32+
public static final String STATUS_QUERY_MODEL_UTILS = "ch.swisscom.mid.client.rest.statusQueryModelUtils";
33+
public static final String SIGN_REQ_MODEL_UTILS = "ch.swisscom.mid.client.rest.signatureRequestModelUtils";
3234

3335
// ----------------------------------------------------------------------------------------------------
3436

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,47 @@
1-
/*
2-
* Copyright 2021 Swisscom (Schweiz) AG
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
package ch.swisscom.mid.client.model;
17-
18-
/**
19-
* Base class for requesting additional services via requests to the Mobile ID service. You can either make an instance of this class
20-
* and set the URI by yourself, or use one of the provided subclasses. There is also a corresponding {@link AdditionalServiceResponse}
21-
* that contains, as expected, the data that is returned as part of the requested additional service payload.
22-
*
23-
* @see UserLangAdditionalService
24-
* @see SignatureValidationAdditionalService
25-
* @see GeofencingAdditionalService
26-
*/
27-
public class AdditionalService {
28-
29-
private final String uri;
30-
31-
public AdditionalService(String uri) {
32-
this.uri = uri;
33-
}
34-
35-
public String getUri() {
36-
return uri;
37-
}
38-
39-
@Override
40-
public String toString() {
41-
return "AdditionalService{" +
42-
"uri='" + uri + '\'' +
43-
'}';
44-
}
45-
}
1+
/*
2+
*
3+
* * Copyright 2021-2026 Swisscom (Schweiz) AG
4+
* *
5+
* * Licensed under the Apache License, Version 2.0 (the "License");
6+
* * you may not use this file except in compliance with the License.
7+
* * You may obtain a copy of the License at
8+
* *
9+
* * http://www.apache.org/licenses/LICENSE-2.0
10+
* *
11+
* * Unless required by applicable law or agreed to in writing, software
12+
* * distributed under the License is distributed on an "AS IS" BASIS,
13+
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* * See the License for the specific language governing permissions and
15+
* * limitations under the License.
16+
*
17+
*/
18+
package ch.swisscom.mid.client.model;
19+
20+
/**
21+
* Base class for requesting additional services via requests to the Mobile ID service. You can either make an instance of this class
22+
* and set the URI by yourself, or use one of the provided subclasses. There is also a corresponding {@link AdditionalServiceResponse}
23+
* that contains, as expected, the data that is returned as part of the requested additional service payload.
24+
*
25+
* @see UserLangAdditionalService
26+
* @see SignatureValidationAdditionalService
27+
* @see GeofencingAdditionalService
28+
*/
29+
public class AdditionalService {
30+
31+
private final String uri;
32+
33+
public AdditionalService(String uri) {
34+
this.uri = uri;
35+
}
36+
37+
public String getUri() {
38+
return uri;
39+
}
40+
41+
@Override
42+
public String toString() {
43+
return "AdditionalService{" +
44+
"uri='" + uri + '\'' +
45+
'}';
46+
}
47+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
*
3+
* * Copyright 2021-2026 Swisscom (Schweiz) AG
4+
* *
5+
* * Licensed under the Apache License, Version 2.0 (the "License");
6+
* * you may not use this file except in compliance with the License.
7+
* * You may obtain a copy of the License at
8+
* *
9+
* * http://www.apache.org/licenses/LICENSE-2.0
10+
* *
11+
* * Unless required by applicable law or agreed to in writing, software
12+
* * distributed under the License is distributed on an "AS IS" BASIS,
13+
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* * See the License for the specific language governing permissions and
15+
* * limitations under the License.
16+
*
17+
*/
18+
19+
package ch.swisscom.mid.client.model;
20+
21+
public class App2App {
22+
private String redirectUri;
23+
24+
public String getRedirectUri() {
25+
return redirectUri;
26+
}
27+
28+
public void setRedirectUri(String redirectUri) {
29+
this.redirectUri = redirectUri;
30+
}
31+
32+
@Override
33+
public String toString() {
34+
return "App2App{" +
35+
"redirectUri='" + redirectUri + '\'' +
36+
'}';
37+
}
38+
}

0 commit comments

Comments
 (0)