@@ -45,6 +45,7 @@ public class AasxCredentialsEntry
4545 public string bearer = string . Empty ;
4646 public DateTime bearerValidFrom = DateTime . MinValue ;
4747 public DateTime bearerValidTo = DateTime . MinValue ;
48+ public List < string > bearerList = new List < string > ( ) ;
4849
4950 public string GetAsText ( )
5051 {
@@ -58,6 +59,11 @@ public string GetAsText()
5859 text += p + ": " + parameters [ p ] + "\r \n " ;
5960 }
6061 text += $ "bearer: { bearer } \r \n ";
62+ text += "bearerList:\r \n " ;
63+ for ( var b = 0 ; b < bearerList . Count ; b ++ )
64+ {
65+ text += b + ": " + bearerList [ b ] + "\r \n " ;
66+ }
6167 text += "\r \n " ;
6268
6369 return text ;
@@ -296,7 +302,10 @@ public static void bearerCheckAndInit(AasxCredentialsEntry c, AasxTaskService aa
296302 valid = false ;
297303 if ( valid )
298304 return ;
299- }
305+ }
306+
307+ c . bearer = string . Empty ;
308+ c . bearerList . Clear ( ) ;
300309
301310 string authServerEndPoint = c . parameters [ 0 ] ;
302311
@@ -355,18 +364,6 @@ public static void bearerCheckAndInit(AasxCredentialsEntry c, AasxTaskService aa
355364 Console . WriteLine ( "clientCertificatePW " + clientCertificatePW ) ;
356365 }
357366
358- /*
359- if (c.bearer != string.Empty)
360- {
361- bool valid = true;
362- var jwtToken = new JwtSecurityToken(c.bearer);
363- if ((jwtToken == null) || (jwtToken.ValidFrom > DateTime.UtcNow) || (jwtToken.ValidTo < DateTime.UtcNow))
364- valid = false;
365- if (valid)
366- return;
367- }
368- */
369-
370367 var handler = new HttpClientHandler ( )
371368 {
372369 ServerCertificateCustomValidationCallback = delegate { return true ; } ,
@@ -600,6 +597,7 @@ public static void bearerCheckAndInit(AasxCredentialsEntry c, AasxTaskService aa
600597 var response = client . SendAsync ( request ) ;
601598 var content = response . GetAwaiter ( ) . GetResult ( ) . Content . ContentToString ( ) ;
602599
600+ c . bearerList . Add ( c . bearer ) ;
603601 c . bearer = "" ;
604602 doc = JsonDocument . Parse ( content ) ;
605603 if ( doc . RootElement . TryGetProperty ( "access_token" , out var tokenElement ) )
@@ -635,6 +633,7 @@ public static void bearerCheckAndInit(AasxCredentialsEntry c, AasxTaskService aa
635633 var response = client . SendAsync ( request ) ;
636634 var content = response . GetAwaiter ( ) . GetResult ( ) . Content . ContentToString ( ) ;
637635
636+ c . bearerList . Add ( c . bearer ) ;
638637 c . bearer = "" ;
639638 doc = JsonDocument . Parse ( content ) ;
640639 if ( doc . RootElement . TryGetProperty ( "access_token" , out var tokenElement ) )
@@ -670,6 +669,7 @@ public static void bearerCheckAndInit(AasxCredentialsEntry c, AasxTaskService aa
670669 var response = client . SendAsync ( request ) ;
671670 var content = response . GetAwaiter ( ) . GetResult ( ) . Content . ContentToString ( ) ;
672671
672+ c . bearerList . Add ( c . bearer ) ;
673673 c . bearer = "" ;
674674 doc = JsonDocument . Parse ( content ) ;
675675 if ( doc . RootElement . TryGetProperty ( "access_token" , out var tokenElement ) )
0 commit comments