Fix NPE when client is not set in context during token encoding

This commit fixes an issue throwing an NPE when trying to encode a token without having a client set in the session context. In other places in this class (like getSignatureAlgorithm(String)) this is checked. But in the type(TokenCategory) it was forgotten to check.
This commit is contained in:
mkrueger92 2025-07-04 15:48:53 +02:00 committed by Marek Posolda
parent 05d0c34681
commit b70342dda7

View File

@ -244,7 +244,7 @@ public class DefaultTokenManager implements TokenManager {
switch (category) {
case ACCESS:
ClientModel client = session.getContext().getClient();
return OIDCAdvancedConfigWrapper.fromClientModel(client).isUseRfc9068AccessTokenHeaderType()
return client != null && OIDCAdvancedConfigWrapper.fromClientModel(client).isUseRfc9068AccessTokenHeaderType()
? TokenUtil.TOKEN_TYPE_JWT_ACCESS_TOKEN
: "JWT";
case LOGOUT: