Package com.sun.jersey.api.client.filter

Examples of com.sun.jersey.api.client.filter.HTTPBasicAuthFilter


    if ( username == null || password == null ) {
      return null;
    }

    return new HTTPBasicAuthFilter( username, password );
  }
View Full Code Here


    ClientFilter[] filters;
    @Nullable String username = getUsername();
    @Nullable String password = getPassword();
    if ( username != null && password != null ) {
      filters = new ClientFilter[]{new HTTPBasicAuthFilter( username, password )};
    }else{
      filters = new ClientFilter[0];
    }

    return new CouchDatabase( uri, dbName, filters );
View Full Code Here

     */
    private WebResource.Builder prepareClient(String additionalResourceUrl)
    {
      final Client client = Client.create();
        if (configuration.isAuthorisation()) {
            client.addFilter(new HTTPBasicAuthFilter(
                           configuration.getAdminUser(),
                           configuration.getAdminPassword()));
        }
        client.addFilter(new CsrfProtectionFilter());
        return client.resource(this.adminBaseUrl + additionalResourceUrl).accept(MediaType.APPLICATION_XML_TYPE).header("X-GlassFish-3", "ignore");
View Full Code Here

  }

  public void before() throws IOException, URISyntaxException, CouchDbException {
    client = ApacheHttpClient4.create();

    @Nullable HTTPBasicAuthFilter authFilter = getAuthFilter( );
    if ( authFilter != null ) {
      assert client != null;
      client.addFilter( authFilter );
    }
View Full Code Here

    if ( username == null || password == null ) {
      throw new IllegalStateException( "You need both password *and* user name" );
    }

    return new HTTPBasicAuthFilter( username, password );
  }
View Full Code Here

    assert client != null;

    @Nullable String username = getUsername();
    @Nullable String password = getPassword();
    if ( username != null && password != null ) {
      client.addFilter( new HTTPBasicAuthFilter( username, password ) );
    }

    return CouchDatabase.create( client, uri, dbName );
  }
View Full Code Here

     * @param password The password.
     * @return The authentication token.
     */
    public String login(String username, String password) {
        WebResource resource = client.getClient().resource(client.uriBuilder("/login").build());
        resource.addFilter(new HTTPBasicAuthFilter(username, password));
        ClientResponse response = resource.get(ClientResponse.class);
        response.close();
        return client.getAuthToken();
    }
View Full Code Here

  }

  public void before() throws IOException, URISyntaxException, CouchDbException {
    client = ApacheHttpClient4.create();

    @Nullable HTTPBasicAuthFilter authFilter = getAuthFilter( );
    if ( authFilter != null ) {
      assert client != null;
      client.addFilter( authFilter );
    }
View Full Code Here

    if ( username == null || password == null ) {
      throw new IllegalStateException( "You need both password *and* user name" );
    }

    return new HTTPBasicAuthFilter( username, password );
  }
View Full Code Here

    assert client != null;

    @Nullable String username = getUsername();
    @Nullable String password = getPassword();
    if ( username != null && password != null ) {
      client.addFilter( new HTTPBasicAuthFilter( username, password ) );
    }

    return CouchDatabase.create( client, uri, dbName );
  }
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.client.filter.HTTPBasicAuthFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.