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

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


    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


        // Make REST Request

        Client client2 = Client.create();
        RestUtil.initialize(client2);
        WebResource webResource = client2.resource(restURL);
        webResource.addFilter(new HTTPBasicAuthFilter(username, password));
        MultivaluedMap payLoad = new MultivaluedMapImpl();
        payLoad.putSingle("remoteHostName", request.getRemoteHost());

        ClientResponse resp = webResource.accept(RESPONSE_TYPE).post(ClientResponse.class, payLoad);
        RestResponse restResp = RestResponse.getRestResponse(resp);
View Full Code Here

        String password = Preconditions.checkNotNull(users.get(userName), "Realm user not found: " + userName);

        ClientFilter filter;
        if ( type.equals("basic") )
        {
            filter = new HTTPBasicAuthFilter(userName, password);
        }
        else if ( type.equals("digest") )
        {
            filter = new HTTPDigestAuthFilter(userName, password);
        }
View Full Code Here

     */
    public SCAPEDataConnectorClient(final String endpoint, final String user, final String password){
        ClientConfig cc = new DefaultClientConfig();

        this.client = Client.create(cc);
        this.client.addFilter(new HTTPBasicAuthFilter(user, password));
        this.endpoint = this.client.resource(endpoint);
    }
View Full Code Here

     * @param password
     */
    public SCAPEPlanManagementClient(final String endpoint, final String user, final String password) {
        ClientConfig cc = new DefaultClientConfig();
        this.client = Client.create(cc);
        this.client.addFilter(new HTTPBasicAuthFilter(user, password));
        this.endpoint = this.client.resource(endpoint);
    }
View Full Code Here

           
        final ClientConfig cc = new DefaultClientConfig();
        cc.getClasses().add(JacksonJsonProvider.class);
        final Client clientWithJacksonSerializer = Client.create(cc);
        clientWithJacksonSerializer.addFilter(new LoggingFilter());
        clientWithJacksonSerializer.addFilter(new HTTPBasicAuthFilter(watchUser, watchPassword));
        WebResource resource = clientWithJacksonSerializer.resource(watchEndpoint);

        final AsyncRequest areq = new AsyncRequest("monitor plan: " + plan.getPlanProperties().getName(), triggers);
        final AsyncRequest areq2 = resource.path(KBUtils.ASYNC_REQUEST + ".json/new").accept(MediaType.APPLICATION_JSON)
                .post(AsyncRequest.class, areq);
View Full Code Here

     */
    @Test
    public void addNotificationTest() throws Exception {
        ClientConfig cc = new DefaultClientConfig();
        Client client = Client.create(cc);
        client.addFilter(new HTTPBasicAuthFilter("scout", "pass"));
        WebResource endpoint = client.resource("http://localhost:8080/plato/rest/");

        // prepare the json load
        WatchNotification n = new WatchNotification(null, "test message", null, null, "scape.pw@gmail.com");
        StringWriter writer = new StringWriter();
View Full Code Here

    public AuthorisedResourceFactory(String accessToken) {
        oauthTokenFilter = new OAuth2BearerTokenFilter(accessToken);
    }

    public AuthorisedResourceFactory(String username, String password) {
        apiKeyFilter = new HTTPBasicAuthFilter(username, password);
    }
View Full Code Here

  public void createServer() throws URISyntaxException {
    URI currentUri = getServerUri();
    serverURI = currentUri;

    @Nullable HTTPBasicAuthFilter authFilter = getAuthFilter( );
    this.server = new CouchServer( currentUri, authFilter );
  }
View Full Code Here

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

    return new HTTPBasicAuthFilter( username, password );
  }
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.