jwt settings added message on base64 validation exception

This commit is contained in:
Sergey Matvienko 2022-11-14 12:27:04 +01:00
parent fc1da12999
commit 335d88c82e

View File

@ -15,7 +15,6 @@
*/ */
package org.thingsboard.server.config.jwt; package org.thingsboard.server.config.jwt;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -53,7 +52,7 @@ public class JwtSettingsValidatorDefault implements JwtSettingsValidator {
try { try {
decodedKey = Base64.getDecoder().decode(jwtSettings.getTokenSigningKey()); decodedKey = Base64.getDecoder().decode(jwtSettings.getTokenSigningKey());
} catch (Exception e) { } catch (Exception e) {
throw new DataValidationException("JWT token signing key should be valid Base64 encoded string! " + e.getCause()); throw new DataValidationException("JWT token signing key should be a valid Base64 encoded string! " + e.getMessage());
} }
if (Arrays.isNullOrEmpty(decodedKey)) { if (Arrays.isNullOrEmpty(decodedKey)) {