agave-systems/systems-core/src/main/java/org/iplantc/service/systems/manager/SystemManager.java
/**
	 * Removes all internal user credentials for the given RemoteConfig type on the 
	 * give system. The defaults will be preserved
	 * 
	 * @param system The RemoteSystem
	 * @param apiUsername
	 * @param remoteConfigType The config type for which you want to remove credentials "login" or "storage"
	 * @throws SystemArgumentException
	 * @throws PermissionException 
	 */
Removes all internal user credentials for the given RemoteConfig type on the
give system. The defaults will be preserved


Removes all internal user credentials for the given RemoteConfig type on the give system . The defaults will be preserved
public void clearAllInternalUserAuthConfigOnSystemOfType(
			RemoteSystem system, String apiUsername, String remoteConfigType) 
	throws SystemArgumentException, PermissionException
	{
		if (system == null) {
			throw new SystemArgumentException("No system provided.");
		} else if (system.isPubliclyAvailable()) {
			throw new SystemArgumentException("Internal users are not supported on public systems.");
		} else if (!system.getUserRole(apiUsername).getRole().canAdmin()) {
			throw new PermissionException("User does not have permission to manage internal user credentials on this system.");
		}
		if (StringUtils.isEmpty(apiUsername)) {
			throw new SystemArgumentException("No username provided.");
		}
		if (remoteConfigType == null) {
			throw new SystemArgumentException("No credential type provided. " +
					"Please specify either 'login' or 'storage'");
		} else if (!remoteConfigType.equalsIgnoreCase("storage") && 
				!remoteConfigType.equalsIgnoreCase("login")) {
			throw new SystemArgumentException("Invalid credential type '" + 
				remoteConfigType + "'. Please specify either 'login' or 'storage'");
		} else if (remoteConfigType.equalsIgnoreCase("login")) {
			if (!(system instanceof ExecutionSystem)) {
				throw new SystemArgumentException("Invalid credential type. " + 
						 "Only execution systems can have login credentials.");
			}
		}
		if (remoteConfigType.equalsIgnoreCase("storage"))
		{
			AuthConfig defaultStorageAuthConfig = system.getStorageConfig().getDefaultAuthConfig();
			system.getStorageConfig().getAuthConfigs().clear();
			system.getStorageConfig().addAuthConfig(defaultStorageAuthConfig);
			getDao().persist(system);
		} 
		else if (system instanceof ExecutionSystem) 
		{
			AuthConfig defaultLoginAuthConfig = ((ExecutionSystem)system).getLoginConfig().getDefaultAuthConfig();
			((ExecutionSystem)system).getLoginConfig().getAuthConfigs().clear();
			((ExecutionSystem)system).getLoginConfig().addAuthConfig(defaultLoginAuthConfig);
			getDao().persist(system);
		}
		getEventProcessor().processSystemUpdateEvent(system, SystemEventType.CLEAR_CREDENTIALS, apiUsername);
	}
public void clearAllInternalUserAuthConfigOnSystemOfType ( RemoteSystem system , String apiUsername , String remoteConfigType ) throws SystemArgumentException , PermissionException { if ( system == null ) { throw new SystemArgumentException ( "No system provided." ) ; } else if ( system . isPubliclyAvailable ( ) ) { throw new SystemArgumentException ( "Internal users are not supported on public systems." ) ; } else if ( ! system . getUserRole ( apiUsername ) . getRole ( ) . canAdmin ( ) ) { throw new PermissionException ( "User does not have permission to manage internal user credentials on this system." ) ; } if ( StringUtils . isEmpty ( apiUsername ) ) { throw new SystemArgumentException ( "No username provided." ) ; } if ( remoteConfigType == null ) { throw new SystemArgumentException ( "No credential type provided. " + "Please specify either 'login' or 'storage'" ) ; } else if ( ! remoteConfigType . equalsIgnoreCase ( "storage" ) && ! remoteConfigType . equalsIgnoreCase ( "login" ) ) { throw new SystemArgumentException ( "Invalid credential type '" + remoteConfigType + "'. Please specify either 'login' or 'storage'" ) ; } else if ( remoteConfigType . equalsIgnoreCase ( "login" ) ) { if ( ! ( system instanceof ExecutionSystem ) ) { throw new SystemArgumentException ( "Invalid credential type. " + "Only execution systems can have login credentials." ) ; } } if ( remoteConfigType . equalsIgnoreCase ( "storage" ) ) { AuthConfig defaultStorageAuthConfig = system . getStorageConfig ( ) . getDefaultAuthConfig ( ) ; system . getStorageConfig ( ) . getAuthConfigs ( ) . clear ( ) ; system . getStorageConfig ( ) . addAuthConfig ( defaultStorageAuthConfig ) ; getDao ( ) . persist ( system ) ; } else if ( system instanceof ExecutionSystem ) { AuthConfig defaultLoginAuthConfig = ( ( ExecutionSystem ) system ) . getLoginConfig ( ) . getDefaultAuthConfig ( ) ; ( ( ExecutionSystem ) system ) . getLoginConfig ( ) . getAuthConfigs ( ) . clear ( ) ; ( ( ExecutionSystem ) system ) . getLoginConfig ( ) . addAuthConfig ( defaultLoginAuthConfig ) ; getDao ( ) . persist ( system ) ; } getEventProcessor ( ) . processSystemUpdateEvent ( system , SystemEventType . CLEAR_CREDENTIALS , apiUsername ) ; }
Removes all internal user credentials for the given RemoteConfig type on the
 give system.
Removes all internal user credentials for the given RemoteConfig type on the give system .
// make sure they're requesting a valid config type for this auth config //		NotificationManager.process(system.getUuid(), "CLEAR_CREDENTIALS", system.getOwner());