use of org.orcid.pojo.ajaxForm.SSOCredentials in project ORCID-Source by ORCID.
the class DeveloperToolsControllerTest method testCrossSiteScriptingOnClientDescription.
@Test
@Transactional("transactionManager")
public void testCrossSiteScriptingOnClientDescription() throws Exception {
SSOCredentials ssoCredentials = new SSOCredentials();
ssoCredentials.setClientName(Text.valueOf("Client Name"));
ssoCredentials.setClientDescription(Text.valueOf("This is a test to show that html is <script>alert('name')</script> throws an error"));
ssoCredentials.setClientWebsite(Text.valueOf("http://client.com"));
Set<RedirectUri> redirectUris = new HashSet<RedirectUri>();
RedirectUri rUri = new RedirectUri();
rUri.setType(Text.valueOf("default"));
rUri.setValue(Text.valueOf("http://test.com"));
redirectUris.add(rUri);
ssoCredentials.setRedirectUris(redirectUris);
SSOCredentials result = developerToolsController.generateSSOCredentialsJson(ssoCredentials);
assertNotNull(result);
assertEquals(1, result.getErrors().size());
assertEquals(developerToolsController.getMessage("manage.developer_tools.description.html"), result.getErrors().get(0));
}
use of org.orcid.pojo.ajaxForm.SSOCredentials in project ORCID-Source by ORCID.
the class DeveloperToolsControllerTest method testCrossSiteScriptingOnClientName.
@Test
@Transactional("transactionManager")
public void testCrossSiteScriptingOnClientName() throws Exception {
SSOCredentials ssoCredentials = new SSOCredentials();
ssoCredentials.setClientName(Text.valueOf("<script>alert('name')</script>"));
ssoCredentials.setClientDescription(Text.valueOf("This is a short description"));
ssoCredentials.setClientWebsite(Text.valueOf("http://client.com"));
Set<RedirectUri> redirectUris = new HashSet<RedirectUri>();
RedirectUri rUri = new RedirectUri();
rUri.setType(Text.valueOf("default"));
rUri.setValue(Text.valueOf("http://test.com"));
redirectUris.add(rUri);
ssoCredentials.setRedirectUris(redirectUris);
SSOCredentials result = developerToolsController.generateSSOCredentialsJson(ssoCredentials);
assertNotNull(result);
assertEquals(1, result.getErrors().size());
assertEquals(developerToolsController.getMessage("manage.developer_tools.name.html"), result.getErrors().get(0));
}
use of org.orcid.pojo.ajaxForm.SSOCredentials in project ORCID-Source by ORCID.
the class DeveloperToolsController method getEmptySSOCredentials.
@RequestMapping(value = "/get-empty-sso-credential.json", method = RequestMethod.GET)
@ResponseBody
public SSOCredentials getEmptySSOCredentials(HttpServletRequest request) {
SSOCredentials emptyObject = new SSOCredentials();
emptyObject.setClientSecret(Text.valueOf(StringUtils.EMPTY));
RedirectUri redirectUri = new RedirectUri();
redirectUri.setValue(new Text());
redirectUri.setType(Text.valueOf(RedirectUriType.DEFAULT.name()));
Set<RedirectUri> set = new HashSet<RedirectUri>();
set.add(redirectUri);
emptyObject.setRedirectUris(set);
return emptyObject;
}
Aggregations