Skip to content

Commit 462d947

Browse files
committed
fix underscore naming
1 parent 5271b11 commit 462d947

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/KubernetesClient/Authentication/TokenFileAuth.cs

+9-9
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,30 @@ namespace k8s.Authentication
99
{
1010
public class TokenFileAuth : ITokenProvider
1111
{
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; }
1515

16-
public TokenFileAuth(string token_file)
16+
public TokenFileAuth(string tokenFile)
1717
{
18-
_token_file = token_file;
18+
TokenFile = tokenFile;
1919
}
2020

2121
public async Task<AuthenticationHeaderValue> GetAuthenticationHeaderAsync(CancellationToken cancellationToken)
2222
{
23-
if (_token_expires_at < DateTime.UtcNow)
23+
if (TokenExpiresAt < DateTime.UtcNow)
2424
{
25-
_token = File.ReadAllText(_token_file).Trim();
25+
token = File.ReadAllText(TokenFile).Trim();
2626
// in fact, the token has a expiry of 10 minutes and kubelet
2727
// refreshes it at 8 minutes of its lifetime. setting the expiry
2828
// of 1 minute makes sure the token is reloaded regularly so
2929
// that its actual expiry is after the declared expiry here,
3030
// which is as suffciently true as the time of reading a token
3131
// < 10-8-1 minute.
32-
_token_expires_at = DateTime.UtcNow.AddMinutes(1);
32+
TokenExpiresAt = DateTime.UtcNow.AddMinutes(1);
3333
}
3434

35-
return new AuthenticationHeaderValue("Bearer", _token);
35+
return new AuthenticationHeaderValue("Bearer", token);
3636
}
3737
}
3838
}

src/KubernetesClient/WebSocketBuilder.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public WebSocketBuilder SetServerCertificateValidationCallback(
4747
return this;
4848
}
4949

50-
public static void CleanupServerCertificateValidationCallback(RemoteCertificateValidationCallback validationCallback)
50+
public void CleanupServerCertificateValidationCallback(RemoteCertificateValidationCallback validationCallback)
5151
{
5252
System.Net.ServicePointManager.ServerCertificateValidationCallback -= validationCallback;
5353
}

tests/KubernetesClient.Tests/TokenFileAuth.cs renamed to tests/KubernetesClient.Tests/TokenFileAuthTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ namespace k8s.Tests
99
{
1010
public class TokenFileAuthTests
1111
{
12-
public static Task Token()
12+
public async Task TestToken()
1313
{
1414
var auth = new TokenFileAuth("assets/token1");
1515
var result = await auth.GetAuthenticationHeaderAsync(CancellationToken.None).ConfigureAwait(false);
1616
result.Scheme.Should().Be("Bearer");
1717
result.Parameter.Should().Be("token1");
1818

19-
auth._token_file = "assets/token2";
19+
auth.TokenFile = "assets/token2";
2020
result = await auth.GetAuthenticationHeaderAsync(CancellationToken.None).ConfigureAwait(false);
2121
result.Scheme.Should().Be("Bearer");
2222
result.Parameter.Should().Be("token1");
2323

24-
auth._token_expires_at = DateTime.UtcNow;
24+
auth.TokenExpiresAt = DateTime.UtcNow;
2525
result = await auth.GetAuthenticationHeaderAsync(CancellationToken.None).ConfigureAwait(false);
2626
result.Scheme.Should().Be("Bearer");
2727
result.Parameter.Should().Be("token2");

0 commit comments

Comments
 (0)