Created
September 19, 2016 10:37
-
-
Save coheigea/209aea0dceef7fdc01e5f7b8b01b0bd9 to your computer and use it in GitHub Desktop.
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
@Override | |
public boolean authorize(Session arg0, Operation arg1, Resource arg2) { | |
if (arg0.principal() == null) { | |
return false; | |
} | |
String principal = arg0.principal().getName(); | |
if (principal.startsWith("CN=Client") | |
&& ("Read".equals(arg1.name()) || "Describe".equals(arg1.name())) | |
&& arg2.name().startsWith("test")) { | |
return true; | |
} else if (principal.startsWith("CN=Service") && ("Read".equals(arg1.name()) || "Describe".equals(arg1.name()) | |
|| "Write".equals(arg1.name()) || "Create".equals(arg1.name()))) { | |
return true; | |
} else if (principal.startsWith("CN=Broker")) { | |
return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment