@@ -89,17 +89,30 @@ private void handleRevokedTokenMessage(String revokedToken, long expiryTime, Str
89
89
revokedTokenMap .get (APIConstants .NotificationEvent .CONSUMER_KEY ) != null &&
90
90
revokedTokenMap .containsKey (APIConstants .NotificationEvent .REVOCATION_TIME ) &&
91
91
revokedTokenMap .get (APIConstants .NotificationEvent .REVOCATION_TIME ) != null ) {
92
- RevokedJWTDataHolder .getInstance ().addRevokedConsumerKeyToMap (
93
- (String ) revokedTokenMap .get (APIConstants .NotificationEvent .CONSUMER_KEY ),
94
- (long ) revokedTokenMap .get (APIConstants .NotificationEvent .REVOCATION_TIME ));
92
+ try {
93
+ RevokedJWTDataHolder .getInstance ().addRevokedConsumerKeyToMap (
94
+ (String ) revokedTokenMap .get (APIConstants .NotificationEvent .CONSUMER_KEY ),
95
+ convertRevokedTime (revokedTokenMap ));
96
+ } catch (NumberFormatException e ) {
97
+ log .warn ("Event dropped due to unsupported value type for "
98
+ + APIConstants .NotificationEvent .REVOCATION_TIME + " : "
99
+ + revokedTokenMap .get (APIConstants .NotificationEvent .REVOCATION_TIME ));
100
+ }
95
101
}
96
102
} else if (APIConstants .NotificationEvent .SUBJECT_ENTITY_REVOCATION_EVENT .equals (tokenType )) {
97
103
HashMap <String , Object > revokedTokenMap = base64Decode (revokedToken );
98
104
if (revokedTokenMap .get (APIConstants .NotificationEvent .ENTITY_TYPE ) != null &&
99
105
revokedTokenMap .get (APIConstants .NotificationEvent .REVOCATION_TIME ) != null &&
100
106
revokedTokenMap .get (APIConstants .NotificationEvent .ENTITY_ID ) != null ) {
101
107
String entityType = (String ) revokedTokenMap .get (APIConstants .NotificationEvent .ENTITY_TYPE );
102
- long revocationTime = (long ) revokedTokenMap .get (APIConstants .NotificationEvent .REVOCATION_TIME );
108
+ long revocationTime = 0 ;
109
+ try {
110
+ revocationTime = convertRevokedTime (revokedTokenMap );
111
+ } catch (NumberFormatException e ) {
112
+ log .warn ("Event dropped due to unsupported value type for "
113
+ + APIConstants .NotificationEvent .REVOCATION_TIME + " : "
114
+ + revokedTokenMap .get (APIConstants .NotificationEvent .REVOCATION_TIME ));
115
+ }
103
116
String entityId = (String ) revokedTokenMap .get (APIConstants .NotificationEvent .ENTITY_ID );
104
117
if (APIConstants .NotificationEvent .ENTITY_TYPE_USER_ID .equals (entityType )) {
105
118
RevokedJWTDataHolder .getInstance ().addRevokedSubjectEntityUserToMap (entityId , revocationTime );
@@ -138,4 +151,9 @@ private HashMap<String, Object> base64Decode(String encodedRevokedToken) {
138
151
}
139
152
return new HashMap <>();
140
153
}
154
+
155
+ private long convertRevokedTime (HashMap <String , Object > revokedTokenMap ) throws NumberFormatException {
156
+
157
+ return Long .parseLong ((String ) revokedTokenMap .get (APIConstants .NotificationEvent .REVOCATION_TIME ));
158
+ }
141
159
}
0 commit comments