Search in sources :

Example 21 with BasicUserPrincipal

use of org.apache.http.auth.BasicUserPrincipal in project knox by apache.

the class SecureClusterTest method getHttpClient.

private CloseableHttpClient getHttpClient() {
    CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
    credentialsProvider.setCredentials(AuthScope.ANY, new Credentials() {

        @Override
        public Principal getUserPrincipal() {
            return new BasicUserPrincipal("guest");
        }

        @Override
        public String getPassword() {
            return "guest-password";
        }
    });
    return HttpClients.custom().setDefaultCredentialsProvider(credentialsProvider).build();
}
Also used : BasicCredentialsProvider(org.apache.http.impl.client.BasicCredentialsProvider) BasicUserPrincipal(org.apache.http.auth.BasicUserPrincipal) BasicCredentialsProvider(org.apache.http.impl.client.BasicCredentialsProvider) CredentialsProvider(org.apache.http.client.CredentialsProvider) Credentials(org.apache.http.auth.Credentials) Principal(java.security.Principal) BasicUserPrincipal(org.apache.http.auth.BasicUserPrincipal)

Aggregations

BasicUserPrincipal (org.apache.http.auth.BasicUserPrincipal)21 Test (org.junit.jupiter.api.Test)12 Order (org.rembx.jeeshop.order.model.Order)6 TestOrder (org.rembx.jeeshop.order.test.TestOrder)6 Principal (java.security.Principal)4 HttpServletRequest (javax.servlet.http.HttpServletRequest)4 WebApplicationException (org.rembx.jeeshop.rest.WebApplicationException)3 User (org.rembx.jeeshop.user.model.User)3 TestUser (org.rembx.jeeshop.user.test.TestUser)3 HttpServletRequestWrapper (javax.servlet.http.HttpServletRequestWrapper)2 Address (org.rembx.jeeshop.user.model.Address)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 PublicKey (java.security.PublicKey)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 StringTokenizer (java.util.StringTokenizer)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 Callback (javax.security.auth.callback.Callback)1