@Test public void updateOIDCEntity() throws Exception { String token = "4EpPYDSfgN2D4Gf7UmNO3nuL"; String name = "name"; List<String> policies = new ArrayList<>(); policies.add("safeadmin"); String entityName = "entityName"; OIDCEntityRequest oidcEntityRequest = new OIDCEntityRequest(); oidcEntityRequest.setDisabled(false); Map<String, String> metadata = new HashMap<String, String>(); metadata.put("organization", "t-vault"); oidcEntityRequest.setMetadata(metadata); oidcEntityRequest.setPolicies(null); oidcEntityRequest.setName(name); String jsonStr = JSONUtil.getJSON(oidcEntityRequest); Response response = getMockResponse(HttpStatus.OK, true, "{\"data\": [\"safeadmin\",\"vaultadmin\"]]"); when(tokenUtils.getSelfServiceTokenWithAppRole()).thenReturn(token); when(reqProcessor.process("/identity/entity/name/update", jsonStr, token)).thenReturn(response); Response responseEntity = oidcUtil.updateOIDCEntity(policies, entityName); assertEquals(HttpStatus.OK, responseEntity.getHttpstatus()); }
public Response updateOIDCEntity(List<String> policies, String entityName) { OIDCEntityRequest oidcEntityRequest = new OIDCEntityRequest(); oidcEntityRequest.setPolicies(policies); oidcEntityRequest.setDisabled(Boolean.FALSE); oidcEntityRequest.setName(entityName); Map<String, String> metaData = new HashMap<>(); oidcEntityRequest.setMetadata(metaData); String selfServiceSupportToken = tokenUtils.getSelfServiceTokenWithAppRole(); return updateEntityByName(selfServiceSupportToken, oidcEntityRequest); }
OIDCUtil { public Response updateOIDCEntity(List<String> policies, String entityName) { OIDCEntityRequest oidcEntityRequest = new OIDCEntityRequest(); oidcEntityRequest.setPolicies(policies); oidcEntityRequest.setDisabled(Boolean.FALSE); oidcEntityRequest.setName(entityName); Map<String, String> metaData = new HashMap<>(); oidcEntityRequest.setMetadata(metaData); String selfServiceSupportToken = tokenUtils.getSelfServiceTokenWithAppRole(); return updateEntityByName(selfServiceSupportToken, oidcEntityRequest); } }
OIDCUtil { public Response updateOIDCEntity(List<String> policies, String entityName) { OIDCEntityRequest oidcEntityRequest = new OIDCEntityRequest(); oidcEntityRequest.setPolicies(policies); oidcEntityRequest.setDisabled(Boolean.FALSE); oidcEntityRequest.setName(entityName); Map<String, String> metaData = new HashMap<>(); oidcEntityRequest.setMetadata(metaData); String selfServiceSupportToken = tokenUtils.getSelfServiceTokenWithAppRole(); return updateEntityByName(selfServiceSupportToken, oidcEntityRequest); } OIDCUtil(); }
OIDCUtil { public Response updateOIDCEntity(List<String> policies, String entityName) { OIDCEntityRequest oidcEntityRequest = new OIDCEntityRequest(); oidcEntityRequest.setPolicies(policies); oidcEntityRequest.setDisabled(Boolean.FALSE); oidcEntityRequest.setName(entityName); Map<String, String> metaData = new HashMap<>(); oidcEntityRequest.setMetadata(metaData); String selfServiceSupportToken = tokenUtils.getSelfServiceTokenWithAppRole(); return updateEntityByName(selfServiceSupportToken, oidcEntityRequest); } OIDCUtil(); String fetchMountAccessorForOidc(String token); OIDCEntityResponse getEntityLookUpResponse(String authMountResponse); Response updateGroupPolicies(String token, String groupName, List<String> policies,
			List<String> currentPolicies, String id); Response deleteGroupByName(String token, String name); OIDCGroup getIdentityGroupDetails(String groupName, String token); String getSSOToken(); String getGroupObjectResponse(String ssoToken, String groupName); String updateIdentityGroupByName(String token, OIDCIdentityGroupRequest oidcIdentityGroupRequest); Response createGroupAlias(String token, GroupAliasRequest groupAliasRequest); ResponseEntity<OIDCEntityResponse> oidcFetchEntityDetails(String token, String username, UserDetails userDetails); ResponseEntity<OIDCEntityResponse> entityLookUp(String token,
			OIDCLookupEntityRequest oidcLookupEntityRequest); Response deleteGroupAliasByID(String token, String id); Response updateOIDCEntity(List<String> policies, String entityName); Response updateEntityByName(String token, OIDCEntityRequest oidcEntityRequest); void renewUserToken(String token); List<String> getPoliciedFromTokenLookUp(String authMountResponse); List<String> tokenLookUp(String token); Response createEntityAlias(String token, OidcEntityAliasRequest oidcEntityAliasRequest); String getUserName(String email); List<DirectoryGroup> getGroupsFromAAD(String ssoToken, String groupName); String getIdOfTheUser(String accessToken, String userEmail); List<String> getSelfServiceGroupsFromAADById(String accessToken, String userAADId, String userName); }
OIDCUtil { public Response updateOIDCEntity(List<String> policies, String entityName) { OIDCEntityRequest oidcEntityRequest = new OIDCEntityRequest(); oidcEntityRequest.setPolicies(policies); oidcEntityRequest.setDisabled(Boolean.FALSE); oidcEntityRequest.setName(entityName); Map<String, String> metaData = new HashMap<>(); oidcEntityRequest.setMetadata(metaData); String selfServiceSupportToken = tokenUtils.getSelfServiceTokenWithAppRole(); return updateEntityByName(selfServiceSupportToken, oidcEntityRequest); } OIDCUtil(); String fetchMountAccessorForOidc(String token); OIDCEntityResponse getEntityLookUpResponse(String authMountResponse); Response updateGroupPolicies(String token, String groupName, List<String> policies,
			List<String> currentPolicies, String id); Response deleteGroupByName(String token, String name); OIDCGroup getIdentityGroupDetails(String groupName, String token); String getSSOToken(); String getGroupObjectResponse(String ssoToken, String groupName); String updateIdentityGroupByName(String token, OIDCIdentityGroupRequest oidcIdentityGroupRequest); Response createGroupAlias(String token, GroupAliasRequest groupAliasRequest); ResponseEntity<OIDCEntityResponse> oidcFetchEntityDetails(String token, String username, UserDetails userDetails); ResponseEntity<OIDCEntityResponse> entityLookUp(String token,
			OIDCLookupEntityRequest oidcLookupEntityRequest); Response deleteGroupAliasByID(String token, String id); Response updateOIDCEntity(List<String> policies, String entityName); Response updateEntityByName(String token, OIDCEntityRequest oidcEntityRequest); void renewUserToken(String token); List<String> getPoliciedFromTokenLookUp(String authMountResponse); List<String> tokenLookUp(String token); Response createEntityAlias(String token, OidcEntityAliasRequest oidcEntityAliasRequest); String getUserName(String email); List<DirectoryGroup> getGroupsFromAAD(String ssoToken, String groupName); String getIdOfTheUser(String accessToken, String userEmail); List<String> getSelfServiceGroupsFromAADById(String accessToken, String userAADId, String userName); static final Logger log; }