private void ensureSecurityEnabled() throws FeatureDisabledException { if (!authenticationEnabled) { throw new FeatureDisabledException(FeatureDisabledException.Feature.AUTHENTICATION, FeatureDisabledException.CDAP_SITE, Constants.Security.ENABLED, "true"); } if (!authorizationEnabled) { throw new FeatureDisabledException(FeatureDisabledException.Feature.AUTHORIZATION, FeatureDisabledException.CDAP_SITE, Constants.Security.Authorization.ENABLED, "true"); } }
private void ensureSecurityEnabled() throws FeatureDisabledException { if (!authenticationEnabled) { throw new FeatureDisabledException(FeatureDisabledException.Feature.AUTHENTICATION, FeatureDisabledException.CDAP_SITE, Constants.Security.ENABLED, "true"); } if (!authorizationEnabled) { throw new FeatureDisabledException(FeatureDisabledException.Feature.AUTHORIZATION, FeatureDisabledException.CDAP_SITE, Constants.Security.Authorization.ENABLED, "true"); } }
private HttpResponse doExecuteRequest(HttpRequest request, int... additionalAllowedErrorCodes) throws IOException, UnauthenticatedException, FeatureDisabledException, UnauthorizedException { int[] allowedErrorCodes = new int[additionalAllowedErrorCodes.length + 2]; System.arraycopy(additionalAllowedErrorCodes, 0, allowedErrorCodes, 0, additionalAllowedErrorCodes.length); allowedErrorCodes[additionalAllowedErrorCodes.length] = HttpURLConnection.HTTP_NOT_IMPLEMENTED; HttpResponse response = restClient.execute(request, config.getAccessToken(), allowedErrorCodes); if (HttpURLConnection.HTTP_NOT_IMPLEMENTED == response.getResponseCode()) { FeatureDisabledException.Feature feature = FeatureDisabledException.Feature.AUTHORIZATION; String enableConfig = Constants.Security.Authorization.ENABLED; if (response.getResponseBodyAsString().toLowerCase().contains("authentication")) { feature = FeatureDisabledException.Feature.AUTHENTICATION; enableConfig = Constants.Security.ENABLED; } throw new FeatureDisabledException(feature, FeatureDisabledException.CDAP_SITE, enableConfig, "true"); } return response; } }
namespaceQueryAdmin.get(impersonationRequest.getEntityId().getNamespaceId()).getConfig(); if (!nsConfig.isExploreAsPrincipal()) { throw new FeatureDisabledException(FeatureDisabledException.Feature.EXPLORE, NamespaceConfig.class.getSimpleName() + " of " + impersonationRequest.getEntityId(),