@@ -166,12 +166,12 @@ func AuthenticateUnscoped(data *Auth_data) error {
166
166
167
167
return authenticate (data , b )
168
168
}
169
-
170
169
func authenticate (data * Auth_data , b []byte ) error {
171
170
auth_url := data .Server + "/v3/auth/tokens?nocatalog"
172
171
173
172
log .Debug ("Authentication request to URL: %s" , auth_url )
174
- log .Debug ("Authentication request body: \n %s" , b )
173
+
174
+ log .Debug ("Authentication request body: \n %s" , anonymisePasswordsTokens (data , b ))
175
175
176
176
request , err := http .NewRequest ("POST" , auth_url , bytes .NewBuffer (b ))
177
177
if err != nil {
@@ -216,6 +216,20 @@ func authenticate(data *Auth_data, b []byte) error {
216
216
return nil
217
217
}
218
218
219
+ func anonymisePasswordsTokens (data * Auth_data , json []byte ) []byte {
220
+ anonJson := json
221
+ if data .Password != "" {
222
+ anonJson = bytes .Replace (anonJson , []byte ("\" password\" :\" " + data .Password + "\" " ),
223
+ []byte ("\" password\" :\" ********\" " ), - 1 )
224
+ }
225
+ if data .UnscopedToken != "" {
226
+ anonJson = bytes .Replace (anonJson , []byte ("\" token\" :{\" id\" :\" " + data .UnscopedToken + "\" " ),
227
+ []byte ("\" token\" :{\" id\" :\" ****************\" " ), - 1 )
228
+ }
229
+
230
+ return anonJson
231
+ }
232
+
219
233
// Projects Section
220
234
type Projects_data struct {
221
235
Token string
0 commit comments