Skip to content

Commit 0960d75

Browse files
authored
Merge pull request jooby-project#2023 from jooby-project/1972
pac4j-module: Can't apply a client directly to a POST route. Fix jooby-project#1972
2 parents 324406b + bffa22a commit 0960d75

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎modules/jooby-pac4j/src/main/java/io/jooby/pac4j/Pac4jModule.java‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -493,9 +493,13 @@ public Pac4jModule client(@Nonnull Class<? extends Authorizer> authorizer,
493493
String pattern = entry.getKey();
494494
if (!pattern.equals("*")) {
495495
List<String> keys = Router.pathKeys(pattern);
496-
if (keys.size() == 0) {
497-
application.get(pattern, new SecurityFilterImpl(null, pac4j, options, lazyClientNameList(entry.getValue()),
498-
clientMap.get(pattern).authorizers));
496+
if (keys.isEmpty()) {
497+
SecurityFilterImpl securityFilter = new SecurityFilterImpl(null, pac4j, options,
498+
lazyClientNameList(entry.getValue()),
499+
clientMap.get(pattern).authorizers);
500+
application.get(pattern, securityFilter);
501+
// POST for direct authentication
502+
application.post(pattern, securityFilter);
499503
} else {
500504
application.decorator(new SecurityFilterImpl(pattern, pac4j, options, lazyClientNameList(entry.getValue()),
501505
clientMap.get(pattern).authorizers));

0 commit comments

Comments
 (0)