tvaultapi/src/main/java/com/tmobile/cso/vault/api/controller/ControllerUtil.java
public static IAMPortalCred readIAMPortalCredFile(String fileLocation, boolean isDelete) {
		File iamCredFile = null;
		log.debug("Trying to read IAM cred file");
		try {
			iamCredFile = new File(fileLocation+"/iamportalcred");
			if ( iamCredFile.exists()) {
				iamPortalCred = new IAMPortalCred();
				Scanner sc = new Scanner(iamCredFile);
				while (sc.hasNextLine()) {
					String line = sc.nextLine();
					if (line.startsWith(USERSTR)) {
						iamUsername = line.substring(USERSTR.length(), line.length());
						iamPortalCred.setRoleId(line.substring(USERSTR.length(), line.length()));
						log.debug("Successfully read username: from iamportalcred file");
					}
					else if (line.startsWith(PASSWORDSTR)) {
						iamPassword = line.substring(PASSWORDSTR.length(), line.length());
						iamPortalCred.setSecretId(line.substring(PASSWORDSTR.length(), line.length()));
						log.debug("Successfully read password: from iamportalcred file");
					}
				}
				sc.close();
			}
		} catch (IOException e) {
			log.error(String.format("Unable to read IAM cred file: [%s]", e.getMessage()));
		}
		try {
			if (iamCredFile.exists() && isDelete) {
				if (iamCredFile.delete()) {
					log.debug("Successfully deleted IAM cred file");
				}
				else {
					log.error("Unable to get delete IAM cred file");
				}
			}
		} catch (Exception e) {
			log.error(String.format("Unable to get delete IAM cred file: [%s]", e.getMessage()));
		}
		return iamPortalCred;
	}
/**
	 * To read IAM portal cred file
	 * @param fileLocation
	 * @param isDelete
	 * @return
	 */
To read IAM portal cred file
@param fileLocation
@param isDelete
@return
To read IAM portal cred file @param fileLocation @param isDelete @return
public static IAMPortalCred readIAMPortalCredFile(String fileLocation, boolean isDelete) {
		File iamCredFile = null;
		log.debug("Trying to read IAM cred file");
		try {
			iamCredFile = new File(fileLocation+"/iamportalcred");
			if ( iamCredFile.exists()) {
				iamPortalCred = new IAMPortalCred();
				Scanner sc = new Scanner(iamCredFile);
				while (sc.hasNextLine()) {
					String line = sc.nextLine();
					if (line.startsWith(USERSTR)) {
						iamUsername = line.substring(USERSTR.length(), line.length());
						iamPortalCred.setRoleId(line.substring(USERSTR.length(), line.length()));
						log.debug("Successfully read username: from iamportalcred file");
					}
					else if (line.startsWith(PASSWORDSTR)) {
						iamPassword = line.substring(PASSWORDSTR.length(), line.length());
						iamPortalCred.setSecretId(line.substring(PASSWORDSTR.length(), line.length()));
						log.debug("Successfully read password: from iamportalcred file");
					}
				}
				sc.close();
			}
		} catch (IOException e) {
			log.error(String.format("Unable to read IAM cred file: [%s]", e.getMessage()));
		}
		try {
			if (iamCredFile.exists() && isDelete) {
				if (iamCredFile.delete()) {
					log.debug("Successfully deleted IAM cred file");
				}
				else {
					log.error("Unable to get delete IAM cred file");
				}
			}
		} catch (Exception e) {
			log.error(String.format("Unable to get delete IAM cred file: [%s]", e.getMessage()));
		}
		return iamPortalCred;
	}
public static IAMPortalCred readIAMPortalCredFile ( String fileLocation , boolean isDelete ) { File iamCredFile = null ; log . debug ( "Trying to read IAM cred file" ) ; try { iamCredFile = new File ( fileLocation + "/iamportalcred" ) ; if ( iamCredFile . exists ( ) ) { iamPortalCred = new IAMPortalCred ( ) ; Scanner sc = new Scanner ( iamCredFile ) ; while ( sc . hasNextLine ( ) ) { String line = sc . nextLine ( ) ; if ( line . startsWith ( USERSTR ) ) { iamUsername = line . substring ( USERSTR . length ( ) , line . length ( ) ) ; iamPortalCred . setRoleId ( line . substring ( USERSTR . length ( ) , line . length ( ) ) ) ; log . debug ( "Successfully read username: from iamportalcred file" ) ; } else if ( line . startsWith ( PASSWORDSTR ) ) { iamPassword = line . substring ( PASSWORDSTR . length ( ) , line . length ( ) ) ; iamPortalCred . setSecretId ( line . substring ( PASSWORDSTR . length ( ) , line . length ( ) ) ) ; log . debug ( "Successfully read password: from iamportalcred file" ) ; } } sc . close ( ) ; } } catch ( IOException e ) { log . error ( String . format ( "Unable to read IAM cred file: [%s]" , e . getMessage ( ) ) ) ; } try { if ( iamCredFile . exists ( ) && isDelete ) { if ( iamCredFile . delete ( ) ) { log . debug ( "Successfully deleted IAM cred file" ) ; } else { log . error ( "Unable to get delete IAM cred file" ) ; } } } catch ( Exception e ) { log . error ( String . format ( "Unable to get delete IAM cred file: [%s]" , e . getMessage ( ) ) ) ; } return iamPortalCred ; }
To read IAM portal cred file
 @param fileLocation
 @param isDelete
 @return
To read IAM portal cred file @param fileLocation @param isDelete @return