Search in sources :

Example 1 with DEFAULT_PASSWORD

use of fish.payara.samples.dynamic.roles.common.AuthoritiesConstants.DEFAULT_PASSWORD in project Payara by payara.

the class PersonControllerClientHelper method getPersonControllerClient.

public static PersonControllerClient getPersonControllerClient(URL deploymentUrl, String username, String password) {
    try {
        RestClientBuilder builder = RestClientBuilder.newBuilder();
        builder.register((ClientRequestFilter) context -> {
            context.getHeaders().add("username", DEFAULT_USER);
            context.getHeaders().add("password", DEFAULT_PASSWORD);
        });
        PersonControllerClient client = builder.baseUrl(new URL(deploymentUrl.toURI().toString() + "resources/")).build(PersonControllerClient.class);
        return client;
    } catch (URISyntaxException | MalformedURLException ex) {
        throw new IllegalStateException(ex);
    }
}
Also used : DEFAULT_PASSWORD(fish.payara.samples.dynamic.roles.common.AuthoritiesConstants.DEFAULT_PASSWORD) MalformedURLException(java.net.MalformedURLException) URL(java.net.URL) URISyntaxException(java.net.URISyntaxException) DEFAULT_USER(fish.payara.samples.dynamic.roles.common.AuthoritiesConstants.DEFAULT_USER) ClientRequestFilter(javax.ws.rs.client.ClientRequestFilter) RestClientBuilder(org.eclipse.microprofile.rest.client.RestClientBuilder) MalformedURLException(java.net.MalformedURLException) RestClientBuilder(org.eclipse.microprofile.rest.client.RestClientBuilder) URISyntaxException(java.net.URISyntaxException) URL(java.net.URL)

Aggregations

DEFAULT_PASSWORD (fish.payara.samples.dynamic.roles.common.AuthoritiesConstants.DEFAULT_PASSWORD)1 DEFAULT_USER (fish.payara.samples.dynamic.roles.common.AuthoritiesConstants.DEFAULT_USER)1 MalformedURLException (java.net.MalformedURLException)1 URISyntaxException (java.net.URISyntaxException)1 URL (java.net.URL)1 ClientRequestFilter (javax.ws.rs.client.ClientRequestFilter)1 RestClientBuilder (org.eclipse.microprofile.rest.client.RestClientBuilder)1