org.apache.hadoop.security.alias.CredentialProvider.CredentialEntry Java Examples

The following examples show how to use org.apache.hadoop.security.alias.CredentialProvider.CredentialEntry. 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: Configuration.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Get the credential entry by name from a credential provider.
 *
 * Handle key deprecation.
 *
 * @param provider a credential provider
 * @param name alias of the credential
 * @return the credential entry or null if not found
 */
private CredentialEntry getCredentialEntry(CredentialProvider provider,
                                           String name) throws IOException {
	CredentialEntry entry = provider.getCredentialEntry(name);
	if (entry != null) {
		return entry;
	}

	// The old name is stored in the credential provider.
	String oldName = getDeprecatedKey(name);
	if (oldName != null) {
		entry = provider.getCredentialEntry(oldName);
		if (entry != null) {
			logDeprecationOnce(oldName, provider.toString());
			return entry;
		}
	}

	// The name is deprecated.
	DeprecatedKeyInfo keyInfo = getDeprecatedKeyInfo(name);
	if (keyInfo != null && keyInfo.newKeys != null) {
		for (String newName : keyInfo.newKeys) {
			entry = provider.getCredentialEntry(newName);
			if (entry != null) {
				logDeprecationOnce(name, null);
				return entry;
			}
		}
	}

	return null;
}
 
Example #2
Source File: Configuration.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Get the credential entry by name from a credential provider.
 *
 * Handle key deprecation.
 *
 * @param provider a credential provider
 * @param name alias of the credential
 * @return the credential entry or null if not found
 */
private CredentialEntry getCredentialEntry(CredentialProvider provider,
                                           String name) throws IOException {
	CredentialEntry entry = provider.getCredentialEntry(name);
	if (entry != null) {
		return entry;
	}

	// The old name is stored in the credential provider.
	String oldName = getDeprecatedKey(name);
	if (oldName != null) {
		entry = provider.getCredentialEntry(oldName);
		if (entry != null) {
			logDeprecationOnce(oldName, provider.toString());
			return entry;
		}
	}

	// The name is deprecated.
	DeprecatedKeyInfo keyInfo = getDeprecatedKeyInfo(name);
	if (keyInfo != null && keyInfo.newKeys != null) {
		for (String newName : keyInfo.newKeys) {
			entry = provider.getCredentialEntry(newName);
			if (entry != null) {
				logDeprecationOnce(name, null);
				return entry;
			}
		}
	}

	return null;
}
 
Example #3
Source File: Configuration.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Get the credential entry by name from a credential provider.
 *
 * Handle key deprecation.
 *
 * @param provider a credential provider
 * @param name alias of the credential
 * @return the credential entry or null if not found
 */
private CredentialEntry getCredentialEntry(CredentialProvider provider,
                                           String name) throws IOException {
	CredentialEntry entry = provider.getCredentialEntry(name);
	if (entry != null) {
		return entry;
	}

	// The old name is stored in the credential provider.
	String oldName = getDeprecatedKey(name);
	if (oldName != null) {
		entry = provider.getCredentialEntry(oldName);
		if (entry != null) {
			logDeprecationOnce(oldName, provider.toString());
			return entry;
		}
	}

	// The name is deprecated.
	DeprecatedKeyInfo keyInfo = getDeprecatedKeyInfo(name);
	if (keyInfo != null && keyInfo.newKeys != null) {
		for (String newName : keyInfo.newKeys) {
			entry = provider.getCredentialEntry(newName);
			if (entry != null) {
				logDeprecationOnce(name, null);
				return entry;
			}
		}
	}

	return null;
}