Package org.apache.commons.httpclient.auth

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


        {
            return (NTCredentials) credentials;
        }
        catch (ClassCastException e)
        {
            throw new InvalidCredentialsException("Credentials cannot be used for NTLM authentication: "
                                                  + credentials.getClass().getName());
        }
    }
View Full Code Here


        } catch (GSSException gsse) {
            LOG.fatal(gsse.getMessage());
            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 )
View Full Code Here

        } catch (GSSException gsse) {
            LOG.fatal(gsse.getMessage());
            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 )
View Full Code Here

        } catch (GSSException gsse) {
            LOG.fatal(gsse.getMessage());
            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 )
View Full Code Here

        {
            return (NTCredentials) credentials;
        }
        catch (ClassCastException e)
        {
            throw new InvalidCredentialsException("Credentials cannot be used for NTLM authentication: "
                                                  + credentials.getClass().getName());
        }
    }
View Full Code Here

        try {
            SPNegoCredentials spnegoCredentials;
            try {
                spnegoCredentials = (SPNegoCredentials) credentials;
            } catch (ClassCastException e) {
                throw new InvalidCredentialsException(
                        "Credentials cannot be used for SPNego authentication: " + credentials.getClass().getName());
            }
            GSSContext gssContext = spnegoCredentials.getGSSContext();
            byte[] clientToken = gssContext.initSecContext(serverToken, 0, serverToken.length);
            if (gssContext.isEstablished()) {
                complete = true;
                LOGGER.log(Level.INFO, "GSS Context established");
                LOGGER.log(Level.INFO, "Caller is " + gssContext.getSrcName());
                LOGGER.log(Level.INFO, "Server is " + gssContext.getTargName());
                if (gssContext.getMutualAuthState()) {
                    LOGGER.log(Level.INFO, "Mutually authenticated");
                }
            }
            String encodedToken = new String(BASE64_CODEC.encode(clientToken));
            return new StringBuffer(TOKEN_PREFIX).append(' ').append(encodedToken).toString();
        } catch (GSSException e) {
            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);
View Full Code Here

                return gssManager.createContext(serviceName, mechanism.getOid(), clientCredential, GSSContext.DEFAULT_LIFETIME);
            } catch (GSSException e) {
                switch (e.getMajor()) {
                    case GSSException.BAD_NAME:
                    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:
View Full Code Here

        } catch (GSSException gsse) {
            LOG.fatal(gsse.getMessage());
            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 )
View Full Code Here

TOP

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

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.