Commit c4aab051 authored by Matija Obreza's avatar Matija Obreza
Browse files

Web API filter on /webapi/*

parent 37b9ff18
...@@ -32,9 +32,9 @@ import javax.servlet.http.HttpServletResponse; ...@@ -32,9 +32,9 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
@Component("apiFilter") @Component("webApiFilter")
public class ApiFilter extends OncePerRequestFilter { public class WebApiFilter extends OncePerRequestFilter {
private static final Logger _logger = LoggerFactory.getLogger(ApiFilter.class); private static final Logger _logger = LoggerFactory.getLogger(WebApiFilter.class);
@Autowired @Autowired
private OAuth2ClientDetailsService clientDetailsService; private OAuth2ClientDetailsService clientDetailsService;
...@@ -48,7 +48,7 @@ public class ApiFilter extends OncePerRequestFilter { ...@@ -48,7 +48,7 @@ public class ApiFilter extends OncePerRequestFilter {
ClientDetails clientDetails = clientDetailsService.loadClientByClientId(clientId); ClientDetails clientDetails = clientDetailsService.loadClientByClientId(clientId);
try { try {
if (!clientDetails.getClientSecret().equals(clientSecret)) { if (StringUtils.isNotBlank(clientDetails.getClientSecret()) && !clientDetails.getClientSecret().equals(clientSecret)) {
throw new Exception("Invalid client secret"); throw new Exception("Invalid client secret");
} }
if (StringUtils.isBlank(referrer)) { if (StringUtils.isBlank(referrer)) {
......
...@@ -141,13 +141,13 @@ ...@@ -141,13 +141,13 @@
</filter-mapping> </filter-mapping>
<filter> <filter>
<description>Filter API</description> <description>Genesys Web API Filter</description>
<filter-name>apiFilter</filter-name> <filter-name>webApiFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter> </filter>
<filter-mapping> <filter-mapping>
<filter-name>apiFilter</filter-name> <filter-name>webApiFilter</filter-name>
<url-pattern>/api/genesys-api.js</url-pattern> <url-pattern>/webapi/*</url-pattern>
</filter-mapping> </filter-mapping>
<filter> <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