Examples of PasswordAuthentication


Examples of java.net.PasswordAuthentication

    URL requestURL = getRequestingURL();
    try {
      String uri = requestURL.toURI().normalize().toString();
      Site site = findBestMatch(uri);
      if (site != null) {
        return new PasswordAuthentication(site.login, site.pwd);
      }
    } catch (URISyntaxException e) {
      e.printStackTrace();
      return null;
    }
View Full Code Here

Examples of java.net.PasswordAuthentication

                }
            } catch (Exception e) {
                log.error("Failed to get proxy authentication details.");
                return null;
            }
            return new PasswordAuthentication(user, pass.toCharArray());
        }
View Full Code Here

Examples of java.net.PasswordAuthentication

            }
        } catch (Exception e) {
            log.error("Failed to get proxy authentication details.");
            return null;
        }
        return new PasswordAuthentication(user, pass.toCharArray());
    }
View Full Code Here

Examples of java.net.PasswordAuthentication

            {
                Authenticator.setDefault( new Authenticator()
                {
                    protected PasswordAuthentication getPasswordAuthentication()
                    {
                        return new PasswordAuthentication( proxyUserName, proxyPassword == null ? new char[0]
                            : proxyPassword.toCharArray() );
                    }
                } );
            }
        }
View Full Code Here

Examples of java.net.PasswordAuthentication

     */
    @Override
    protected PasswordAuthentication getPasswordAuthentication() {
        switch (getRequestorType()){
            case PROXY:
                return new PasswordAuthentication(userName, password);
            case SERVER:
                break;
            default:
                break;
        }
View Full Code Here

Examples of java.net.PasswordAuthentication

            }
        }
    }
   
    protected PasswordAuthentication getPasswordAuthentication() {
        PasswordAuthentication auth = null;
        Message m = PhaseInterceptorChain.getCurrentMessage();
        if (m != null) {
            Exchange exchange = m.getExchange();
            Conduit conduit = exchange.getConduit(m);
            if (conduit instanceof HTTPConduit) {
                HTTPConduit httpConduit = (HTTPConduit)conduit;
                if (getRequestorType() == RequestorType.PROXY
                    && httpConduit.getProxyAuthorization() != null) {
                    String un = httpConduit.getProxyAuthorization().getUserName();
                    String pwd =  httpConduit.getProxyAuthorization().getPassword();
                    if (un != null && pwd != null) {
                        auth = new PasswordAuthentication(un, pwd.toCharArray());
                    }
                } else if (getRequestorType() == RequestorType.SERVER
                    && httpConduit.getAuthorization() != null) {
                   
                    if ("basic".equals(getRequestingScheme()) || "digest".equals(getRequestingScheme())) {
                        return null;
                    }
                   
                    String un = httpConduit.getAuthorization().getUserName();
                    String pwd =  httpConduit.getAuthorization().getPassword();
                    if (un != null && pwd != null) {
                        auth = new PasswordAuthentication(un, pwd.toCharArray());
                    }
                }
            }
        }
        // else PhaseInterceptorChain.getCurrentMessage() is null,
View Full Code Here

Examples of java.net.PasswordAuthentication

            String password = "";
            if ( proxyInfo.getPassword() != null )
            {
                password = proxyInfo.getPassword();
            }
            return new PasswordAuthentication( proxyInfo.getUserName(), password.toCharArray() );
        }
        return null;
    }
View Full Code Here

Examples of java.net.PasswordAuthentication

            String password = "";
            if ( authenticationInfo.getPassword() != null )
            {
                password = authenticationInfo.getPassword();
            }
            return new PasswordAuthentication( authenticationInfo.getUserName(), password.toCharArray() );
        }
        return null;
    }
View Full Code Here

Examples of java.net.PasswordAuthentication

   
    public CXFPatchedAuthenticator() {
    }
   
    protected PasswordAuthentication getPasswordAuthentication() {
        PasswordAuthentication auth = null;
        Message m = PhaseInterceptorChain.getCurrentMessage();
        if (m != null) {
            Exchange exchange = m.getExchange();
            Conduit conduit = exchange.getConduit(m);
            if (conduit instanceof HTTPConduit) {
                HTTPConduit httpConduit = (HTTPConduit)conduit;
                if (getRequestorType() == RequestorType.PROXY
                    && httpConduit.getProxyAuthorization() != null) {
                    String un = httpConduit.getProxyAuthorization().getUserName();
                    String pwd =  httpConduit.getProxyAuthorization().getPassword();
                    if (un != null && pwd != null) {
                        auth = new PasswordAuthentication(un, pwd.toCharArray());
                    }
                } else if (getRequestorType() == RequestorType.SERVER
                    && httpConduit.getAuthorization() != null) {
                   
                    if ("basic".equals(getRequestingScheme())
View Full Code Here

Examples of java.net.PasswordAuthentication

    SocksSocketFactory(String socksHost, int socksPort, final String user, final String pass) {
        this.socksHost = socksHost;
        this.socksPort = socksPort;

        if (StringUtils.hasText(user)) {
            final PasswordAuthentication auth = new PasswordAuthentication(user, pass.toCharArray());

            Authenticator.setDefault(new Authenticator() {
                @Override
                protected PasswordAuthentication getPasswordAuthentication() {
                    return auth;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.