boolean authorizeSuperUserOrAdministrator(String methodName) throws MBeanException { if (authorizer != null) { //TODO populate the 'environment' variable AuthorizationResult authorizationResult = authorizer.authorizeJmxOperation(createCaller(), null, new JmxAction(methodName, JmxAction.Impact.EXTRA_SENSITIVE)); if (authorizationResult.getDecision() != Decision.PERMIT) { throw JmxMessages.MESSAGES.unauthorized(); } } return true; }
boolean authorizeSensitiveOperation(String methodName, boolean readOnly, boolean exception) throws MBeanException { if (authorizer != null) { final JmxAction target = new JmxAction(methodName, readOnly ? JmxAction.Impact.READ_ONLY : JmxAction.Impact.WRITE); //TODO populate the 'environment' variable AuthorizationResult authorizationResult = authorizer.authorizeJmxOperation(createCaller(), null, target); if (authorizationResult.getDecision() != Decision.PERMIT) { if (exception) { throw JmxMessages.MESSAGES.unauthorized(); } else { return false; } } } return true; }
private void authorizeClassloadingOperation(MBeanServerPlugin delegate, ObjectName objectName, String methodName) throws MBeanException { if (authorizer != null && delegate.shouldAuthorize()) { JmxTarget target = new JmxTarget(methodName, objectName, isNonFacadeMBeansSensitive(), jmxEffect, jmxEffect); JmxAction action = new JmxAction(methodName, JmxAction.Impact.CLASSLOADING); //TODO populate the 'environment' variable SecurityIdentity securityIdentity = securityIdentitySupplier != null ? securityIdentitySupplier.get() : null; AuthorizationResult authorizationResult = authorizer.authorizeJmxOperation(createCaller(securityIdentity), null, action, target); if (authorizationResult.getDecision() != Decision.PERMIT) { throw JmxLogger.ROOT_LOGGER.unauthorized(); } } }
private boolean authorizeMBeanOperation(MBeanServerPlugin delegate, ObjectName name, String methodName, String attributeName, JmxAction.Impact impact, boolean exception) throws MBeanException { if (authorizer != null && delegate.shouldAuthorize()) { JmxTarget target = new JmxTarget(methodName, name, isNonFacadeMBeansSensitive(), jmxEffect, jmxEffect); JmxAction action = new JmxAction(methodName, impact, attributeName); //TODO populate the 'environment' variable SecurityIdentity securityIdentity = securityIdentitySupplier != null ? securityIdentitySupplier.get() : null; AuthorizationResult authorizationResult = authorizer.authorizeJmxOperation(createCaller(securityIdentity), null, action, target); if (authorizationResult.getDecision() != Decision.PERMIT) { if (exception) { throw JmxLogger.ROOT_LOGGER.unauthorized(); } else { return false; } } } return true; }