Search in sources :

Example 6 with EndSessionRequest

use of com.zimbra.soap.account.message.EndSessionRequest in project zm-mailbox by Zimbra.

the class ZMailbox method logout.

public void logout() throws ZClientException {
    if (mAuthToken == null) {
        return;
    }
    EndSessionRequest logout = new EndSessionRequest();
    logout.setLogOff(true);
    try {
        invokeJaxb(logout);
    } catch (ServiceException e) {
        // do not thrown an exception if the authtoken has already expired as when user us redirected to logout tag when authtoken expires.
        if (!ServiceException.AUTH_EXPIRED.equals(e.getCode())) {
            throw ZClientException.CLIENT_ERROR("Failed to log out", e);
        }
    }
}
Also used : ServiceException(com.zimbra.common.service.ServiceException) RemoteServiceException(com.zimbra.common.service.RemoteServiceException) EndSessionRequest(com.zimbra.soap.account.message.EndSessionRequest)

Aggregations

EndSessionRequest (com.zimbra.soap.account.message.EndSessionRequest)6 Account (com.zimbra.cs.account.Account)4 ZMailbox (com.zimbra.client.ZMailbox)3 URI (java.net.URI)3 Test (org.junit.Test)3 ServiceException (com.zimbra.common.service.ServiceException)2 Element (com.zimbra.common.soap.Element)2 HttpResponse (org.apache.http.HttpResponse)2 HttpClient (org.apache.http.client.HttpClient)2 HttpGet (org.apache.http.client.methods.HttpGet)2 HttpClientContext (org.apache.http.client.protocol.HttpClientContext)2 Cookie (org.apache.http.cookie.Cookie)2 BasicCookieStore (org.apache.http.impl.client.BasicCookieStore)2 HttpClientBuilder (org.apache.http.impl.client.HttpClientBuilder)2 BasicClientCookie (org.apache.http.impl.cookie.BasicClientCookie)2 ZAuthToken (com.zimbra.common.auth.ZAuthToken)1 RemoteServiceException (com.zimbra.common.service.RemoteServiceException)1 JSONElement (com.zimbra.common.soap.Element.JSONElement)1 XMLElement (com.zimbra.common.soap.Element.XMLElement)1 SoapFaultException (com.zimbra.common.soap.SoapFaultException)1