Example usage for org.apache.commons.net.nntp NNTPReply MORE_AUTH_INFO_REQUIRED

List of usage examples for org.apache.commons.net.nntp NNTPReply MORE_AUTH_INFO_REQUIRED

Introduction

In this page you can find the example usage for org.apache.commons.net.nntp NNTPReply MORE_AUTH_INFO_REQUIRED.

Prototype

int MORE_AUTH_INFO_REQUIRED

To view the source code for org.apache.commons.net.nntp NNTPReply MORE_AUTH_INFO_REQUIRED.

Click Source Link

Usage

From source file:net.longfalcon.newsj.nntp.client.CustomNNTPClient.java

/**
 * Log into a news server by sending the AUTHINFO USER/AUTHINFO
 * PASS command sequence. This is usually sent in response to a
 * 480 reply code from the NNTP server.//from   www  .  j  a v a  2 s  .  co m
 * <p>
 * @param username a valid username
 * @param password the corresponding password
 * @return True for successful login, false for a failure
 * @throws IOException
 */
@Override
public boolean authenticate(String username, String password) throws IOException {
    int replyCode = authinfoUser(username);

    if (replyCode == NNTPReply.MORE_AUTH_INFO_REQUIRED) {
        replyCode = authinfoPass(password);

        if (replyCode == NNTPReply.AUTHENTICATION_ACCEPTED) {
            //_isAllowedToPost = true; Posting disabled. i think this will probably be OK for our purposes.
            return true;
        }
    }
    return false;
}