tvaultapi/src/main/java/com/tmobile/cso/vault/api/service/IAMServiceAccountsService.java
private Response configureRemovedUserPermissions(String token, IAMServiceAccountUser iamServiceAccountUser,
			UserDetails userDetails, OIDCEntityResponse oidcEntityResponse, String groups, List<String> policies,
			String policiesString) {
		Response ldapConfigresponse = new Response();
		if (TVaultConstants.USERPASS.equals(vaultAuthMethod)) {
			ldapConfigresponse = ControllerUtil.configureUserpassUser(iamServiceAccountUser.getUsername(), policiesString, token);
		} else if (TVaultConstants.LDAP.equals(vaultAuthMethod)) {
			ldapConfigresponse = ControllerUtil.configureLDAPUser(iamServiceAccountUser.getUsername(), policiesString, groups, token);
		} else if (TVaultConstants.OIDC.equals(vaultAuthMethod)) {
			// OIDC Implementation : Entity Update
			try {
				ldapConfigresponse = oidcUtil.updateOIDCEntity(policies, oidcEntityResponse.getEntityName());
				oidcUtil.renewUserToken(userDetails.getClientToken());
			} catch (Exception e) {
				log.error(e);
				log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder().
						put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER)).
						put(LogMessage.ACTION, IAMServiceAccountConstants.REMOVE_USER_FROM_IAMSVCACC_MSG).
						put(LogMessage.MESSAGE, "Exception while updating the identity").
						put(LogMessage.STACKTRACE, Arrays.toString(e.getStackTrace())).
						put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).
						build()));
			}
		}
		return ldapConfigresponse;
	}
/**
	 * Method to configure the user permission after removed from IAM service account.
	 * @param token
	 * @param iamServiceAccountUser
	 * @param userDetails
	 * @param oidcEntityResponse
	 * @param groups
	 * @param policies
	 * @param policiesString
	 * @return
	 */
Method to configure the user permission after removed from IAM service account.
Method to configure the user permission after removed from IAM service account .
private Response configureRemovedUserPermissions(String token, IAMServiceAccountUser iamServiceAccountUser,
			UserDetails userDetails, OIDCEntityResponse oidcEntityResponse, String groups, List<String> policies,
			String policiesString) {
		Response ldapConfigresponse = new Response();
		if (TVaultConstants.USERPASS.equals(vaultAuthMethod)) {
			ldapConfigresponse = ControllerUtil.configureUserpassUser(iamServiceAccountUser.getUsername(), policiesString, token);
		} else if (TVaultConstants.LDAP.equals(vaultAuthMethod)) {
			ldapConfigresponse = ControllerUtil.configureLDAPUser(iamServiceAccountUser.getUsername(), policiesString, groups, token);
		} else if (TVaultConstants.OIDC.equals(vaultAuthMethod)) {
			try {
				ldapConfigresponse = oidcUtil.updateOIDCEntity(policies, oidcEntityResponse.getEntityName());
				oidcUtil.renewUserToken(userDetails.getClientToken());
			} catch (Exception e) {
				log.error(e);
				log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder().
						put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER)).
						put(LogMessage.ACTION, IAMServiceAccountConstants.REMOVE_USER_FROM_IAMSVCACC_MSG).
						put(LogMessage.MESSAGE, "Exception while updating the identity").
						put(LogMessage.STACKTRACE, Arrays.toString(e.getStackTrace())).
						put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)).
						build()));
			}
		}
		return ldapConfigresponse;
	}
private Response configureRemovedUserPermissions ( String token , IAMServiceAccountUser iamServiceAccountUser , UserDetails userDetails , OIDCEntityResponse oidcEntityResponse , String groups , List < String > policies , String policiesString ) { Response ldapConfigresponse = new Response ( ) ; if ( TVaultConstants . USERPASS . equals ( vaultAuthMethod ) ) { ldapConfigresponse = ControllerUtil . configureUserpassUser ( iamServiceAccountUser . getUsername ( ) , policiesString , token ) ; } else if ( TVaultConstants . LDAP . equals ( vaultAuthMethod ) ) { ldapConfigresponse = ControllerUtil . configureLDAPUser ( iamServiceAccountUser . getUsername ( ) , policiesString , groups , token ) ; } else if ( TVaultConstants . OIDC . equals ( vaultAuthMethod ) ) { try { ldapConfigresponse = oidcUtil . updateOIDCEntity ( policies , oidcEntityResponse . getEntityName ( ) ) ; oidcUtil . renewUserToken ( userDetails . getClientToken ( ) ) ; } catch ( Exception e ) { log . error ( e ) ; log . error ( JSONUtil . getJSON ( ImmutableMap . < String , String > builder ( ) . put ( LogMessage . USER , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . USER ) ) . put ( LogMessage . ACTION , IAMServiceAccountConstants . REMOVE_USER_FROM_IAMSVCACC_MSG ) . put ( LogMessage . MESSAGE , "Exception while updating the identity" ) . put ( LogMessage . STACKTRACE , Arrays . toString ( e . getStackTrace ( ) ) ) . put ( LogMessage . APIURL , ThreadLocalContext . getCurrentMap ( ) . get ( LogMessage . APIURL ) ) . build ( ) ) ) ; } } return ldapConfigresponse ; }
Method to configure the user permission after removed from IAM service account.
Method to configure the user permission after removed from IAM service account .
// OIDC Implementation : Entity Update