4747 */
4848public class CredentialOfferPageModel extends AuthorizationPageModel
4949{
50- private static final long serialVersionUID = 1L ;
50+ private static final long serialVersionUID = 2L ;
5151
5252
5353 private static final String DEFAULT_ENDPOINT = "openid-credential-offer://" ;
@@ -57,55 +57,64 @@ public class CredentialOfferPageModel extends AuthorizationPageModel
5757 public static final int QR_CODE_HEIGHT = 300 ;
5858
5959
60- private static final String DEFAULT_CREDENTIALS = "[\n " +
60+ private static final String DEFAULT_CREDENTIAL_CONFIGURATIONS =
61+ "[\n " +
6162 " \" IdentityCredential\" ,\n " +
62- " \" mDL\" \n " +
63+ " \" org.iso.18013.5.1. mDL\" \n " +
6364 "]" ;
6465
6566
66- private String credentials ;
67+ private String credentialConfigurations ;
6768 private boolean authorizationCodeGrantIncluded ;
6869 private boolean issuerStateIncluded ;
6970 private boolean preAuthorizedCodeGrantIncluded ;
70- private boolean userPinRequired ;
71- private int userPinLength ;
71+ private String txCode ;
72+ private String txCodeInputMode ;
73+ private String txCodeDescription ;
7274 private int duration ;
7375 private String credentialOfferEndpoint ;
7476 private CredentialOfferInfo info ;
7577 private String credentialOfferLink ;
7678 private String credentialOfferQrCode ;
7779 private String credentialOfferContent ;
80+ private String credentialOfferUri ;
7881 private String credentialOfferUriLink ;
7982 private String credentialOfferUriQrCode ;
8083
8184
8285 public CredentialOfferPageModel ()
8386 {
8487 this .authorizationCodeGrantIncluded = false ;
85- this .issuerStateIncluded = true ;
88+ this .issuerStateIncluded = true ;
8689 this .preAuthorizedCodeGrantIncluded = true ;
87- this .userPinRequired = false ;
88- this .userPinLength = 0 ;
8990 this .duration = 0 ;
90- this .credentials = DEFAULT_CREDENTIALS ;
91- this .credentialOfferEndpoint = DEFAULT_ENDPOINT ;
91+ this .credentialConfigurations = DEFAULT_CREDENTIAL_CONFIGURATIONS ;
92+ this .credentialOfferEndpoint = DEFAULT_ENDPOINT ;
9293 }
9394
9495
9596 public CredentialOfferPageModel setValues (final Map <String , String > values )
9697 {
97- this .credentials = values .getOrDefault ("credentials" , this .credentials );
98- this .authorizationCodeGrantIncluded = ProcessingUtil .fromFormCheckbox (values , "authorizationCodeGrantIncluded" );
99- this .issuerStateIncluded = ProcessingUtil .fromFormCheckbox (values , "issuerStateIncluded" );
100- this .preAuthorizedCodeGrantIncluded = ProcessingUtil .fromFormCheckbox (values , "preAuthorizedCodeGrantIncluded" );
101- this .userPinRequired = ProcessingUtil .fromFormCheckbox (values , "userPinRequired" );
102- this .credentialOfferEndpoint = values .getOrDefault ("credentialOfferEndpoint" , this .credentialOfferEndpoint );
103- this .userPinLength = extractInt (values , "userPinLength" , this .userPinLength );
104- this .duration = extractInt (values , "duration" , this .duration );
98+ this .credentialConfigurations = values .getOrDefault ("credentialConfigurations" , this .credentialConfigurations );
99+ this .authorizationCodeGrantIncluded = fromCheckBox (values , "authorizationCodeGrantIncluded" );
100+ this .issuerStateIncluded = fromCheckBox (values , "issuerStateIncluded" );
101+ this .preAuthorizedCodeGrantIncluded = fromCheckBox (values , "preAuthorizedCodeGrantIncluded" );
102+ this .txCode = values .getOrDefault ("txCode" , this .txCode );
103+ this .txCodeInputMode = values .getOrDefault ("txCodeInputMode" , this .txCodeInputMode );
104+ this .txCodeDescription = values .getOrDefault ("txCodeDescription" , this .txCodeDescription );
105+ this .duration = extractInt (values , "duration" , this .duration );
106+ this .credentialOfferEndpoint = values .getOrDefault ("credentialOfferEndpoint" , this .credentialOfferEndpoint );
107+
105108 return this ;
106109 }
107110
108111
112+ private static boolean fromCheckBox (Map <String , String > values , String key )
113+ {
114+ return ProcessingUtil .fromFormCheckbox (values , key );
115+ }
116+
117+
109118 private Integer extractInt (final Map <String , String > values ,
110119 final String key , final Integer def )
111120 {
@@ -159,10 +168,12 @@ public CredentialOfferCreateRequest toRequest(final User user)
159168 .setAuthorizationCodeGrantIncluded (this .authorizationCodeGrantIncluded )
160169 .setIssuerStateIncluded (this .issuerStateIncluded )
161170 .setPreAuthorizedCodeGrantIncluded (this .preAuthorizedCodeGrantIncluded )
162- .setUserPinRequired (this .userPinRequired )
163- .setUserPinLength (this .userPinLength )
171+ .setTxCode (this .txCode )
172+ .setTxCodeInputMode (this .txCodeInputMode )
173+ .setTxCodeDescription (this .txCodeDescription )
164174 .setDuration (this .duration )
165- .setCredentials (parseAsStringArray ("credentials" , this .credentials ))
175+ .setCredentialConfigurations (
176+ parseAsStringArray ("credentialConfigurations" , this .credentialConfigurations ))
166177 .setSubject (user .getSubject ());
167178 }
168179
@@ -209,15 +220,15 @@ private List<?> parseAsList(String name, String json)
209220 }
210221
211222
212- public String getCredentials ()
223+ public String getCredentialConfigurations ()
213224 {
214- return credentials ;
225+ return credentialConfigurations ;
215226 }
216227
217228
218- public void setCredentials (String credentials )
229+ public void setCredentialConfigurations (String configurations )
219230 {
220- this .credentials = credentials ;
231+ this .credentialConfigurations = configurations ;
221232 }
222233
223234
@@ -257,27 +268,39 @@ public void setPreAuthorizedCodeGrantIncluded(boolean preAuthorizedCodeGrantIncl
257268 }
258269
259270
260- public boolean isUserPinRequired ()
271+ public String getTxCode ()
261272 {
262- return userPinRequired ;
273+ return txCode ;
263274 }
264275
265276
266- public void setUserPinRequired ( boolean userPinRequired )
277+ public void setTxCode ( String txCode )
267278 {
268- this .userPinRequired = userPinRequired ;
279+ this .txCode = txCode ;
269280 }
270281
271282
272- public int getUserPinLength ()
283+ public String getTxCodeInputMode ()
273284 {
274- return userPinLength ;
285+ return txCodeInputMode ;
275286 }
276287
277288
278- public void setUserPinLength ( int userPinLength )
289+ public void setTxCodeInputMode ( String inputMode )
279290 {
280- this .userPinLength = userPinLength ;
291+ this .txCodeInputMode = inputMode ;
292+ }
293+
294+
295+ public String getTxCodeDescription ()
296+ {
297+ return txCodeDescription ;
298+ }
299+
300+
301+ public void setTxCodeDescription (String description )
302+ {
303+ this .txCodeDescription = description ;
281304 }
282305
283306
@@ -321,7 +344,7 @@ public void setInfo(CredentialOfferInfo info)
321344 URLEncoder .encode (info .getCredentialOffer (), "UTF-8" ));
322345 this .credentialOfferQrCode = asQrCode (this .credentialOfferLink );
323346
324- final String credentialOfferUri = String .format ("%s/api/offer/%s" ,
347+ this . credentialOfferUri = String .format ("%s/api/offer/%s" ,
325348 info .getCredentialIssuer ().toString (),
326349 info .getIdentifier ());
327350 this .credentialOfferUriLink = String .format (CREDENTIAL_OFFER_URI_QR_PATTERN , credentialOfferEndpoint ,
@@ -380,6 +403,18 @@ public void setCredentialOfferContent(String credentialOfferContent)
380403 }
381404
382405
406+ public String getCredentialOfferUri ()
407+ {
408+ return credentialOfferUri ;
409+ }
410+
411+
412+ public void setCredentialOfferUri (String credentialOfferUri )
413+ {
414+ this .credentialOfferUri = credentialOfferUri ;
415+ }
416+
417+
383418 public String getCredentialOfferUriLink ()
384419 {
385420 return credentialOfferUriLink ;
0 commit comments