[SOLVED] Delegate Auth Request using pre auth

Have a great idea for extending Zimbra? Share ideas, ask questions, contribute, and get feedback.
Post Reply
palikero
Posts: 5
Joined: Fri Sep 12, 2014 11:31 pm

[SOLVED] Delegate Auth Request using pre auth

Post by palikero »

I am trying to migrate accounts from one mail system to another using the Zimbra soap API. It is very quick to generate new accounts this way. However it is slow to generate the contacts that go along with these accounts. Right now I have to do an authRequest as the admin and then do a delegate auth request for the account I want to create the contact for and then do a createcontactrequest to make a new contact. So for each contact I have I have to do three requests. Not very fast when the average account I am trying to migrate has over 40 contacts and I am trying to migrate close to 5700 accounts for one of my domains. I would like to just authenticate as an admin and then do a delegateAuthentication as the user I want to make the contacts for and then just spin off all the contacts for that user. The only way I can see to do this is to use the pre auth key somehow but, I am not sure how. If anyone knows how to tackle this problem it will be much appreciated. Thank you
palikero
Posts: 5
Joined: Fri Sep 12, 2014 11:31 pm

[SOLVED] Delegate Auth Request using pre auth

Post by palikero »

Anyone?????
palikero
Posts: 5
Joined: Fri Sep 12, 2014 11:31 pm

[SOLVED] Delegate Auth Request using pre auth

Post by palikero »

Nevermind I figured it out.
jporter
Posts: 1
Joined: Sat Sep 13, 2014 12:12 am

[SOLVED] Delegate Auth Request using pre auth

Post by jporter »

Could you please explain how you figured this out or share your implementation. I'm sure you are/were in the same position I am in with useless zimbra docs.
undertoe
Advanced member
Advanced member
Posts: 94
Joined: Fri Sep 12, 2014 10:12 pm

Re: [SOLVED] Delegate Auth Request using pre auth

Post by undertoe »

I would be interested to see how you solved this too :)
undertoe
Advanced member
Advanced member
Posts: 94
Joined: Fri Sep 12, 2014 10:12 pm

Re: [SOLVED] Delegate Auth Request using pre auth

Post by undertoe »

Ended up figuring it out, here is the solution. But you need to generate a preauth token on your zimbra server
https://wiki.zimbra.com/wiki/Preauth

Code: Select all

$account = new AccountSelector(AccountBy::NAME(), 'test@domain.com');
$preAuth = new PreAuth(time() * 1000, null, 0);
$preAuth->computeValue($account, INSERT_GENERATE_PREAUTH_TOKEN_HERE );
$api = MailFactory::instance('https://domain.com/service/soap');
$result = $api->auth($account, null, $preAuth);
Post Reply