class XacmlService extends ServerResource {

    @VisibleForTesting
    boolean checkPermission(String action) throws EntitlementException {

        try {
            Request restletRequest = getRequest();
            String urlLastSegment = restletRequest.getResourceRef().getLastSegment();
            String realm = RestletRealmRouter.getRealmFromRequest(restletRequest);

            final Map<String, String> context = (Map<String, String>)
                    ServletUtils.getRequest(getRequest()).getAttribute(FORGEROCK_AUTH_CONTEXT);
            final String tokenId = context.get("tokenId");
            final SSOToken token = SSOTokenManager.getInstance().createSSOToken(tokenId);

            return checkPermission(action, urlLastSegment, realm, token);

        } catch (SSOException e) {
            debug.warning("XacmlService permission evaluation failed", e);
            throw new EntitlementException(INTERNAL_ERROR, e);
        }
    }

    @Inject public  XacmlService(XACMLExportImport importExport, PrivilegedAction<SSOToken> adminTokenAction,
            @Named("frRest") Debug debug, RestLog restLog, DelegationEvaluator evaluator,
            JacksonRepresentationFactory jacksonRepresentationFactory);

}