Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
0e6edfb4
Commit
0e6edfb4
authored
Apr 09, 2019
by
Greg Messner
Browse files
Added maskPrivateToken() method.
parent
f6833a4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/utils/HttpRequestUtils.java
View file @
0e6edfb4
...
@@ -144,4 +144,19 @@ public class HttpRequestUtils {
...
@@ -144,4 +144,19 @@ public class HttpRequestUtils {
return
(
out
.
toString
());
return
(
out
.
toString
());
}
}
/**
* Masks the PRIVATE-TOKEN header value with "********".
*
* @param s a String containing HTTP request info, usually logging info
* @return a String with the PRIVATE-TOKEN header value masked with asterisks
*/
public
static
String
maskPrivateToken
(
String
s
)
{
if
(
s
==
null
||
s
.
isEmpty
())
{
return
(
s
);
}
return
(
s
.
replaceAll
(
"PRIVATE\\-TOKEN\\: [\\S]*"
,
"PRIVATE-TOKEN: ********"
));
}
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment