Skip to content

Commit

Permalink
securityLogic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pagrawal10 committed Jun 7, 2024
1 parent 8d2c5ad commit 57731c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import javax.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.util.Collection;

public class Pac4jFilter implements Filter
{
Expand Down Expand Up @@ -101,17 +100,9 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo
UserProfile profile = (UserProfile) securityLogic.perform(
context,
sessionStore,
pac4jConfig,
(JEEContext ctx, Collection<UserProfile> profiles, Object... parameters) -> {
if (profiles.isEmpty()) {
LOGGER.warn("No profiles found after OIDC auth.");
return null;
} else {
return profiles.iterator().next();
}
},
pac4jConfig, null,
JEEHttpActionAdapter.INSTANCE,
null, "none", null, null);
null, "none", null);
// Changed the Authorizer from null to "none".
// In the older version, if it is null, it simply grant access and returns authorized.
// But in the newer pac4j version, it uses CsrfAuthorizer as default, And because of this, It was returning 403 in API calls.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.pac4j.jee.context.JEEContext;
import org.pac4j.core.exception.http.ForbiddenAction;
import org.pac4j.core.exception.http.FoundAction;
import org.pac4j.core.exception.http.HttpAction;
import org.pac4j.core.exception.http.WithLocationAction;
import org.pac4j.jee.context.JEEContext;
import org.pac4j.jee.http.adapter.JEEHttpActionAdapter;

import javax.servlet.http.HttpServletRequest;
Expand Down

0 comments on commit 57731c8

Please sign in to comment.