Skip to content

Commit 4f4e95e

Browse files
committed
PMD
1 parent 7b892fe commit 4f4e95e

2 files changed

Lines changed: 18 additions & 15 deletions

File tree

oauth2-oidc-remember-me/src/test/java/software/xdev/sse/oauth2/rememberme/serializer/DefaultOAuth2CookieRememberMeAuthSerializerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void performAttackWithoutProtectionSuccess()
9191
List.of(
9292
"Unable to deserialize"::equals,
9393
s -> s.contains(AttackPerformer.SUCCESS_INDICATOR),
94-
s -> s.equals(AttackPerformer.SUCCESS_INDICATOR))
94+
AttackPerformer.SUCCESS_INDICATOR::equals)
9595
);
9696
Assertions.assertTrue(attackSuccessIds.contains(id));
9797
}

vaadin/src/main/java/software/xdev/sse/vaadin/SecureVaadinRequestCache.java

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -154,20 +154,7 @@ protected synchronized void initAllowedPaths()
154154
.stream()
155155
.map(RouteBaseData::getTemplate)
156156
.filter(s -> !s.isBlank())
157-
.map(s -> {
158-
final String urlParamIdentifier = "/:___url_parameter";
159-
final int urlParamIndex = s.indexOf(urlParamIdentifier);
160-
if(urlParamIndex == -1)
161-
{
162-
return s;
163-
}
164-
165-
final String substring = s.substring(0, urlParamIndex);
166-
return substring + "/*"
167-
// Do a full level wildcard if there is more stuff (excluding the optional ?)
168-
// behind the path-part
169-
+ (s.length() - substring.length() - urlParamIdentifier.length() <= 1 ? "" : "*");
170-
})
157+
.map(this::handleUrlParameterInPath)
171158
.map(s -> "/" + s)
172159
.collect(Collectors.toSet());
173160

@@ -184,4 +171,20 @@ protected synchronized void initAllowedPaths()
184171
.map(RequestMatcher.class::cast)
185172
.toList());
186173
}
174+
175+
protected String handleUrlParameterInPath(final String path)
176+
{
177+
final String urlParamIdentifier = "/:___url_parameter";
178+
final int urlParamIndex = path.indexOf(urlParamIdentifier);
179+
if(urlParamIndex == -1)
180+
{
181+
return path;
182+
}
183+
184+
final String substring = path.substring(0, urlParamIndex);
185+
return substring + "/*"
186+
// Do a full level wildcard if there is more stuff (excluding the optional ?)
187+
// behind the path-part
188+
+ (path.length() - substring.length() - urlParamIdentifier.length() <= 1 ? "" : "*");
189+
}
187190
}

0 commit comments

Comments
 (0)