Skip to content

Commit

Permalink
remove logging of user data (SAP#1304)
Browse files Browse the repository at this point in the history
* Improve error message in SpringSecurityContext.java
---------

Signed-off-by: Manuel Fink <[email protected]>
Co-authored-by: Manuel Fink <[email protected]>
  • Loading branch information
liga-oz and finkmanAtSap committed Oct 4, 2023
1 parent 2757325 commit 7274555
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static Token getToken() {
return (Token) principal;
}
throw new AccessDeniedException(
"Access forbidden: SecurityContextHolder does not contain a principal of type 'Token' " + principal);
"Access forbidden: SecurityContextHolder does not contain a principal of type 'Token'. Found instead a principal of type " + principal.getClass());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private SpringSecurityContext() {
* <p>
* Note: This method is introduced with xsuaa spring client lib.
*/
static public Token getToken() {
public static Token getToken() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();

if (authentication == null) {
Expand All @@ -41,7 +41,7 @@ static public Token getToken() {
return (Token) principal;
}
throw new AccessDeniedException(
"Access forbidden: SecurityContextHolder does not contain a principal of type 'Token' " + principal);
"Access forbidden: SecurityContextHolder does not contain a principal of type 'Token'. Found instead a principal of type " + principal.getClass());
}

/**
Expand All @@ -57,7 +57,7 @@ static public Token getToken() {
* the extractor used to turn Jwt scopes into Spring Security
* authorities.
*/
static public void init(String encodedJwtToken, JwtDecoder xsuaaJwtDecoder,
public static void init(String encodedJwtToken, JwtDecoder xsuaaJwtDecoder,
AuthoritiesExtractor authoritiesExtractor) {
Assert.isInstanceOf(XsuaaJwtDecoder.class, xsuaaJwtDecoder,
"Passed JwtDecoder instance must be of type 'XsuaaJwtDecoder'");
Expand All @@ -74,7 +74,7 @@ static public void init(String encodedJwtToken, JwtDecoder xsuaaJwtDecoder,
* Cleans up the Spring Security Context {@link SecurityContextHolder} and
* release thread locals for Garbage Collector to avoid memory leaks resources.
*/
static public void clear() {
public static void clear() {
SecurityContextHolder.clearContext();
}
}
}

0 comments on commit 7274555

Please sign in to comment.