Skip to content

Commit 8fe9876

Browse files
committed
Merge branch 'mavenRelease' into vetaziv/add-default-creators
2 parents 5c6f7f1 + c7922a1 commit 8fe9876

12 files changed

Lines changed: 164 additions & 3 deletions

File tree

FrejaEidClient/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.verisec.frejaeid</groupId>
55
<artifactId>FrejaEidClient</artifactId>
6-
<version>2.32.1-SNAPSHOT</version>
6+
<version>2.33.1-SNAPSHOT</version>
77
<packaging>jar</packaging>
88

99
<name>FrejaEidClient</name>

FrejaEidClient/src/main/java/com/verisec/frejaeid/client/beans/authentication/init/InitiateAuthenticationRequestBuilders.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ public SetOptionalParamsBuilder setOrganisationId(String identifier) {
6969
return new SetOptionalParamsBuilder(UserInfoType.ORG_ID, identifier);
7070
}
7171

72+
/**
73+
* Sets unique personal identifier as userInfo and {@link UserInfoType#UPI} as {@linkplain UserInfoType} for initiating
74+
* transaction.
75+
*
76+
* @param upi user's unique personal identifier that was previously set by Freja
77+
* @return request builder
78+
*/
79+
public SetOptionalParamsBuilder setUpi(String upi) {
80+
return new SetOptionalParamsBuilder(UserInfoType.UPI, upi);
81+
}
82+
7283
}
7384

7485
public static class SetOptionalParamsBuilder {

FrejaEidClient/src/main/java/com/verisec/frejaeid/client/beans/organisationid/init/InitiateAddOrganisationIdRequestBuilders.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,20 @@ public SetOptionalParamsBuilder setInferredAndOrganisationId(OrganisationId orga
7171
return new SetOptionalParamsBuilder(UserInfoType.INFERRED, "N/A", organisationId);
7272
}
7373

74+
/**
75+
* Sets unique personal identifier as userInfo and {@link UserInfoType#UPI} as
76+
* {@linkplain UserInfoType} for initiating transaction.
77+
*
78+
* @param upi user's unique personal identifier that will be used to identify
79+
* the end user in format 1234-123456-1234.
80+
* @param organisationId instance of {@linkplain OrganisationId} that
81+
* contains information regarding organisation id.
82+
* @return request builder
83+
*/
84+
public SetOptionalParamsBuilder setUpiAndOrganisationId(String upi, OrganisationId organisationId) {
85+
return new SetOptionalParamsBuilder(UserInfoType.UPI, upi, organisationId);
86+
}
87+
7488
}
7589

7690
public static class SetOptionalParamsBuilder {

FrejaEidClient/src/main/java/com/verisec/frejaeid/client/beans/sign/init/InitiateSignRequestBuilders.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@ public SetOptionalParamsBuilder setOrganisationId(String identifier) {
7575
return new SetOptionalParamsBuilder(UserInfoType.ORG_ID, identifier);
7676
}
7777

78+
/**
79+
* Sets unique personal identifier as userInfo and {@link UserInfoType#UPI} as
80+
* {@linkplain UserInfoType} for initiating transaction.
81+
*
82+
* @param upi user's unique personal identifier that was previously set by
83+
* Freja
84+
* @return request builder
85+
*/
86+
public SetOptionalParamsBuilder setUpi(String upi) {
87+
return new SetOptionalParamsBuilder(UserInfoType.UPI, upi);
88+
}
89+
7890
}
7991

8092
public static class SetOptionalParamsBuilder {

FrejaEidClient/src/main/java/com/verisec/frejaeid/client/beans/usermanagement/customidentifier/set/SetCustomIdentifierRequest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,20 @@ public static SetCustomIdentifierRequest createDefaultWithSsn(SsnUserInfo ssnUse
5252
customIdentifier, null);
5353
}
5454

55+
/**
56+
* Returns instance of {@linkplain SetCustomIdentifierRequest} with
57+
* {@linkplain UserInfoType} {@code UPI}.
58+
*
59+
* @param upi will be used to identify the end user. It cannot be
60+
* {@code null} or empty. Maximum length is 256 characters.
61+
* @param customIdentifier will be set for user. Maximum length is 128
62+
* characters. It cannot be {@code null} or empty.
63+
* @return request
64+
*/
65+
public static SetCustomIdentifierRequest createDefaultWithUpi(String upi, String customIdentifier) {
66+
return new SetCustomIdentifierRequest(UserInfoType.UPI, upi, customIdentifier, null);
67+
}
68+
5569
/**
5670
* Returns instance of builder that is used for creating
5771
* {@linkplain SetCustomIdentifierRequest} with custom request parameters.

FrejaEidClient/src/main/java/com/verisec/frejaeid/client/beans/usermanagement/customidentifier/set/SetCustomIdentifierRequestBuilder.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,20 @@ public SetOptionalParamsBuilder setPhoneNumberAndCustomIdentifier(String phoneNu
5656
return new SetOptionalParamsBuilder(UserInfoType.PHONE, phoneNumber, customIdentifier);
5757
}
5858

59+
/**
60+
* Sets upi as userInfo and {@link UserInfoType#UPI} as
61+
* {@linkplain UserInfoType} for initiating transaction.
62+
*
63+
* @param upi user's unique personal indentifier that will be used to identify
64+
* the end user.
65+
* @param customIdentifier will be set for user. Maximum length is 128
66+
* characters. It cannot be {@code null} or empty.
67+
* @return request builder
68+
*/
69+
public SetOptionalParamsBuilder setUpiAndCustomIdentifier(String upi, String customIdentifier) {
70+
return new SetOptionalParamsBuilder(UserInfoType.UPI, upi, customIdentifier);
71+
}
72+
5973
}
6074

