Package ds.pjftp.user

Examples of ds.pjftp.user.FtpUser


            name = "anonymous";
        } else {
            name = param;

            final ServerSettings settings = SettingsHolder.getInstance().getSettings();
            final FtpUser user = settings.getUserList().get(name);

            if (user == null) {
                session.replyWithSpace(530, "Invalid user name.");
                return;
            }
        }
        final FtpUser newUser = new FtpUser();
        newUser.setUsername(name);

        session.setUser(newUser);
        session.replyWithSpace(331, "User name OK, need password.");
    }
View Full Code Here


     * Handles PASS command.
     */
    @Override
    public void invoke(@NotNull final ClientSession session, @NotNull final String param) {

        final FtpUser sessionUser = session.getUser();
        if (sessionUser == null) {
            session.replyWithSpace(503, "Login with USER first.");
            return;
        }

        if (sessionUser.getPassword() != null) {
            session.replyWithSpace(202, "Already logged-in.");
            return;
        }

        final ServerSettings settings = SettingsHolder.getInstance().getSettings();
        final FtpUser user = settings.getUserList().get(sessionUser.getUsername());

        // Checking password. For anonymous user it doesn't
        // matter what password he has.
        if (!param.equals(user.getPassword()) &&
            !sessionUser.getUsername().equals("anonymous"))
        {
            session.setUser(null);
            session.replyWithSpace(530, "Authentication failed.");
            return;
        }
        sessionUser.setHomeDir(user.getHomeDir());
        sessionUser.setPassword(user.getPassword());
        sessionUser.setWriteAccess(user.hasWriteAccess());

        final FSView fsView = FSViews.newUnixView(sessionUser);
        session.setFsView(fsView);

        session.replyWithSpace(230, "User logged in, proceed.");
View Full Code Here

TOP

Related Classes of ds.pjftp.user.FtpUser

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.