Skip to content

Commit

Permalink
Fix the getClassLoader runtime exception
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Liang <jiallian@amazon.com>
  • Loading branch information
RyanL1997 committed Jul 24, 2023
1 parent 78f31d5 commit e584b15
Showing 1 changed file with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,25 @@ public OnBehalfOfAuthenticator(Settings settings) {
}

private JwtParser initParser(final String signingKey) {
JwtParser _jwtParser = keyUtil.keyAlgorithmCheck(signingKey, log);
if (_jwtParser != null) {
return _jwtParser;
} else {
throw new RuntimeException("Unable to find on behalf of authenticator signing key");
final SecurityManager sm = System.getSecurityManager();

if (sm != null) {
sm.checkPermission(new SpecialPermission());
}

JwtParser _jwtParser = AccessController.doPrivileged(new PrivilegedAction<JwtParser>() {
@Override
public JwtParser run() {
JwtParser parser = keyUtil.keyAlgorithmCheck(signingKey, log);
if (parser != null) {
return parser;
} else {
throw new RuntimeException("Unable to find on behalf of authenticator signing key");
}
}
});

return _jwtParser;
}

private List<String> extractSecurityRolesFromClaims(Claims claims) {
Expand Down

0 comments on commit e584b15

Please sign in to comment.