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();