@@ -23,7 +23,7 @@ import (
23
23
"k8s.io/klog/v2"
24
24
)
25
25
26
- // GetKeyvaultToken() returns token for Keyvault endpoint
26
+ // GetKeyvaultToken() returns token for Keyvault endpoint.
27
27
func GetKeyvaultToken (config * config.AzureConfig , env * azure.Environment , resource string , proxyMode bool ) (authorizer autorest.Authorizer , err error ) {
28
28
servicePrincipalToken , err := GetServicePrincipalToken (config , env .ActiveDirectoryEndpoint , resource , proxyMode )
29
29
if err != nil {
@@ -33,7 +33,7 @@ func GetKeyvaultToken(config *config.AzureConfig, env *azure.Environment, resour
33
33
return authorizer , nil
34
34
}
35
35
36
- // GetServicePrincipalToken creates a new service principal token based on the configuration
36
+ // GetServicePrincipalToken creates a new service principal token based on the configuration.
37
37
func GetServicePrincipalToken (config * config.AzureConfig , aadEndpoint , resource string , proxyMode bool ) (adal.OAuthTokenProvider , error ) {
38
38
oauthConfig , err := adal .NewOAuthConfig (aadEndpoint , config .TenantID )
39
39
if err != nil {
@@ -106,7 +106,7 @@ func GetServicePrincipalToken(config *config.AzureConfig, aadEndpoint, resource
106
106
return nil , fmt .Errorf ("no credentials provided for accessing keyvault" )
107
107
}
108
108
109
- // ParseAzureEnvironment returns azure environment by name
109
+ // ParseAzureEnvironment returns azure environment by name.
110
110
func ParseAzureEnvironment (cloudName string ) (* azure.Environment , error ) {
111
111
var env azure.Environment
112
112
var err error
@@ -119,7 +119,7 @@ func ParseAzureEnvironment(cloudName string) (*azure.Environment, error) {
119
119
}
120
120
121
121
// decodePkcs12 decodes a PKCS#12 client certificate by extracting the public certificate and
122
- // the private RSA key
122
+ // the private RSA key.
123
123
func decodePkcs12 (pkcs []byte , password string ) (* x509.Certificate , * rsa.PrivateKey , error ) {
124
124
privateKey , certificate , err := pkcs12 .Decode (pkcs , password )
125
125
if err != nil {
@@ -133,13 +133,13 @@ func decodePkcs12(pkcs []byte, password string) (*x509.Certificate, *rsa.Private
133
133
return certificate , rsaPrivateKey , nil
134
134
}
135
135
136
- // redactClientCredentials applies regex to a sensitive string and return the redacted value
136
+ // redactClientCredentials applies regex to a sensitive string and return the redacted value.
137
137
func redactClientCredentials (sensitiveString string ) string {
138
- r , _ := regexp .Compile (`^(\S{4})(\S|\s)*(\S{4})$` )
138
+ r := regexp .MustCompile (`^(\S{4})(\S|\s)*(\S{4})$` )
139
139
return r .ReplaceAllString (sensitiveString , "$1##### REDACTED #####$3" )
140
140
}
141
141
142
- // addTargetTypeHeader adds the target header if proxy mode is enabled
142
+ // addTargetTypeHeader adds the target header if proxy mode is enabled.
143
143
func addTargetTypeHeader (spt * adal.ServicePrincipalToken ) * adal.ServicePrincipalToken {
144
144
spt .SetSender (autorest .CreateSender (
145
145
(func () autorest.SendDecorator {
0 commit comments