6175
public static class SetOptionalParamsBuilder {

FrejaEidClient/src/main/java/com/verisec/frejaeid/client/enums/UserInfoType.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* <br> - {@link #SSN}
88
* <br> - {@link #PHONE}
99
* <br> - {@link #INFERRED}
10+
* <br> - {@link #ORG_ID}
11+
* <br> - {@link #UPI}
1012
*/
1113
public enum UserInfoType {
1214

@@ -31,6 +33,10 @@ public enum UserInfoType {
3133
* UserInfoType org_id for initiating transaction with organisation id of
3234
* user.
3335
*/
34-
ORG_ID;
35-
36+
ORG_ID,
37+
/**
38+
* UserInfoType upi for initiating transaction with unique personal identifier of
39+
* user.
40+
*/
41+
UPI;
3642
}

FrejaEidClient/src/test/java/com/verisec/frejaeid/client/http/AuthenticationClientHttpTest.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,24 @@ public void initiateAuthenticationV1_1_success()
140140
initAuthenticationRequestWithRegistrationStateAndRelyingPartyId,
141141
initAuthResponseString);
142142

143+
144+
145+
InitiateAuthenticationRequest initAuthenticationRequestWithUpi =
146+
InitiateAuthenticationRequest.createCustom()
147+
.setUpi(UPI)
148+
.setMinRegistrationLevel(MinRegistrationLevel.EXTENDED)
149+
.setRelyingPartyId(RELYING_PARTY_ID)
150+
.build();
151+
InitiateAuthenticationRequest expectedInitAuthenticationRequestWithUpi =
152+
InitiateAuthenticationRequest.createCustom()
153+
.setUpi(UPI)
154+
.setMinRegistrationLevel(MinRegistrationLevel.EXTENDED)
155+
.build();
156+
157+
sendInitiateAuthenticationV1_1RequestAndAssertResponse(expectedInitAuthenticationRequestWithUpi,
158+
initAuthenticationRequestWithUpi,
159+
initAuthResponseString);
160+
143161
}
144162

145163
@Test
@@ -202,6 +220,22 @@ public void initiateAuthentication_success()
202220
sendInitiateAuthenticationRequestAndAssertResponse(expectedInitAuthenticationRequestWithRegistrationStateAndRelyingPartyId,
203221
initAuthenticationRequestWithRegistrationStateAndRelyingPartyId,
204222
initAuthResponseString);
223+
224+
InitiateAuthenticationRequest initAuthenticationRequestWithUpi =
225+
InitiateAuthenticationRequest.createCustom()
226+
.setUpi(UPI)
227+
.setMinRegistrationLevel(MinRegistrationLevel.EXTENDED)
228+
.setRelyingPartyId(RELYING_PARTY_ID)
229+
.build();
230+
InitiateAuthenticationRequest expectedInitAuthenticationRequestWithUpi =
231+
InitiateAuthenticationRequest.createCustom()
232+
.setUpi(UPI)
233+
.setMinRegistrationLevel(MinRegistrationLevel.EXTENDED)
234+
.build();
235+
236+
sendInitiateAuthenticationRequestAndAssertResponse(expectedInitAuthenticationRequestWithUpi,
237+
initAuthenticationRequestWithUpi,
238+
initAuthResponseString);
205239
}
206240

207241
@Test

FrejaEidClient/src/test/java/com/verisec/frejaeid/client/http/CommonHttpTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public abstract class CommonHttpTest {
3535
protected static final String QR_CODE_SECRET = "qrCodeSecret";
3636
protected static final String EMAIL = "eid.demo.verisec@gmail.com";
3737
protected static final String SSN = "123455697887";
38+
protected static final String UPI = "5633-823597-7862";
3839
protected static final String RELYING_PARTY_ID = "relying_party_id";
3940
protected static final SsnUserInfo SSN_USER_INFO = SsnUserInfo.create(Country.SWEDEN, SSN);
4041
protected static final BasicUserInfo BASIC_USER_INFO = new BasicUserInfo("John", "Fante");

FrejaEidClient/src/test/java/com/verisec/frejaeid/client/http/CustomIdentifierClientHttpTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,23 @@ public void setCustomAttribute_success()
5353
SetCustomIdentifierRequest.createDefaultWithSsn(SsnUserInfo.create(Country.NORWAY, SSN),
5454
CUSTOM_IDENTIFIER);
5555
sendSetCustomIdentifierRequestAndAssertResponse(customIdentifierRequestDefaultSsn);
56+
57+
SetCustomIdentifierRequest customIdentifierRequestDefaultUpi =
58+
SetCustomIdentifierRequest.createDefaultWithUpi(UPI, CUSTOM_IDENTIFIER);
59+
sendSetCustomIdentifierRequestAndAssertResponse(customIdentifierRequestDefaultUpi);
60+
5661
SetCustomIdentifierRequest customIdentifierRequestEmail =
5762
SetCustomIdentifierRequest.createCustom().setEmailAndCustomIdentifier(EMAIL, CUSTOM_IDENTIFIER).build();
5863
sendSetCustomIdentifierRequestAndAssertResponse(customIdentifierRequestEmail);
5964
SetCustomIdentifierRequest customIdentifierRequestSsn =
6065
SetCustomIdentifierRequest.createCustom()
6166
.setSsnAndCustomIdentifier(SsnUserInfo.create(Country.NORWAY, SSN), CUSTOM_IDENTIFIER).build();
6267
sendSetCustomIdentifierRequestAndAssertResponse(customIdentifierRequestSsn);
68+
69+
SetCustomIdentifierRequest customIdentifierRequestUpi =
70+
SetCustomIdentifierRequest.createCustom().setUpiAndCustomIdentifier(UPI, CUSTOM_IDENTIFIER).build();
71+
sendSetCustomIdentifierRequestAndAssertResponse(customIdentifierRequestUpi);
72+
6373
SetCustomIdentifierRequest customIdentifierRequestPhoneNum =
6474
SetCustomIdentifierRequest.createCustom()
6575
.setPhoneNumberAndCustomIdentifier(EMAIL, CUSTOM_IDENTIFIER).build();

0 commit comments

Comments
 (0)