diff --git a/src/main/java/de/hmmh/pmt/Config.java b/src/main/java/de/hmmh/pmt/Config.java new file mode 100644 index 0000000..392d80a --- /dev/null +++ b/src/main/java/de/hmmh/pmt/Config.java @@ -0,0 +1,13 @@ +package de.hmmh.pmt; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestTemplate; + +@Configuration +public class Config { + @Bean + public RestTemplate restTemplate() { + return new RestTemplate(); + } +} diff --git a/src/main/java/de/hmmh/pmt/auth/JWT.java b/src/main/java/de/hmmh/pmt/auth/JWT.java index 5360d62..a1f26c3 100644 --- a/src/main/java/de/hmmh/pmt/auth/JWT.java +++ b/src/main/java/de/hmmh/pmt/auth/JWT.java @@ -2,6 +2,7 @@ package de.hmmh.pmt.auth; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; @@ -25,7 +26,8 @@ public class JWT implements LogoutHandler { private static final String OIDC_LOGOUT_ROUTE = "/protocol/openid-connect/logout"; private static final String OIDC_TOKEN_HINT_QUERY_PARAMETER = "id_token_hin"; - private final RestTemplate template = new RestTemplate(); + @Autowired + private RestTemplate template; @Override public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {