use of org.springframework.util.LinkedMultiValueMap in project cas by apereo.
the class GoogleAuthenticatorRestHttpRequestCredentialFactoryTests method verifyNoCredentials.
@Test
public void verifyNoCredentials() {
final GoogleAuthenticatorRestHttpRequestCredentialFactory f = new GoogleAuthenticatorRestHttpRequestCredentialFactory();
final LinkedMultiValueMap body = new LinkedMultiValueMap<>();
final List<Credential> results = f.fromRequestBody(body);
assertTrue(results.isEmpty());
}
use of org.springframework.util.LinkedMultiValueMap in project perry by ca-cwds.
the class LoginServiceImpl method invalidate.
@Override
public void invalidate(String perryToken) {
OAuth2AccessToken accessToken = tokenService.deleteToken(perryToken);
try {
HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
params.add("token", accessToken.getValue());
params.add("token_type_hint", "access_token");
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(params, headers);
restClientService.clientRestTemplate().postForEntity(revokeTokenUri, request, String.class).getBody();
} catch (Exception e) {
throw new PerryException("Token Revocation problem for revokeTokenUri = " + revokeTokenUri, e);
}
}
use of org.springframework.util.LinkedMultiValueMap in project CzechIdMng by bcvsolutions.
the class DefaultAuditServiceTest method createAndEditOneTransaction.
@Test
public void createAndEditOneTransaction() {
String username = "test_user_" + System.currentTimeMillis();
IdmIdentityDto newIdentity = getTransactionTemplate().execute(new TransactionCallback<IdmIdentityDto>() {
public IdmIdentityDto doInTransaction(TransactionStatus transactionStatus) {
IdmIdentityDto identity = new IdmIdentityDto();
identity.setUsername(username);
identity.setFirstName(username);
identity.setLastName(username);
identity = identityService.save(identity);
//
identity.setEmail("example@example.tld");
identity.setLastName(username + "edit");
return identityService.save(identity);
}
});
assertEquals(newIdentity.getUsername(), username);
MultiValueMap<String, Object> parameters = new LinkedMultiValueMap<>();
parameters.put("username", ImmutableList.of(username));
List<IdmAuditDto> audits = auditService.findEntityWithRelation(IdmIdentity.class, parameters, null).getContent();
assertEquals(2, audits.size());
//
String contractChangedAttribute = audits.get(0).getChangedAttributes();
assertTrue(contractChangedAttribute.contains("externe"));
assertTrue(contractChangedAttribute.contains("position"));
assertTrue(contractChangedAttribute.contains("identity"));
assertTrue(contractChangedAttribute.contains("disabled"));
assertTrue(contractChangedAttribute.contains("main"));
//
String identityChangedAttribute = audits.get(1).getChangedAttributes();
assertTrue(identityChangedAttribute.contains("state"));
assertTrue(identityChangedAttribute.contains("email"));
assertTrue(identityChangedAttribute.contains("lastName"));
}
use of org.springframework.util.LinkedMultiValueMap in project CzechIdMng by bcvsolutions.
the class DefaultAuditServiceTest method editAndDeleteOneTrasaction.
@Test
public void editAndDeleteOneTrasaction() {
String username = "test_user_" + System.currentTimeMillis();
IdmIdentityDto identity = new IdmIdentityDto();
identity.setUsername(username);
identity.setFirstName(username);
identity.setLastName(username);
identityService.save(identity);
IdmIdentityDto newIdentity = getTransactionTemplate().execute(new TransactionCallback<IdmIdentityDto>() {
public IdmIdentityDto doInTransaction(TransactionStatus transactionStatus) {
IdmIdentityDto identity = identityService.getByCode(username);
identity.setFirstName(username + "--edit");
identity = identityService.save(identity);
// hibernate send this as one query
//
identityService.delete(identity);
return null;
}
});
assertEquals(newIdentity, null);
MultiValueMap<String, Object> parameters = new LinkedMultiValueMap<>();
parameters.put("username", ImmutableList.of(username));
List<IdmAuditDto> audits = auditService.findEntityWithRelation(IdmIdentity.class, parameters, null).getContent();
// add idenity + contract -- delete identity + contract
assertEquals(4, audits.size());
}
use of org.springframework.util.LinkedMultiValueMap in project portal by ixinportal.
the class SelectSaveTest method test.
@Test
public void test() throws Exception {
String url = "http://124.205.224.179:9018/portal1/evidence/searchStored";
url = "https://ixin.itrus.com.cn/evidence/searchStored";
String appId = "561eef791b474f";
String evidenceSn = "yycsicz201710160947163906505";
LinkedMultiValueMap<String, Object> map = new LinkedMultiValueMap<String, Object>();
map.add("appId", appId);
map.add("evidenceSn", evidenceSn);
try {
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Signature", "HMAC-SHA1 " + Base64.encode(HMACSHA1.getHmacSHA1(appId + evidenceSn, "d283620085e04f868c72f21997b70234"), false));
System.out.println(Base64.encode(HMACSHA1.getHmacSHA1(appId + evidenceSn, "d283620085e04f868c72f21997b70234"), false));
HttpEntity httpEntity = new HttpEntity(map, headers);
ResponseEntity<String> resStr = restTemplate.exchange(url, HttpMethod.POST, httpEntity, String.class);
System.out.println("statusCode:" + resStr.getStatusCode());
System.out.println("body:" + resStr.getBody());
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations