Search in sources :

Example 6 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)6 Principal (java.security.Principal)4 HttpServletRequest (javax.servlet.http.HttpServletRequest)4 HttpServletRequestWrapper (javax.servlet.http.HttpServletRequestWrapper)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 PublicKey (java.security.PublicKey)1 HashMap (java.util.HashMap)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 NameCallback (javax.security.auth.callback.NameCallback)1 PasswordCallback (javax.security.auth.callback.PasswordCallback)1 LoginException (javax.security.auth.login.LoginException)1 FilterChain (javax.servlet.FilterChain)1 ServletRequest (javax.servlet.ServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 Header (org.apache.http.Header)1 Credentials (org.apache.http.auth.Credentials)1 CredentialsProvider (org.apache.http.client.CredentialsProvider)1