I am trying to implement a custom authorizer in my web application using play framework with pac4j. My custom authorizer is getting called but I am not able to access request payload as string using WebContext's getRequestContent()
method. It is coming as null. I am able to access request headers properly.
My custom authorizer
package v2;
import org.pac4j.core.authorization.authorizer.ProfileAuthorizer;
import org.pac4j.core.context.WebContext;
import org.pac4j.core.context.session.SessionStore;
import org.pac4j.core.profile.UserProfile;
import org.pac4j.play.PlayWebContext;
import java.util.List;
public class OPAAuthorizer extends ProfileAuthorizer {
@Override
public boolean isAuthorized(WebContext context, SessionStore sessionStore, List<UserProfile> profiles) {
System.out.println(context.getRequestHeader("Authorization"));
System.out.println(context.getRequestContent());
return true;
}
@Override
protected boolean isProfileAuthorized(WebContext context, SessionStore sessionStore, UserProfile profile) {
return false;
}
}