Package javax.security.auth.login

Examples of javax.security.auth.login.FailedLoginException


            for (String role : roles) {
                groups.add(role);
            }
        } catch (CommunicationException e) {
            close(context);
            throw (LoginException) new FailedLoginException().initCause(e);
        } catch (NamingException e) {
            close(context);
            throw (LoginException) new FailedLoginException().initCause(e);
        }


        return true;
    }
View Full Code Here


        context.addToEnvironment(Context.SECURITY_CREDENTIALS, password);
        try {
            context.getAttributes("", null);
        } catch (AuthenticationException e) {
            log.debug("Authentication failed for dn=" + dn);
            throw new FailedLoginException();
        } finally {

            if (connectionUsername != null) {
                context.addToEnvironment(Context.SECURITY_PRINCIPAL,
                        connectionUsername);
View Full Code Here

        username = ((NameCallback) callbacks[0]).getName();
        if (username == null || username.equals("")) {
            // Clear out the private state
            username = null;
            password = null;
            throw new FailedLoginException();
        }
        String realPassword = users.getProperty(username);
        // Decrypt the password if needed, so we can compare it with the supplied one
        if (realPassword != null) {
            realPassword = (String) EncryptionManager.decrypt(realPassword);
        }
        char[] entered = ((PasswordCallback) callbacks[1]).getPassword();
        password = entered == null ? null : new String(entered);
        if (!checkPassword(realPassword, password)) {
            // Clear out the private state
            username = null;
            password = null;
            throw new FailedLoginException();
        }

        loginSucceeded = true;
        return true;
    }
View Full Code Here

        }

        try {
            boolean result = authenticate(cbUsername, cbPassword);
            if(!result) {
                throw new FailedLoginException();
            } else {
                return true;
            }
        } catch (Exception e) {
            throw (LoginException) new LoginException("LDAP Error").initCause(e);
View Full Code Here

            try {
                handler.handle(new Callback[] {nameCallback, passwordCallback});
                username = nameCallback.getName();
                String password = (String) options.get(username);
                if (password == null) {
                    throw new FailedLoginException();
                }
                if (password.equals(new String(passwordCallback.getPassword()))) {
                    return true;
                }
                throw new FailedLoginException();
            } catch (java.io.IOException e) {
                throw new FailedLoginException();
            } catch (UnsupportedCallbackException e) {
                throw new FailedLoginException();
            }
        }
View Full Code Here

            throw (LoginException) new LoginException().initCause(uce);
        }
        username = ((NameCallback) callbacks[0]).getName();
        if (username == null || username.equals("")) {
            username = null;
            throw new FailedLoginException();
        }
        byte[] token = Base64.decode(username);
        try {
            GSSManager manager = GSSManager.getInstance();
            Oid krb5Oid = new Oid("1.3.6.1.5.5.2");
View Full Code Here

                || cbPassword == null || "".equals(cbPassword)) {
            // Clear out the private state
            cbUsername = null;
            cbPassword = null;
            groups.clear();
            throw new FailedLoginException();
        }

        try {
            boolean result = authenticate(cbUsername, cbPassword);
            if (!result) {
                throw new FailedLoginException();
            }
        } catch (LoginException e) {
            // Clear out the private state
            cbUsername = null;
            cbPassword = null;
View Full Code Here

            for (String role : roles) {
                groups.add(role);
            }
        } catch (CommunicationException e) {
            close(context);
            throw (LoginException) new FailedLoginException().initCause(e);
        } catch (NamingException e) {
            close(context);
            throw (LoginException) new FailedLoginException().initCause(e);
        }


        return true;
    }
View Full Code Here

        context.addToEnvironment(Context.SECURITY_CREDENTIALS, password);
        try {
            context.getAttributes("", null);
        } catch (AuthenticationException e) {
            log.debug("Authentication failed for dn=" + dn);
            throw new FailedLoginException();
        } finally {

            if (connectionUsername != null) {
                context.addToEnvironment(Context.SECURITY_PRINCIPAL,
                        connectionUsername);
View Full Code Here

        username = ((NameCallback) callbacks[0]).getName();
        if (username == null || username.equals("")) {
            // Clear out the private state
            username = null;
            password = null;
            throw new FailedLoginException();
        }
        String realPassword = users.getProperty(username);
        if (realPassword == null || realPassword.equals("")) {
            // Clear out the private state
            username = null;
            password = null;
            throw new FailedLoginException();
        } else {
            // Decrypt the password if needed, so we can compare it with the supplied one
            realPassword = (String) EncryptionManager.decrypt(realPassword);
        }
        char[] entered = ((PasswordCallback) callbacks[1]).getPassword();
        password = entered == null ? null : new String(entered);
        if (!checkPassword(realPassword, password)) {
            // Clear out the private state
            username = null;
            password = null;
            throw new FailedLoginException();
        }

        loginSucceeded = true;
        return true;
    }
View Full Code Here

TOP

Related Classes of javax.security.auth.login.FailedLoginException

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.