2424import java .util .function .Predicate ;
2525import java .util .stream .Collectors ;
2626
27- import static org .privacyidea .PIConstants .*;
27+ import static org .privacyidea .PIConstants .CONTAINER_TYPE_SMARTPHONE ;
28+ import static org .privacyidea .PIConstants .TOKEN_TYPE_PUSH ;
29+ import static org .privacyidea .PIConstants .TOKEN_TYPE_WEBAUTHN ;
2830
2931/**
3032 * This class parses the JSON response of privacyIDEA into a POJO for easier access.
@@ -52,7 +54,6 @@ public class PIResponse
5254 public PIError error = null ;
5355 // Passkey content is json string and can be passed to the browser as is
5456 public String passkeyChallenge = "" ;
55- public String passkeyMessage = "" ;
5657 public String passkeyRegistration = "" ;
5758 public String username = "" ;
5859 public String enrollmentLink = "" ;
@@ -79,7 +80,11 @@ public boolean authenticationSuccessful()
7980 */
8081 public boolean pushAvailable ()
8182 {
82- return multiChallenge .stream ().anyMatch (c -> TOKEN_TYPE_PUSH .equals (c .getType ()));
83+ return multiChallenge .stream ().anyMatch (c -> isPushOrSmartphoneContainer (c .getType ()));
84+ }
85+
86+ private boolean isPushOrSmartphoneContainer (String type ) {
87+ return TOKEN_TYPE_PUSH .equals (type ) || CONTAINER_TYPE_SMARTPHONE .equals (type );
8388 }
8489
8590 /**
@@ -89,14 +94,14 @@ public boolean pushAvailable()
8994 */
9095 public String pushMessage ()
9196 {
92- return reduceChallengeMessagesWhere (c -> TOKEN_TYPE_PUSH . equals (c .getType ()));
97+ return reduceChallengeMessagesWhere (c -> isPushOrSmartphoneContainer (c .getType ()));
9398 }
9499
95100 public String otpTransactionId ()
96101 {
97102 for (Challenge challenge : multiChallenge )
98103 {
99- if (!TOKEN_TYPE_PUSH . equals (challenge .getType ()) && !TOKEN_TYPE_WEBAUTHN .equals (challenge .getType ()))
104+ if (!isPushOrSmartphoneContainer (challenge .getType ()) && !TOKEN_TYPE_WEBAUTHN .equals (challenge .getType ()))
100105 {
101106 return challenge .transactionID ;
102107 }
@@ -107,7 +112,7 @@ public String otpTransactionId()
107112 public String pushTransactionId () {
108113 for (Challenge challenge : multiChallenge )
109114 {
110- if (TOKEN_TYPE_PUSH . equals (challenge .getType ()))
115+ if (isPushOrSmartphoneContainer (challenge .getType ()))
111116 {
112117 return challenge .transactionID ;
113118 }
@@ -122,7 +127,7 @@ public String pushTransactionId() {
122127 */
123128 public String otpMessage ()
124129 {
125- return reduceChallengeMessagesWhere (c -> !(TOKEN_TYPE_PUSH . equals (c .getType ())));
130+ return reduceChallengeMessagesWhere (c -> !(isPushOrSmartphoneContainer (c .getType ())));
126131 }
127132
128133 private String reduceChallengeMessagesWhere (Predicate <Challenge > predicate )
0 commit comments