@@ -55,9 +55,17 @@ private static string GetSecretKey(IGxContext context)
5555 }
5656
5757 public static bool Verify ( string pgmName , string issuer , string value , string jwtToken , IGxContext context )
58- {
59- WebSecureToken token ;
60- return WebSecurityHelper . Verify ( pgmName , issuer , value , jwtToken , out token , context ) ;
58+ {
59+ WebSecureToken token ;
60+ WebSecureToken jwtTokenObj = SecureTokenHelper . getWebSecureToken ( jwtToken , GetSecretKey ( context ) ) ;
61+ if ( jwtTokenObj != null && jwtTokenObj . ValueType == ValueTypeHash )
62+ {
63+ return Verify ( pgmName , issuer , GetHash ( value ) , jwtToken , out token , context ) ;
64+ }
65+ else
66+ {
67+ return Verify ( pgmName , issuer , value , jwtToken , out token , context ) ;
68+ }
6169 }
6270 public static bool Verify ( string pgmName , string issuer , string value , string jwtToken , out WebSecureToken token , IGxContext context )
6371 {
@@ -255,20 +263,22 @@ internal static bool Verify(string jwtToken, WebSecureToken outToken, string sec
255263 }
256264 internal static TokenValue GetTokenValue ( IGxJSONSerializable obj )
257265 {
258-
259- string jsonString = obj . ToJSonString ( ) ;
266+ return GetTokenValue ( obj . ToJSonString ( ) ) ;
267+ }
268+ internal static TokenValue GetTokenValue ( string value )
269+ {
260270
261- if ( jsonString . Length > MaxTokenValueLength )
271+ if ( value != null && value . Length > MaxTokenValueLength )
262272 {
263- string hash = GetHash ( jsonString ) ;
273+ string hash = GetHash ( value ) ;
264274 GXLogging . Debug ( _log , $ "GetTokenValue: TokenValue is too long, using hash: { hash } instead of original value.") ;
265- GXLogging . Debug ( _log , $ "Server TokenOriginalValue:" + jsonString ) ;
275+ GXLogging . Debug ( _log , $ "Server TokenOriginalValue:" + value ) ;
266276 return new TokenValue ( ) { Value = hash , ValueType = ValueTypeHash } ;
267277 }
268278 else
269279 {
270- GXLogging . Debug ( _log , $ "GetTokenValue:" + jsonString ) ;
271- return new TokenValue ( ) { Value = jsonString } ;
280+ GXLogging . Debug ( _log , $ "GetTokenValue:" + value ) ;
281+ return new TokenValue ( ) { Value = value } ;
272282 }
273283 }
274284 internal static string GetHash ( string jsonString )
0 commit comments