use of com.zimbra.soap.account.message.GetInfoRequest in project zm-mailbox by Zimbra.
the class ModifyProfileImageTest method testZCS3545.
@Test
public void testZCS3545() throws Exception {
Account acct = Provisioning.getInstance().getAccountByName("testZCS3545@zimbra.com");
InputStream is = getClass().getResourceAsStream("img.jpg");
FileUploadServlet.Upload up = FileUploadServlet.saveUpload(is, "img.jpg", "image/jpeg", acct.getId());
PowerMockito.stub(PowerMockito.method(MimeDetect.class, "detect", InputStream.class)).toReturn("image/jpeg");
byte[] bytes = IOUtils.toByteArray(up.getInputStream());
PowerMockito.stub(PowerMockito.method(NativeFormatter.class, "getResizedImageData", InputStream.class, String.class, String.class, Integer.class, Integer.class)).toReturn(bytes);
ModifyProfileImageRequest requestJaxb = new ModifyProfileImageRequest();
requestJaxb.setUploadId(up.getId());
Element request = JaxbUtil.jaxbToElement(requestJaxb);
Element response = new ModifyProfileImage().handle(request, ServiceTestUtil.getRequestContext(acct));
ModifyProfileImageResponse responseJaxb = JaxbUtil.elementToJaxb(response);
int profileItemId = responseJaxb.getItemId();
GetInfoRequest getRequestJaxb = new GetInfoRequest();
getRequestJaxb.setSections("mbox");
Element getRequest = JaxbUtil.jaxbToElement(getRequestJaxb);
Element getResponse = new GetInfo().handle(getRequest, ServiceTestUtil.getRequestContext(acct));
GetInfoResponse getResponseJaxb = JaxbUtil.elementToJaxb(getResponse);
Assert.assertEquals(profileItemId, getResponseJaxb.getProfileImageId());
Map<String, Object> attrMap = acct.getAttrs(false, false);
String ldapThumbnailImageData = "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RD84QzQ5OjcBCgoKDQwNGg8PGjclHyU3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3N//AABEIAHQAuQMBEQACEQEDEQH/xAAbAAAC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wGWDyY035Rsp0/wBRLeYwWAmzQgCCzA8BnaijYTN4Ts55wopvWZsmZaiWrwZdk0HWAveSy4jNwioouJcvrMXFgpoaLVi1ZWyBaxcQ1YnJCHdTNEmZNiyfaUkSxbDMZLFspHlLTJaBAgFFnT43CZzNIG1pFXbOLI2ehiSLRcKJilZs5JCn1YA4MtYzN5Spbqye02jjMZ5RKF7W85bpGa2kzR0un9ZzTmdePHZo1VKB2nNKTO2MEeY+M9ONDr+mdbr+nwbPCtP9pyRn9x+ZcJNxf4LUVdfJ6es1vWrpgqw3A+0h3ZOqQF23EqNmc6MfWbdxnbjujgyVZRcLjymysw6KtmM8TVEMRY2BxLSJFbz6yqQWOVmxJpGY1Hb1ktIabGfV7yeiiQhMLFVjUozIci1Eaulk+oV6YL6X2gsgnjEPpsTRTM3AitCjwk7Qors1dK+FnLNHbjlRN9hxFGI5yKbNkzdI57JrTMTZUUXaVCzCTbOiKSL1LgTCSOmEqLAtxM3E2Uyh1/TjqXRtXpf6nrOw+jDkfuJWNVIbyGV8H9VbVdApFh+un+Gc+nl+0v0+yc89WaN2r47zWOM45ZTJ1WoyTzOrHA5ZztlFrzN1Ax2YBt9ZWorE22S4oLE+KPWXqBpIoxOYvVDkUSWwocAJDKodWokNlpIs1qMTJtmqihwUSbKpAsB6RoTFOi+kpMlxQgoN3aXZnqrGpwOJLNIi7ScRxJkV8zQxHVGRI0iWNxk0aodUx9ZlJGsWO3GRRdsg2MOxhQbM8d8Nk09U6xp6+K1uJA9PqP8AmdDX3v8A72Lzu8MWbVjH1miRwMpXHkzaJjIqvNUZijLARcSBKiNFTcfWaUXR/9k=";
Assert.assertEquals(ldapThumbnailImageData, attrMap.get(ZAttrProvisioning.A_thumbnailPhoto));
}
use of com.zimbra.soap.account.message.GetInfoRequest in project zm-mailbox by Zimbra.
the class ModifyProfileImageTest method testZCS3871.
@Test
public void testZCS3871() throws Exception {
Account acct = Provisioning.getInstance().getAccountByName("testZCS3871@zimbra.com");
InputStream is = getClass().getResourceAsStream("img.jpg");
FileUploadServlet.Upload up = FileUploadServlet.saveUpload(is, "img.jpg", "image/jpeg", acct.getId());
PowerMockito.stub(PowerMockito.method(MimeDetect.class, "detect", InputStream.class)).toReturn("image/jpeg");
byte[] bytes = IOUtils.toByteArray(up.getInputStream());
PowerMockito.stub(PowerMockito.method(NativeFormatter.class, "getResizedImageData", InputStream.class, String.class, String.class, Integer.class, Integer.class)).toReturn(bytes);
// Upload an profile image first
ModifyProfileImageRequest requestJaxb = new ModifyProfileImageRequest();
requestJaxb.setUploadId(up.getId());
Element request = JaxbUtil.jaxbToElement(requestJaxb);
Element response = new ModifyProfileImage().handle(request, ServiceTestUtil.getRequestContext(acct));
ModifyProfileImageResponse responseJaxb = JaxbUtil.elementToJaxb(response);
int profileItemId = responseJaxb.getItemId();
GetInfoRequest getRequestJaxb = new GetInfoRequest();
getRequestJaxb.setSections("mbox");
Element getRequest = JaxbUtil.jaxbToElement(getRequestJaxb);
Element getResponse = new GetInfo().handle(getRequest, ServiceTestUtil.getRequestContext(acct));
GetInfoResponse getResponseJaxb = JaxbUtil.elementToJaxb(getResponse);
Assert.assertEquals(profileItemId, getResponseJaxb.getProfileImageId());
Map<String, Object> attrMap = acct.getAttrs(false, false);
String ldapThumbnailImageData = "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RD84QzQ5OjcBCgoKDQwNGg8PGjclHyU3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3N//AABEIAHQAuQMBEQACEQEDEQH/xAAbAAACAwEBAQAAAAAAAAAAAAACAwEEBQAGB//EADIQAAICAQMCBAUCBgMBAAAAAAECAAMRBBIhBTETQVFhBhQicYGRoSMyQmLR4TNSwRb/xAAaAQADAQEBAQAAAAAAAAAAAAAAA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ZLFspHlLTJaBAgFFnT43CZzNIG1pFXbOLI2ehiSLRcKJilZs5JCn1YA4MtYzN5Spbqye02jjMZ5RKF7W85bpGa2kzR0un9ZzTmdePHZo1VKB2nNKTO2MEeY+M9ONDr+mdbr+nwbPCtP9pyRn9x+ZcJNxf4LUVdfJ6es1vWrpgqw3A+0h3ZOqQF23EqNmc6MfWbdxnbjujgyVZRcLjymysw6KtmM8TVEMRY2BxLSJFbz6yqQWOVmxJpGY1Hb1ktIabGfV7yeiiQhMLFVjUozIci1Eaulk+oV6YL6X2gsgnjEPpsTRTM3AitCjwk7Qors1dK+FnLNHbjlRN9hxFGI5yKbNkzdI57JrTMTZUUXaVCzCTbOiKSL1LgTCSOmEqLAtxM3E2Uyh1/TjqXRtXpf6nrOw+jDkfuJWNVIbyGV8H9VbVdApFh+un+Gc+nl+0v0+yc89WaN2r47zWOM45ZTJ1WoyTzOrHA5ZztlFrzN1Ax2YBt9ZWorE22S4oLE+KPWXqBpIoxOYvVDkUSWwocAJDKodWokNlpIs1qMTJtmqihwUSbKpAsB6RoTFOi+kpMlxQgoN3aXZnqrGpwOJLNIi7ScRxJkV8zQxHVGRI0iWNxk0aodUx9ZlJGsWO3GRRdsg2MOxhQbM8d8Nk09U6xp6+K1uJA9PqP8AmdDX3v8A72Lzu8MWbVjH1miRwMpXHkzaJjIqvNUZijLARcSBKiNFTcfWaUXR/9k=";
Assert.assertEquals(ldapThumbnailImageData, attrMap.get(ZAttrProvisioning.A_thumbnailPhoto));
// remove the uploaded image now
ModifyProfileImageRequest requestJaxb1 = new ModifyProfileImageRequest();
Element request1 = JaxbUtil.jaxbToElement(requestJaxb1);
new ModifyProfileImage().handle(request1, ServiceTestUtil.getRequestContext(acct));
GetInfoRequest getRequestJaxb1 = new GetInfoRequest();
getRequestJaxb1.setSections("mbox");
Element getRequest1 = JaxbUtil.jaxbToElement(getRequestJaxb1);
Element getResponse1 = new GetInfo().handle(getRequest1, ServiceTestUtil.getRequestContext(acct));
// check that the profile image information is not present in GetInfo as well as LDAP
Assert.assertEquals(false, getResponse1.prettyPrint().contains("profileImageId"));
Map<String, Object> attrMap1 = acct.getAttrs(false, false);
Assert.assertEquals(null, attrMap1.get(ZAttrProvisioning.A_thumbnailPhoto));
}
use of com.zimbra.soap.account.message.GetInfoRequest in project zm-mailbox by Zimbra.
the class TestCookieReuse method testForgedNonCSRFPost.
/**
* Verify that we CANNOT make an POST request with a non-CSRF-enabled auth token if the auth token
* has an associated CSRF token
*/
@Test
public void testForgedNonCSRFPost() throws Exception {
AuthToken at = AuthProvider.getAuthToken(TestUtil.getAccount(USER_NAME));
at.setCsrfTokenEnabled(false);
CsrfUtil.generateCsrfToken(at.getAccountId(), at.getExpires(), new Random().nextInt() + 1, at);
SoapHttpTransport transport = new SoapHttpTransport(TestUtil.getSoapUrl());
transport.setAuthToken(at.getEncoded());
GetInfoRequest request = new GetInfoRequest();
try {
transport.invoke(JaxbUtil.jaxbToElement(request));
} catch (ServiceException e) {
Assert.assertEquals("should be catching AUTH EXPIRED here", ServiceException.AUTH_REQUIRED, e.getCode());
return;
}
Assert.fail("should have caught an exception");
}
use of com.zimbra.soap.account.message.GetInfoRequest in project zm-mailbox by Zimbra.
the class TestGetInfo method discoverRights.
@Test
public void discoverRights() throws Exception {
Account acct = provUtil.createAccount(genAcctNameLocalPart(), domain);
Group group = provUtil.createGroup(genGroupNameLocalPart(), domain, false);
prov.grantRight(TargetType.domain.getCode(), TargetBy.name, domain.getName(), GranteeType.GT_USER.getCode(), GranteeBy.name, acct.getName(), null, User.R_createDistList.getName(), null);
prov.grantRight(TargetType.dl.getCode(), TargetBy.name, group.getName(), GranteeType.GT_USER.getCode(), GranteeBy.name, acct.getName(), null, User.R_sendToDistList.getName(), null);
SoapTransport transport = authUser(acct.getName());
GetInfoRequest req = new GetInfoRequest();
req.addRight(User.R_createDistList.getName());
req.addRight(User.R_sendToDistList.getName());
GetInfoResponse resp = invokeJaxb(transport, req);
List<DiscoverRightsInfo> rightsInfo = resp.getDiscoveredRights();
Set<String> result = Sets.newHashSet();
for (DiscoverRightsInfo rightInfo : rightsInfo) {
String right = rightInfo.getRight();
List<DiscoverRightsTarget> targets = rightInfo.getTargets();
for (DiscoverRightsTarget target : targets) {
String id = target.getId();
String name = target.getName();
String type = target.getType().toString();
result.add(Verify.makeResultStr(right, id, name, type));
}
}
Verify.verifyEquals(Sets.newHashSet(Verify.makeResultStr(User.R_createDistList.getName(), domain.getId(), domain.getName(), TargetType.domain.getCode()), Verify.makeResultStr(User.R_sendToDistList.getName(), group.getId(), group.getName(), TargetType.dl.getCode())), result);
}
use of com.zimbra.soap.account.message.GetInfoRequest in project zm-mailbox by Zimbra.
the class TestAuth method accountStatusMaintenanceAfterAuth.
@Test
public void accountStatusMaintenanceAfterAuth() throws Exception {
Account acct = provUtil.createAccount(genAcctNameLocalPart(), domain);
SoapTransport transport = authUser(acct.getName());
/*
* change account status to maintenance
*/
prov.modifyAccountStatus(acct, AccountStatus.maintenance.name());
GetInfoRequest req = new GetInfoRequest();
String errorCode = null;
try {
GetInfoResponse resp = invokeJaxb(transport, req);
} catch (SoapFaultException e) {
errorCode = e.getCode();
}
assertEquals(AccountServiceException.AUTH_EXPIRED, errorCode);
provUtil.deleteAccount(acct);
}
Aggregations