Github user jinmeiliao commented on a diff in the pull request: https://github.com/apache/incubator-geode/pull/228#discussion_r73898764 --- Diff: geode-core/src/main/java/org/apache/geode/security/templates/SampleSecurityManager.java --- @@ -126,26 +126,33 @@ public boolean authorize(final Principal principal, final ResourcePermission con @Override public void init(final Properties securityProperties) throws NotAuthorizedException { - String jsonPropertyValue = securityProperties.getProperty(SECURITY_JSON); + boolean initialized = false; + + String jsonPropertyValue = securityProperties != null ? securityProperties.getProperty(SECURITY_JSON) : null; if (jsonPropertyValue == null) { - throw new AuthenticationFailedException("SampleSecurityManager: property [" + SECURITY_JSON + "] must be set."); - } + initialized = initializeFromJsonResource(DEFAULT_JSON_FILE_NAME); + } else { - // 1st try to load value as a json resource - boolean initialized = initializeFromJsonResource(jsonPropertyValue); + // 1st try to load value as a json resource + initialized = initializeFromJsonResource(jsonPropertyValue); - // 2nd try to load value as a json file - if (!initialized) { - initialized = initializeFromJsonFile(new File(jsonPropertyValue)); - } + // 2nd try to load value as a json file --- End diff -- Do we really need the 2nd try and 3rd try? We don't use SampleSeucurityManager this way. If we can get rid these additional tries, then the init could be simple as this: String jsonPropertyValue = securityProperties.getProperty(SECURITY_JSON); if(jsonPropertyValue == null) jsonPropertyValue = DEFAULT_JSON_FILE_NAME; if(!initializeFromJsonResource(jsonPropertyValue)){ // throw exception.... }
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---