[SOLVED] Authentication token

Have a great idea for extending Zimbra? Share ideas, ask questions, contribute, and get feedback.
tsx
Posts: 16
Joined: Fri Sep 12, 2014 11:29 pm

[SOLVED] Authentication token

Postby tsx » Thu Aug 14, 2008 2:14 pm

What is the default timeout for the authentication token? How can I change that?
I'm trying a get all the data from few large mail boxes (~350k mails + ~40k attachments). I'm trying to reuse the authentication token but I'm getting "auth credentials have expired" message after some time.
I'm using SOAP in conjunction with Java.
-tsx


skenkin
Posts: 35
Joined: Fri Sep 12, 2014 11:33 pm

[SOLVED] Authentication token

Postby skenkin » Sat Aug 16, 2008 10:55 pm

Check this thread here
tsx
Posts: 16
Joined: Fri Sep 12, 2014 11:29 pm

[SOLVED] Authentication token

Postby tsx » Mon Aug 18, 2008 2:17 pm

Thanks Skenkin, but I couldn't find answer to my question. Am I missing something?
I'm using the SoapHttpTransport class. The authentication tokens for my admin transport as well as user transport are timing out. It appears the timeout seems to be 1 hour.
Here is the piece of code I'm using to authenticate


Element request = Element.XMLElement.mFactory

.createElement(AdminService.DELEGATE_AUTH_REQUEST);
Element account = request.addElement(AdminService.E_ACCOUNT);

account.addAttribute(AdminService.A_BY, "id");

account.setText(accountID);

Element response = myAdminHttpTransport.invoke(request);

String authToken = response.getElement(AdminService.E_AUTH_TOKEN)

.getText();

myUserHttpTransport.setAuthToken(authToken);
String sessionId = response.getAttribute(

ZimbraSoapContext.E_SESSION_ID, null);
if (sessionId != null) {

myUserHttpTransport.setSessionId(sessionId);

}

This code doesn't show it, but after authenticating once, I store the session id and authentication token in a pool that I reuse instead of authenticating every time.
How can I increase the timeout for these tokens?
skenkin
Posts: 35
Joined: Fri Sep 12, 2014 11:33 pm

[SOLVED] Authentication token

Postby skenkin » Mon Aug 18, 2008 4:56 pm

With the following code you can set the time the connection will be available:



DelegateAuthResponse dar = sp.delegateAuth(

Provisioning.AccountBy.name, userLogin, durationInSecond);

ZAuthToken authToken = dar.getAuthToken();

Options options = new Options(authToken, Z_ADMIN_URL);

ZMailbox zUserMailbox = new ZMailbox(options);

tsx
Posts: 16
Joined: Fri Sep 12, 2014 11:29 pm

[SOLVED] Authentication token

Postby tsx » Tue Aug 19, 2008 8:33 am

You are right. I figured it out yesterday. I added the "duration" attribute to my delegate authentication method and everything worked as expected.
I appreciate your help.
Thanks.

Return to “Developers”

Who is online

Users browsing this forum: No registered users and 0 guests