28
28
import javax .servlet .ServletContext ;
29
29
import javax .ws .rs .core .Context ;
30
30
31
+ import com .google .gson .JsonObject ;
31
32
import io .antmedia .AppSettings ;
32
33
import io .antmedia .EncoderSettings ;
33
34
@@ -2018,11 +2019,11 @@ public void testJwtBlacklist(){
2018
2019
return ;
2019
2020
}
2020
2021
2021
- final AppSettings appSettingsModel = ConsoleAppRestServiceTest .callGetAppSettings ("LiveApp " );
2022
+ final AppSettings appSettingsModel = ConsoleAppRestServiceTest .callGetAppSettings ("cleanapp " );
2022
2023
appSettingsModel .setJwtStreamSecretKey ("testtesttesttesttesttesttesttest" );
2023
2024
appSettingsModel .setJwtBlacklistEnabled (true );
2024
2025
2025
- result = ConsoleAppRestServiceTest .callSetAppSettings ("LiveApp " , appSettingsModel );
2026
+ result = ConsoleAppRestServiceTest .callSetAppSettings ("cleanapp " , appSettingsModel );
2026
2027
assertTrue (result .isSuccess ());
2027
2028
2028
2029
final String clearJwtBlacklistUrl = ROOT_SERVICE_URL + "/v2/broadcasts/jwt-black-list-clear" ;
@@ -2045,17 +2046,27 @@ public void testJwtBlacklist(){
2045
2046
final String validJwt2 = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdHJlYW1JZCI6InRlc3RzdHJlYW0iLCJ0eXBlIjoicHVibGlzaCIsImV4cCI6OTg4NzUwNzUwMX0.f4YTJUOmO7yuGpD7W4i_fffv2IVi1JB3mZVxNv8LSdI" ;
2046
2047
final String validJwt3 = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdHJlYW1JZCI6InRlc3RzdHJlYW0iLCJ0eXBlIjoicHVibGlzaCIsImV4cCI6OTg4NzUwNzUwMn0.bSbIumeAeM-k5zLndtII49z_458L8Lqg3eVweahvpb4" ;
2047
2048
2048
- String jwtRequestBody1 = new JSONObject ().put ("jwt" , validJwt1 ).toString ();
2049
+
2050
+ JsonObject jwtRequest1 = new JsonObject ();
2051
+ jwtRequest1 .addProperty ("jwt" ,validJwt1 );
2052
+
2053
+ JsonObject jwtRequest2 = new JsonObject ();
2054
+ jwtRequest2 .addProperty ("jwt" ,validJwt2 );
2055
+
2056
+ JsonObject jwtRequest3 = new JsonObject ();
2057
+ jwtRequest3 .addProperty ("jwt" ,validJwt3 );
2058
+
2059
+ String jwtRequestBody1 = gson .toJson (jwtRequest1 );
2049
2060
HttpPost addJwtRequest1 = new HttpPost (jwtBlacklistUrl );
2050
2061
addJwtRequest1 .setHeader ("Content-Type" , "application/json" );
2051
2062
addJwtRequest1 .setEntity (new StringEntity (jwtRequestBody1 ));
2052
2063
2053
- String jwtRequestBody2 = new JSONObject (). put ( "jwt" , validJwt2 ). toString ( );
2064
+ String jwtRequestBody2 = gson . toJson ( jwtRequest2 );
2054
2065
HttpPost addJwtRequest2 = new HttpPost (jwtBlacklistUrl );
2055
2066
addJwtRequest2 .setHeader ("Content-Type" , "application/json" );
2056
2067
addJwtRequest2 .setEntity (new StringEntity (jwtRequestBody2 ));
2057
2068
2058
- String jwtRequestBody3 = new JSONObject (). put ( "jwt" , validJwt3 ). toString ( );
2069
+ String jwtRequestBody3 = gson . toJson ( jwtRequest3 );
2059
2070
HttpPost addJwtRequest3 = new HttpPost (jwtBlacklistUrl );
2060
2071
addJwtRequest3 .setHeader ("Content-Type" , "application/json" );
2061
2072
addJwtRequest3 .setEntity (new StringEntity (jwtRequestBody3 ));
@@ -2151,7 +2162,10 @@ public void testJwtBlacklist(){
2151
2162
2152
2163
2153
2164
} catch (Exception e ){
2154
- logger .error (e .toString ());
2165
+ e .printStackTrace ();
2166
+
2167
+ fail (e .getMessage ());
2168
+
2155
2169
}
2156
2170
2157
2171
}
0 commit comments