SEBSERV-467 fixed only authenticate on testing if no token

This commit is contained in:
anhefti 2023-10-02 17:02:41 +02:00
parent ac8c7b034d
commit 51033385fd

View file

@ -33,8 +33,10 @@ public class OlatLmsRestTemplate extends RestTemplate {
private ClientCredentialsResourceDetails details; private ClientCredentialsResourceDetails details;
public void testAuthentication() { public void testAuthentication() {
if (this.token == null) {
authenticate(); authenticate();
} }
}
public OlatLmsRestTemplate(final ClientCredentialsResourceDetails details) { public OlatLmsRestTemplate(final ClientCredentialsResourceDetails details) {
super(); super();
@ -49,6 +51,7 @@ public class OlatLmsRestTemplate extends RestTemplate {
final ClientHttpRequestExecution execution) throws IOException { final ClientHttpRequestExecution execution) throws IOException {
try { try {
// if there's no token, authenticate first // if there's no token, authenticate first
if (OlatLmsRestTemplate.this.token == null) { if (OlatLmsRestTemplate.this.token == null) {
authenticate(); authenticate();