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
[SOLVED] Authentication token
[SOLVED] Authentication token
Check this thread here
[SOLVED] Authentication token
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?
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?
[SOLVED] Authentication token
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);
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);
[SOLVED] Authentication token
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.
I appreciate your help.
Thanks.