@@ -9,30 +9,30 @@ namespace k8s.Authentication
9
9
{
10
10
public class TokenFileAuth : ITokenProvider
11
11
{
12
- private string _token ;
13
- internal string _token_file { get ; set ; }
14
- internal DateTime _token_expires_at { get ; set ; }
12
+ private string token ;
13
+ internal string TokenFile { get ; set ; }
14
+ internal DateTime TokenExpiresAt { get ; set ; }
15
15
16
- public TokenFileAuth ( string token_file )
16
+ public TokenFileAuth ( string tokenFile )
17
17
{
18
- _token_file = token_file ;
18
+ TokenFile = tokenFile ;
19
19
}
20
20
21
21
public async Task < AuthenticationHeaderValue > GetAuthenticationHeaderAsync ( CancellationToken cancellationToken )
22
22
{
23
- if ( _token_expires_at < DateTime . UtcNow )
23
+ if ( TokenExpiresAt < DateTime . UtcNow )
24
24
{
25
- _token = File . ReadAllText ( _token_file ) . Trim ( ) ;
25
+ token = File . ReadAllText ( TokenFile ) . Trim ( ) ;
26
26
// in fact, the token has a expiry of 10 minutes and kubelet
27
27
// refreshes it at 8 minutes of its lifetime. setting the expiry
28
28
// of 1 minute makes sure the token is reloaded regularly so
29
29
// that its actual expiry is after the declared expiry here,
30
30
// which is as suffciently true as the time of reading a token
31
31
// < 10-8-1 minute.
32
- _token_expires_at = DateTime . UtcNow . AddMinutes ( 1 ) ;
32
+ TokenExpiresAt = DateTime . UtcNow . AddMinutes ( 1 ) ;
33
33
}
34
34
35
- return new AuthenticationHeaderValue ( "Bearer" , _token ) ;
35
+ return new AuthenticationHeaderValue ( "Bearer" , token ) ;
36
36
}
37
37
}
38
38
}
0 commit comments