Package org.apache.commons.httpclient.auth

Examples of org.apache.commons.httpclient.auth.CredentialsNotAvailableException


                if (pwDialog.getUser().length() > 0) {
                    credentials = new UsernamePasswordCredentials(pwDialog.getUser(), pwDialog.getPassword());
                }
                pwDialog.dispose();
            } else {
                throw new CredentialsNotAvailableException("Unsupported authentication scheme: " +
                    authscheme.getSchemeName());
            }
            return credentials;
        } catch (IOException e) {
            throw new CredentialsNotAvailableException(e.getMessage(), e);
        }
    }  
View Full Code Here


                if (pwDialog.getUser().length() > 0) {
                    credentials = new UsernamePasswordCredentials(pwDialog.getUser(), pwDialog.getPassword());
                }
                pwDialog.dispose();
            } else {
                throw new CredentialsNotAvailableException("Unsupported authentication scheme: " +
                    authscheme.getSchemeName());
            }
            return credentials;
        } catch (IOException e) {
            throw new CredentialsNotAvailableException(e.getMessage(), e);
        }
    }  
View Full Code Here

                System.out.print("Password: ");
                String password = inputReader.readLine();
                               
                credentials = new UsernamePasswordCredentials(username, password);
            } else {
                throw new CredentialsNotAvailableException("Unsupported authentication scheme: " +
                    authscheme.getSchemeName());
            }
            return credentials;
        } catch (IOException e) {
            throw new CredentialsNotAvailableException(e.getMessage(), e);
        }
    }          
View Full Code Here

            state = FAILED;
            if( gsse.getMajor() == GSSException.DEFECTIVE_CREDENTIAL
                    || gsse.getMajor() == GSSException.CREDENTIALS_EXPIRED )
                throw new InvalidCredentialsException(gsse.getMessage(),gsse);
            if( gsse.getMajor() == GSSException.NO_CRED )
                throw new CredentialsNotAvailableException(gsse.getMessage(),gsse);
            if( gsse.getMajor() == GSSException.DEFECTIVE_TOKEN
                    || gsse.getMajor() == GSSException.DUPLICATE_TOKEN
                    || gsse.getMajor() == GSSException.OLD_TOKEN )
                throw new AuthChallengeException(gsse.getMessage(),gsse);
            // other error
View Full Code Here

                    String user = readConsole();  
                    System.out.print("Enter password: ");
                    String password = readConsole();
                    return new UsernamePasswordCredentials(user, password);   
                } else {
                    throw new CredentialsNotAvailableException("Unsupported authentication scheme: " +
                        authscheme.getSchemeName());
                }
            } catch (IOException e) {
                throw new CredentialsNotAvailableException(e.getMessage(), e);
            }
        }
View Full Code Here

            complete = true;
            switch (e.getMajor()) {
                case GSSException.CREDENTIALS_EXPIRED:
                    throw new InvalidCredentialsException(e.getMessage(), e);
                case GSSException.NO_CRED:
                    throw new CredentialsNotAvailableException(e.getMessage(), e);
                default:
                    String errorMessage = "Caught GSSException in GSSContext.initSecContext()";
                    LOGGER.log(Level.SEVERE, errorMessage, e);
                    throw new AuthenticationException(errorMessage, e);
            }
View Full Code Here

                    case GSSException.CREDENTIALS_EXPIRED:
                        throw new InvalidCredentialsException(e.getMessage(), e);
                    case GSSException.BAD_MECH:
                    case GSSException.BAD_NAMETYPE:
                    case GSSException.NO_CRED:
                        throw new CredentialsNotAvailableException(e.getMessage(), e);
                    case GSSException.FAILURE:
                    default:
                        throw e;
                }
            }
View Full Code Here

                response = JOptionPane.showConfirmDialog(null, msg, "Authenticate",
                        JOptionPane.OK_CANCEL_OPTION);

                if ((response == JOptionPane.CANCEL_OPTION) ||
                        (response == JOptionPane.CLOSED_OPTION)) {
                    throw new CredentialsNotAvailableException("User cancled windows authentication.");
                }

                return new NTCredentials(userField.getText(), new String(passwordField.getPassword()),
                        host, domainField.getText());


            } else if (scheme instanceof RFC2617Scheme) {
                Object[] msg = {
                    host + ":" + port + " requires authentication with the realm '" +
                    scheme.getRealm() + "'",
                    "User Name",
                    userField,
                    "Password",
                    passwordField
                };

                response = JOptionPane.showConfirmDialog(null, msg, "Authenticate",
                        JOptionPane.OK_CANCEL_OPTION);

                if ((response == JOptionPane.CANCEL_OPTION) ||
                        (response == JOptionPane.CLOSED_OPTION)) {
                    throw new CredentialsNotAvailableException("User cancled windows authentication.");
                }


                return new UsernamePasswordCredentials(userField.getText(),
                        new String(passwordField.getPassword()));

            } else {

                throw new CredentialsNotAvailableException("Unsupported authentication scheme: " +
                        scheme.getSchemeName());

            }
        } catch (IOException ioe) {

            throw new CredentialsNotAvailableException(ioe.getMessage(), ioe);

        }
    }
View Full Code Here

            state = FAILED;
            if( gsse.getMajor() == GSSException.DEFECTIVE_CREDENTIAL
                    || gsse.getMajor() == GSSException.CREDENTIALS_EXPIRED )
                throw new InvalidCredentialsException(gsse.getMessage(),gsse);
            if( gsse.getMajor() == GSSException.NO_CRED )
                throw new CredentialsNotAvailableException(gsse.getMessage(),gsse);
            if( gsse.getMajor() == GSSException.DEFECTIVE_TOKEN
                    || gsse.getMajor() == GSSException.DUPLICATE_TOKEN
                    || gsse.getMajor() == GSSException.OLD_TOKEN )
                throw new AuthChallengeException(gsse.getMessage(),gsse);
            // other error
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.auth.CredentialsNotAvailableException

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.