Package javax.security.auth.login

Examples of javax.security.auth.login.FailedLoginException


                http.setRequestMethod(method);
            }
            http.connect();
            if(http.getResponseCode() == 401) { // need to authenticate
                if(username == null || username.equals("")) {
                    throw new FailedLoginException("Server returned 401 "+http.getResponseMessage());
                }
                http = (HttpURLConnection) url.openConnection();
                http.setRequestProperty("Authorization", "Basic " + new String(Base64.encode((username + ":" + password).getBytes())));
                if(method != null) {
                    http.setRequestMethod(method);
                }
                http.connect();
                if(http.getResponseCode() == 401) {
                    throw new FailedLoginException("Server returned 401 "+http.getResponseMessage());
                } else if(http.getResponseCode() == 404) {
                    return null; // Not found at this repository
                }
                if(monitor != null && http.getContentLength() > 0) {
                    monitor.setTotalBytes(http.getContentLength());
View Full Code Here


        // Report results based on success or failure
        if (principal != null) {
            return (true);
        } else {
            throw new
                FailedLoginException("Username or password is incorrect");
        }

    }
View Full Code Here

                        found = true;
                        break;
                    }
                }
                if (!found) {
                    throw new FailedLoginException("User does not have the required role " + role);
                }
            }
            return subject;
        } catch (AccountException e) {
            return null;
View Full Code Here

        // Report results based on success or failure
        if (principal != null) {
            return (true);
        } else {
            throw new
                FailedLoginException("Username or password is incorrect");
        }

    }
View Full Code Here

        if (auth == null) {
            return false;
        } else if (auth.authenticate(credentials)) {
            return true;
        }
        throw new FailedLoginException();
    }
View Full Code Here

        Subject impersSubject = getImpersonatorSubject(credentials);
        User user = (User) authrz;
        if (user.getImpersonation().allows(impersSubject)) {
            return true;
        } else {
            throw new FailedLoginException("attempt to impersonate denied for " + principal.getName());
        }
    }
View Full Code Here

        if (authenticated) {
            return !principals.isEmpty();
        } else {
            // authentication failed: clean out state
            principals.clear();
            throw new FailedLoginException();
        }
    }
View Full Code Here

        if (auth == null) {
            return false;
        } else if (auth.authenticate(credentials)) {
            return true;
        }
        throw new FailedLoginException();
    }
View Full Code Here

        Subject impersSubject = getImpersonatorSubject(credentials);
        User user = (User) authrz;
        if (user.getImpersonation().allows(impersSubject)) {
            return true;
        } else {
            throw new FailedLoginException("attempt to impersonate denied for " + principal.getName());
        }
    }
View Full Code Here

                throw (IOException) new IOException("Cannot connect to "+location).initCause(e);
            }

            if (http.getResponseCode() == 401) { // need to authenticate
                if (username == null || username.equals("")) {
                    throw new FailedLoginException("Server returned 401 " + http.getResponseMessage());
                }
                //TODO is it necessary to keep getting new http's ?
                http = (HttpURLConnection) location.openConnection();
                http.setRequestProperty("Authorization",
                        "Basic " + new String(Base64.encode((username + ":" + password).getBytes())));
                http.connect();
                if (http.getResponseCode() == 401) {
                    throw new FailedLoginException("Server returned 401 " + http.getResponseMessage());
                } else if (http.getResponseCode() == 404) {
                    return null; // Not found at this repository
                }
            } else if (http.getResponseCode() == 404) {
                return null; // Not found at this repository
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.