Package java.net

Examples of java.net.PasswordAuthentication


        /**
         * Sets a new user and password.
         */
        public synchronized void setPasswordAuthentication(String user, String password) {
            passwordAuthentication = new PasswordAuthentication(user, password.toCharArray());
        }
View Full Code Here


     */
    public PasswordAuthentication getPasswordAuthentication() {
        String player = "guest-" + random.nextInt(1000);
        setStatus("Logging in as " + player);
        String password = "guest";
        return new PasswordAuthentication(player, password.toCharArray());
    }
View Full Code Here

       
        protected abstract String getProtocolName();
        protected abstract ProtocolVersion getProtocolVersion();
       
        public PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication(username, password.toCharArray());
        }
View Full Code Here

         */
        public PasswordAuthentication getPasswordAuthentication() {
            // This is called to get the user name and authentication data (eg password)
            // to be authenticated server side.
            LoginParameters loginParams = getCurrentLogin().getLoginParameters();
            return new PasswordAuthentication(loginParams.getUserName(),
                                              loginParams.getPassword());
        }
View Full Code Here

                lock.wait();
            } catch(InterruptedException ie) { }
            if (!result)
                return null;

            return new PasswordAuthentication(userID, password);
        }
    }
View Full Code Here

    // API ******************************************************************

    // Overriding Authenticator *********************************************

    protected PasswordAuthentication getPasswordAuthentication() {
        PasswordAuthentication result = null;

        if (isProxyAuthentication()) {
            String proxyUser = System.getProperty("http.proxyUser");
            if ((proxyUser != null) && (proxyUser.trim().length() > 0)) {
                String proxyPass = System.getProperty("http.proxyPassword", "");
                Message.debug("authenicating to proxy server with username [" + proxyUser + "]");
                result = new PasswordAuthentication(proxyUser, proxyPass.toCharArray());
            }
        } else {
            Credentials c = CredentialsStore.INSTANCE.getCredentials(getRequestingPrompt(),
                getRequestingHost());
            Message.debug("authentication: k='"
                    + Credentials.buildKey(getRequestingPrompt(), getRequestingHost()) + "' c='"
                    + c + "'");
            if (c != null) {
                final String password = c.getPasswd() == null ? "" : c.getPasswd();
                result = new PasswordAuthentication(c.getUserName(), password.toCharArray());
            }
        }

        if ((result == null) && (original != null)) {
            Authenticator.setDefault(original);
View Full Code Here

     * @return a PasswordAuthentication instance to use for authenticating with
     * the proxy
     */
    protected PasswordAuthentication getPasswordAuthentication()
    {
        return new PasswordAuthentication(userName, password);
    }
View Full Code Here

        if (proxy != null && proxy.getProxyUser() != null) {
            Authenticator.setDefault(new Authenticator() {
                @Override
                protected PasswordAuthentication getPasswordAuthentication() {
                    return new PasswordAuthentication(proxy.getProxyUser(), proxy.getProxyPassword().toCharArray());
                }

            });
        }
View Full Code Here

        final String password = "password";

        Authenticator.setDefault(new Authenticator() {
            @Override
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(login, password.toCharArray());
            }
        });
    }
View Full Code Here

        final String password = "invalidpassword";

        Authenticator.setDefault(new Authenticator() {
            @Override
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(login, password.toCharArray());
            }
        });

        URL postUrl = new URL(SERVER_URL + "/");
        HttpURLConnection connection = (HttpURLConnection)postUrl.openConnection();
View Full Code Here

TOP

Related Classes of java.net.PasswordAuthentication

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.