Example usage for org.apache.http.client CredentialsProvider clear

List of usage examples for org.apache.http.client CredentialsProvider clear

Introduction

In this page you can find the example usage for org.apache.http.client CredentialsProvider clear.

Prototype

void clear();

Source Link

Document

Clears all credentials.

Usage

From source file:com.mpower.mintel.android.utilities.WebUtils.java

public static final void clearAllCredentials() {
    HttpContext localContext = MIntel.getInstance().getHttpContext();
    CredentialsProvider credsProvider = (CredentialsProvider) localContext
            .getAttribute(ClientContext.CREDS_PROVIDER);
    credsProvider.clear();
}

From source file:org.opendatakit.briefcase.util.WebUtils.java

public static final void clearAllCredentials(HttpContext localContext) {
    CredentialsProvider credsProvider = (CredentialsProvider) localContext
            .getAttribute(ClientContext.CREDS_PROVIDER);
    if (credsProvider != null) {
        credsProvider.clear();
    }//  www  .  java2 s.co m
}

From source file:com.mpower.daktar.android.utilities.WebUtils.java

public static final void clearAllCredentials() {
    final HttpContext localContext = MIntel.getInstance().getHttpContext();
    final CredentialsProvider credsProvider = (CredentialsProvider) localContext
            .getAttribute(ClientContext.CREDS_PROVIDER);
    credsProvider.clear();
}

From source file:org.opendatakit.dwc.server.GreetingServiceImpl.java

public static final void clearAllCredentials() {
    HttpContext localContext = getHttpContext();
    CredentialsProvider credsProvider = (CredentialsProvider) localContext
            .getAttribute(ClientContext.CREDS_PROVIDER);
    credsProvider.clear();
}

From source file:org.peterbaldwin.client.android.delicious.DeliciousApiRequestFactory.java

public void clearCredentials() {
    CredentialsProvider provider = mClient.getCredentialsProvider();
    provider.clear();
}

From source file:net.officefloor.plugin.web.http.security.integrate.MockHttpSecurityIntegrateTest.java

/**
 * Ensure can logout./*from  w ww. ja  v  a 2  s  .co m*/
 */
public void testLogout() throws Exception {

    // Authenticate with credentials
    CredentialsProvider provider = this.useCredentials("Test", null, "daniel", "daniel");
    this.doRequest("service", 200, "Serviced for daniel");

    // Clear login details
    provider.clear();

    // Request again to ensure stay logged in
    this.doRequest("service", 200, "Serviced for daniel");

    // Logout
    this.doRequest("logout", 200, "LOGOUT");

    // Should require to log in (after the log out)
    this.doRequest("service", 401, "");
}

From source file:net.officefloor.plugin.web.http.security.integrate.DigestHttpSecurityIntegrateTest.java

/**
 * Ensure can logout.//from   ww  w.  j a v  a 2 s  . c o  m
 */
public void testLogout() throws Exception {

    // Authenticate with credentials
    CredentialsProvider provider = this.useCredentials(REALM, "Digest", "daniel", "password");
    this.doRequest("service", 200, "Serviced for daniel");

    // Clear login details
    provider.clear();

    // Request again to ensure stay logged in
    this.doRequest("service", 200, "Serviced for daniel");

    // Logout
    this.doRequest("logout", 200, "LOGOUT");

    // Should require to log in (after the log out)
    this.doRequest("service", 401, "");
}

From source file:net.officefloor.plugin.web.http.security.integrate.BasicHttpSecurityIntegrateTest.java

/**
 * Ensure can logout./*from  w w w .  java 2 s  .  c o  m*/
 */
public void testLogout() throws Exception {

    // Authenticate with credentials
    CredentialsProvider provider = this.useCredentials("TestRealm", null, "daniel", "password");
    this.doRequest("service", 200, "Serviced for daniel");

    // Clear login details
    provider.clear();

    // Request again to ensure stay logged in
    this.doRequest("service", 200, "Serviced for daniel");

    // Logout
    this.doRequest("logout", 200, "LOGOUT");

    // Should require to log in (after the log out)
    this.doRequest("service", 401, "");
}

From source file:fr.ippon.wip.http.hc.HttpClientExecutor.java

/**
 * This method clears all credentials from the CredentialsProvider
 * associated to the current PortletSession and the windowID. The current
 * fr.ippon.wip.state.PortletWindow is also deleted.
 * //from   w ww . j a  v a2s.c  o m
 * @param portletRequest
 *            Used to get current javax.portlet.PortletSession and windowID
 */
public void logout(PortletRequest portletRequest) {
    HttpClientResourceManager resourceManager = HttpClientResourceManager.getInstance();
    CredentialsProvider credentialsProvider = resourceManager.getCredentialsProvider(portletRequest);

    // Clear credentials
    credentialsProvider.clear();

    // Clear state
    PortletWindow.clearInstance(portletRequest);
}