improved error logging
This commit is contained in:
@ -169,8 +169,8 @@ public class ApiKeyService implements Serializable {
|
|||||||
throw new JWTException("AccountControl exception");
|
throw new JWTException("AccountControl exception");
|
||||||
}
|
}
|
||||||
List<ApiKeyEntity> apiKeys = getUsersApiKeys(userAccount);
|
List<ApiKeyEntity> apiKeys = getUsersApiKeys(userAccount);
|
||||||
if (LOGGER.isDebugEnabled()) {
|
if (LOGGER.isTraceEnabled()) {
|
||||||
LOGGER.debug("Found {} keys for user {}", apiKeys.size(), userName);
|
LOGGER.trace("Found {} keys for user {}", apiKeys.size(), userName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator<ApiKeyEntity> it = apiKeys.iterator();
|
Iterator<ApiKeyEntity> it = apiKeys.iterator();
|
||||||
@ -178,21 +178,20 @@ public class ApiKeyService implements Serializable {
|
|||||||
while (keyToLogout == null && it.hasNext()) {
|
while (keyToLogout == null && it.hasNext()) {
|
||||||
ApiKeyEntity key = it.next();
|
ApiKeyEntity key = it.next();
|
||||||
if (key.getApiKey().equals(apiKey)) {
|
if (key.getApiKey().equals(apiKey)) {
|
||||||
if (LOGGER.isDebugEnabled()) {
|
if (LOGGER.isTraceEnabled()) {
|
||||||
LOGGER.debug("Found API key in database");
|
LOGGER.trace("Found API key in database");
|
||||||
}
|
}
|
||||||
|
|
||||||
ZonedDateTime issuedOn = ZonedDateTime.ofInstant(key.getIssuedOn().toInstant(), ZoneOffset.UTC);
|
ZonedDateTime issuedOn = ZonedDateTime.ofInstant(key.getIssuedOn().toInstant(), ZoneOffset.UTC);
|
||||||
String testString = JWTEncoder.encode(password, issuer, issuedOn, key.getAccount().getUsername(), key.getApiKey(), key.getExpiration());
|
String testString = JWTEncoder.encode(password, issuer, issuedOn, key.getAccount().getUsername(), key.getApiKey(), key.getExpiration());
|
||||||
if (LOGGER.isDebugEnabled()) {
|
if (LOGGER.isTraceEnabled()) {
|
||||||
LOGGER.debug("Successfully created validation JWT for user {}", userName);
|
LOGGER.trace("Successfully created validation JWT for user {}", userName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (authorizationHeader.equals(testString)) {
|
if (authorizationHeader.equals(testString)) {
|
||||||
if (LOGGER.isDebugEnabled()) {
|
if (LOGGER.isDebugEnabled()) {
|
||||||
LOGGER.debug("Found valid key for user {}", userName);
|
LOGGER.debug("Found valid key for user {}", userName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,7 +199,6 @@ public class ApiKeyService implements Serializable {
|
|||||||
if (LOGGER.isDebugEnabled()) {
|
if (LOGGER.isDebugEnabled()) {
|
||||||
LOGGER.debug("No valid key for user {} found", userName);
|
LOGGER.debug("No valid key for user {} found", userName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -44,6 +44,7 @@ public class APIExceptionInterceptor {
|
|||||||
proceedResponse = context.proceed();
|
proceedResponse = context.proceed();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
if (LOGGER.isDebugEnabled()) {
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
LOGGER.debug(ex.getMessage());
|
||||||
LOGGER.debug("Detailed stacktrace", new Object[]{ex});
|
LOGGER.debug("Detailed stacktrace", new Object[]{ex});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user