Commit c4aab051 authored by Matija Obreza's avatar Matija Obreza

Web API filter on /webapi/*

parent 37b9ff18
......@@ -32,9 +32,9 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@Component("apiFilter")
public class ApiFilter extends OncePerRequestFilter {
private static final Logger _logger = LoggerFactory.getLogger(ApiFilter.class);
@Component("webApiFilter")
public class WebApiFilter extends OncePerRequestFilter {
private static final Logger _logger = LoggerFactory.getLogger(WebApiFilter.class);
@Autowired
private OAuth2ClientDetailsService clientDetailsService;
......@@ -48,7 +48,7 @@ public class ApiFilter extends OncePerRequestFilter {
ClientDetails clientDetails = clientDetailsService.loadClientByClientId(clientId);
try {
if (!clientDetails.getClientSecret().equals(clientSecret)) {
if (StringUtils.isNotBlank(clientDetails.getClientSecret()) && !clientDetails.getClientSecret().equals(clientSecret)) {
throw new Exception("Invalid client secret");
}
if (StringUtils.isBlank(referrer)) {
......
......@@ -141,13 +141,13 @@
</filter-mapping>
<filter>
<description>Filter API</description>
<filter-name>apiFilter</filter-name>
<description>Genesys Web API Filter</description>
<filter-name>webApiFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>apiFilter</filter-name>
<url-pattern>/api/genesys-api.js</url-pattern>
<filter-name>webApiFilter</filter-name>
<url-pattern>/webapi/*</url-pattern>
</filter-mapping>
<filter>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment