Skip to content

Commit

Permalink
logging for Moodle autologin
Browse files Browse the repository at this point in the history
  • Loading branch information
anhefti committed Dec 10, 2024
1 parent c4a13d9 commit eefa6af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private boolean checkUserSession() {
this.pageService.getI18nSupport());
logoutSuccess.open(null);
} catch (final Exception ee) {
log.warn("Unable to auto-logout: ", ee.getMessage());
log.warn("Unable to auto-logout: {}", ee.getMessage());
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,16 @@ public boolean isValid() {
public boolean isLoggedIn() {
final OAuth2AccessToken accessToken = this.restTemplate.getOAuth2ClientContext().getAccessToken();
if (accessToken == null || StringUtils.isEmpty(accessToken.toString())) {
log.warn("No Access Token for user: {}", this.restTemplate.getOAuth2ClientContext().getAccessTokenRequest().getHeaders());
return false;
}

try {
final ResponseEntity<String> forEntity =
this.restTemplate.getForEntity(this.currentUserURI, String.class);

if (forEntity.getStatusCode() != HttpStatus.OK) {
log.warn("Failed to verify user login on webservice: {}", forEntity.getBody());
return false;
}
} catch (final Exception e) {
Expand Down

0 comments on commit eefa6af

Please sign in to comment.