forked from wildfly/wildfly
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
671ac72
commit a4c6369
Showing
13 changed files
with
1,047 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2012, Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. See the copyright.txt file in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
package org.jboss.as.jmx.rbac; | ||
|
||
import java.io.Serializable; | ||
|
||
import javax.management.ListenerNotFoundException; | ||
import javax.management.MBeanNotificationInfo; | ||
import javax.management.NotificationBroadcaster; | ||
import javax.management.NotificationFilter; | ||
import javax.management.NotificationListener; | ||
|
||
public class Bean implements BeanMBean, NotificationBroadcaster, Serializable { | ||
private static final long serialVersionUID = 1L; | ||
volatile int attr = 5; | ||
|
||
@Override | ||
public int getAttr() { | ||
return attr; | ||
} | ||
|
||
@Override | ||
public void setAttr(int i) { | ||
attr = i; | ||
} | ||
|
||
public void method() { | ||
|
||
} | ||
|
||
@Override | ||
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) | ||
throws IllegalArgumentException { | ||
} | ||
|
||
@Override | ||
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException { | ||
} | ||
|
||
@Override | ||
public MBeanNotificationInfo[] getNotificationInfo() { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2012, Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. See the copyright.txt file in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
package org.jboss.as.jmx.rbac; | ||
|
||
public interface BeanMBean { | ||
int getAttr(); | ||
void setAttr(int i); | ||
void method(); | ||
} |
51 changes: 51 additions & 0 deletions
51
jmx/src/test/java/org/jboss/as/jmx/rbac/JmxRbacDisabledTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2012, Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. See the copyright.txt file in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
package org.jboss.as.jmx.rbac; | ||
|
||
import org.jboss.as.controller.access.rbac.StandardRole; | ||
|
||
/** | ||
* | ||
* @author <a href="[email protected]">Kabir Khan</a> | ||
*/ | ||
public class JmxRbacDisabledTestCase extends JmxRbacTestCase { | ||
|
||
public JmxRbacDisabledTestCase() { | ||
super(false); | ||
} | ||
|
||
@Override | ||
protected boolean canRead(StandardRole standardRole, boolean sensitiveMBeans) { | ||
return true; | ||
} | ||
|
||
@Override | ||
protected boolean canWrite(StandardRole standardRole, boolean sensitiveMBeans) { | ||
return true; | ||
} | ||
|
||
@Override | ||
protected boolean canAccessSpecial(StandardRole standardRole) { | ||
return true; | ||
} | ||
|
||
} |
76 changes: 76 additions & 0 deletions
76
jmx/src/test/java/org/jboss/as/jmx/rbac/JmxRbacEnabledTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2012, Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. See the copyright.txt file in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
package org.jboss.as.jmx.rbac; | ||
|
||
import org.jboss.as.controller.access.rbac.StandardRole; | ||
|
||
/** | ||
* | ||
* @author <a href="[email protected]">Kabir Khan</a> | ||
*/ | ||
public class JmxRbacEnabledTestCase extends JmxRbacTestCase { | ||
|
||
public JmxRbacEnabledTestCase() { | ||
super(true); | ||
} | ||
|
||
@Override | ||
protected boolean canRead(StandardRole standardRole, boolean sensitiveMBeans) { | ||
if (!sensitiveMBeans) { | ||
return true; | ||
} | ||
switch (standardRole) { | ||
case SUPERUSER: | ||
case ADMINISTRATOR: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
|
||
@Override | ||
protected boolean canWrite(StandardRole standardRole, boolean sensitiveMBeans) { | ||
if (!sensitiveMBeans) { | ||
switch (standardRole) { | ||
case MONITOR: | ||
case DEPLOYER: | ||
case AUDITOR: | ||
return false; | ||
default: | ||
return true; | ||
} | ||
} | ||
switch (standardRole) { | ||
case SUPERUSER: | ||
case ADMINISTRATOR: | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
|
||
@Override | ||
protected boolean canAccessSpecial(StandardRole standardRole) { | ||
return standardRole == StandardRole.ADMINISTRATOR || standardRole == StandardRole.SUPERUSER; | ||
} | ||
|
||
} |
Oops, something went wrong.