From 51033385fde476d94edc1fb116379e2339d24491 Mon Sep 17 00:00:00 2001 From: anhefti Date: Mon, 2 Oct 2023 17:02:41 +0200 Subject: [PATCH] SEBSERV-467 fixed only authenticate on testing if no token --- .../servicelayer/lms/impl/olat/OlatLmsRestTemplate.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsRestTemplate.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsRestTemplate.java index 5f0d36367..bad59306c 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsRestTemplate.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/olat/OlatLmsRestTemplate.java @@ -33,7 +33,9 @@ public class OlatLmsRestTemplate extends RestTemplate { private ClientCredentialsResourceDetails details; public void testAuthentication() { - authenticate(); + if (this.token == null) { + authenticate(); + } } public OlatLmsRestTemplate(final ClientCredentialsResourceDetails details) { @@ -49,6 +51,7 @@ public synchronized ClientHttpResponse intercept( final ClientHttpRequestExecution execution) throws IOException { try { + // if there's no token, authenticate first if (OlatLmsRestTemplate.this.token == null) { authenticate();