@Test public void test_renewUserToken_success() throws Exception { String token = "4EpPYDSfgN2D4Gf7UmNO3nuL"; String responseJson = "{\"client_token\": \"18oVRlB3ft88S6U9raoEDnKn\",\"policies\": [\"safeadmin\"],\"lease_duration\": 1800000}"; Response response = getMockResponse(HttpStatus.OK, true, responseJson); when(reqProcessor.process("/auth/tvault/renew", "{}", token)).thenReturn(response); oidcUtil.renewUserToken(token); assertTrue(true); }
public void renewUserToken(String token) { Response renewResponse = reqProcessor.process("/auth/tvault/renew", "{}", token); if (HttpStatus.OK.equals(renewResponse.getHttpstatus())) { log.info(JSONUtil.getJSON(ImmutableMap.<String, String>builder(). put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER)). put(LogMessage.ACTION, "Add Group to SDB"). put(LogMessage.MESSAGE, "Successfully renewd user token after group policy update"). put(LogMessage.STATUS, (null != renewResponse) ? renewResponse.getHttpstatus().toString() : TVaultConstants.EMPTY). put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)). build())); } else { log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder(). put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER)). put(LogMessage.ACTION, "Add Group to SDB"). put(LogMessage.MESSAGE, "Reverting user policy update failed"). put(LogMessage.STATUS, (null != renewResponse) ? renewResponse.getHttpstatus().toString() : TVaultConstants.EMPTY). put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)). build())); } }
OIDCUtil { public void renewUserToken(String token) { Response renewResponse = reqProcessor.process("/auth/tvault/renew", "{}", token); if (HttpStatus.OK.equals(renewResponse.getHttpstatus())) { log.info(JSONUtil.getJSON(ImmutableMap.<String, String>builder(). put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER)). put(LogMessage.ACTION, "Add Group to SDB"). put(LogMessage.MESSAGE, "Successfully renewd user token after group policy update"). put(LogMessage.STATUS, (null != renewResponse) ? renewResponse.getHttpstatus().toString() : TVaultConstants.EMPTY). put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)). build())); } else { log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder(). put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER)). put(LogMessage.ACTION, "Add Group to SDB"). put(LogMessage.MESSAGE, "Reverting user policy update failed"). put(LogMessage.STATUS, (null != renewResponse) ? renewResponse.getHttpstatus().toString() : TVaultConstants.EMPTY). put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)). build())); } } }
OIDCUtil { public void renewUserToken(String token) { Response renewResponse = reqProcessor.process("/auth/tvault/renew", "{}", token); if (HttpStatus.OK.equals(renewResponse.getHttpstatus())) { log.info(JSONUtil.getJSON(ImmutableMap.<String, String>builder(). put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER)). put(LogMessage.ACTION, "Add Group to SDB"). put(LogMessage.MESSAGE, "Successfully renewd user token after group policy update"). put(LogMessage.STATUS, (null != renewResponse) ? renewResponse.getHttpstatus().toString() : TVaultConstants.EMPTY). put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)). build())); } else { log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder(). put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER)). put(LogMessage.ACTION, "Add Group to SDB"). put(LogMessage.MESSAGE, "Reverting user policy update failed"). put(LogMessage.STATUS, (null != renewResponse) ? renewResponse.getHttpstatus().toString() : TVaultConstants.EMPTY). put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)). build())); } } OIDCUtil(); }
OIDCUtil { public void renewUserToken(String token) { Response renewResponse = reqProcessor.process("/auth/tvault/renew", "{}", token); if (HttpStatus.OK.equals(renewResponse.getHttpstatus())) { log.info(JSONUtil.getJSON(ImmutableMap.<String, String>builder(). put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER)). put(LogMessage.ACTION, "Add Group to SDB"). put(LogMessage.MESSAGE, "Successfully renewd user token after group policy update"). put(LogMessage.STATUS, (null != renewResponse) ? renewResponse.getHttpstatus().toString() : TVaultConstants.EMPTY). put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)). build())); } else { log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder(). put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER)). put(LogMessage.ACTION, "Add Group to SDB"). put(LogMessage.MESSAGE, "Reverting user policy update failed"). put(LogMessage.STATUS, (null != renewResponse) ? renewResponse.getHttpstatus().toString() : TVaultConstants.EMPTY). put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)). build())); } } 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 void renewUserToken(String token) { Response renewResponse = reqProcessor.process("/auth/tvault/renew", "{}", token); if (HttpStatus.OK.equals(renewResponse.getHttpstatus())) { log.info(JSONUtil.getJSON(ImmutableMap.<String, String>builder(). put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER)). put(LogMessage.ACTION, "Add Group to SDB"). put(LogMessage.MESSAGE, "Successfully renewd user token after group policy update"). put(LogMessage.STATUS, (null != renewResponse) ? renewResponse.getHttpstatus().toString() : TVaultConstants.EMPTY). put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)). build())); } else { log.error(JSONUtil.getJSON(ImmutableMap.<String, String>builder(). put(LogMessage.USER, ThreadLocalContext.getCurrentMap().get(LogMessage.USER)). put(LogMessage.ACTION, "Add Group to SDB"). put(LogMessage.MESSAGE, "Reverting user policy update failed"). put(LogMessage.STATUS, (null != renewResponse) ? renewResponse.getHttpstatus().toString() : TVaultConstants.EMPTY). put(LogMessage.APIURL, ThreadLocalContext.getCurrentMap().get(LogMessage.APIURL)). build())); } } 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; }