I have a custom implementation of the Picketlink PathAuthorizer
interface that checks if a URL is allowed for the user.
public class BssPathAuthorizer implements PathAuthorizer {
@Inject
Identity identity;
@Override
public boolean authorize(PathConfiguration pathConfiguration,
HttpServletRequest request,
HttpServletResponse response) {
if (identity != null){
LOG.log(Level.FINE, "Identity loggato: {0}", identity.isLoggedIn());
String uri = request.getRequestURI();
String contextpath = request.getContextPath();
LOG.log(Level.FINE, "URI: {0}, context path: {1}",
new Object[]{uri, contextpath});
Method m = findMethod(uri);
...
}
After I get the method by findMethod()
, I'll check some annotations and then return true
if the user has permission.
Is there a simple way to retrieve the Java method from the requested URL (for example:
.../user/edit
)?What is the class method that implement it (for example
UserManager.edit()
)?