Skip to content

Commit da636fc

Browse files
OKTA-855031: Disable caching of responses for UserFactorApi::getFactorTransactionStatus (#1598)
OKTA-855031: Disable caching responses on UserFactorApi::getFactorTransactionStatus
1 parent 3c31c61 commit da636fc

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

api/src/main/resources/custom_templates/ApiClient.mustache

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,23 +1155,24 @@ protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>
11551155
cacheKey = cacheKey.split("\\?")[0];
11561156
}
11571157

1158-
if (method == HttpMethod.DELETE.name()) {
1158+
if (method.equals(HttpMethod.DELETE.name())) {
11591159
cache.remove(cacheKey);
11601160
}
11611161

11621162
String[] uriSegments = path.split("/");
11631163

1164-
if (uriSegments != null && uriSegments.length >= 6) {
1164+
if (uriSegments.length >= 6) {
11651165
String key = getBasePath() + "/" + uriSegments[1] + "/" + uriSegments[2] + "/" + uriSegments[3] + "/" + uriSegments[4];
11661166
if (cache.get(key) != null) {
11671167
cache.remove(key);
11681168
}
11691169
}
11701170

1171-
if (method == HttpMethod.GET.name() &&
1171+
if (method.equals(HttpMethod.GET.name()) &&
11721172
!returnType.getType().getTypeName().contains("List") &&
11731173
!(url.contains("expand")) &&
1174-
!(url.contains(".well-known/okta-organization"))) {
1174+
!(url.contains(".well-known/okta-organization"))
1175+
&& !(String.join("/", uriSegments)).matches("/api/v1/users/[A-Za-z0-9]+/factors/[A-Za-z0-9]+/transactions/[A-Za-z0-9]+")) {
11751176
11761177
T cacheData = (T) cache.get(cacheKey);
11771178
@@ -1180,7 +1181,7 @@ protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>
11801181
try (CloseableHttpResponse response = httpClient.execute(builder.build(), context)) {
11811182
T t = processResponse(response, returnType);
11821183
1183-
if (method.equals(HttpMethod.GET.name()) && Objects.nonNull(t)) {
1184+
if (Objects.nonNull(t)) {
11841185
11851186
Map<String, ?> map = getObjectMapper().convertValue(t, LinkedHashMap.class);
11861187
@@ -1191,7 +1192,7 @@ protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>
11911192
if (Objects.nonNull(links)) {
11921193
LinkedHashMap<String, String> self = links.get("self");
11931194
if (Objects.nonNull(self)) {
1194-
href = (String) self.get("href");
1195+
href = self.get("href");
11951196
}
11961197
}
11971198
}

0 commit comments

Comments
 (0)