org.apache.kylin.rest.security.ExternalAclProvider Java Examples

The following examples show how to use org.apache.kylin.rest.security.ExternalAclProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RangerKylinAuthorizer.java    From ranger with Apache License 2.0 5 votes vote down vote up
@Override
public boolean checkPermission(String user, List<String> groups, String entityType, String entityUuid,
		Permission permission) {
	if (LOG.isDebugEnabled()) {
		LOG.debug("==> RangerKylinAuthorizer.checkPermission( user=" + user + ", groups=" + groups
				+ ", entityType=" + entityType + ", entityUuid=" + entityUuid + ", permission=" + permission + ")");
	}

	boolean ret = false;

	if (kylinPlugin != null) {
		String projectName = null;
		KylinConfig kylinConfig = KylinConfig.getInstanceFromEnv();
		if (AclEntityType.PROJECT_INSTANCE.equals(entityType)) {
			ProjectInstance projectInstance = ProjectManager.getInstance(kylinConfig).getPrjByUuid(entityUuid);
			if (projectInstance != null) {
				projectName = projectInstance.getName();
			} else {
				if (LOG.isWarnEnabled()) {
					LOG.warn("Could not find kylin project for given uuid=" + entityUuid);
				}
			}
		}

		String accessType = ExternalAclProvider.transformPermission(permission);
		RangerKylinAccessRequest request = new RangerKylinAccessRequest(projectName, user, groups, accessType,
				clientIPAddress);

		RangerAccessResult result = kylinPlugin.isAccessAllowed(request);
		if (result != null && result.getIsAllowed()) {
			ret = true;
		}
	}

	if (LOG.isDebugEnabled()) {
		LOG.debug("<== RangerKylinAuthorizer.checkPermission(): result=" + ret);
	}

	return ret;
}
 
Example #2
Source File: RangerKylinAuthorizer.java    From ranger with Apache License 2.0 5 votes vote down vote up
@Override
public void init() {
	if (LOG.isDebugEnabled()) {
		LOG.debug("==> RangerKylinAuthorizer.init()");
	}

	try {

		rangerPluginClassLoader = RangerPluginClassLoader.getInstance(RANGER_PLUGIN_TYPE, this.getClass());

		@SuppressWarnings("unchecked")
		Class<ExternalAclProvider> cls = (Class<ExternalAclProvider>) Class.forName(
				RANGER_KYLIN_AUTHORIZER_IMPL_CLASSNAME, true, rangerPluginClassLoader);

		activatePluginClassLoader();

		externalAclProvider = cls.newInstance();
		externalAclProvider.init();
	} catch (Exception e) {
		LOG.error("Error Enabling RangerKylinPlugin", e);
	} finally {
		deactivatePluginClassLoader();
	}

	if (LOG.isDebugEnabled()) {
		LOG.debug("<== RangerKylinAuthorizer.init()");
	}
}
 
Example #3
Source File: AccessController.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public void afterPropertiesSet() throws Exception {
    // init ExternalAclProvider
    ExternalAclProvider.getInstance();
}
 
Example #4
Source File: AccessController.java    From kylin with Apache License 2.0 4 votes vote down vote up
@Override
public void afterPropertiesSet() throws Exception {
    // init ExternalAclProvider
    ExternalAclProvider.getInstance();
}