private CredentialsInfo getRadiusChallenge(RadiusPacket challengePacket) {

        // Try to get the state attribute - if it's not there, we have a problem
        RadiusAttribute stateAttr = challengePacket.findAttribute(Attr_State.TYPE);
        if (stateAttr == null) {
            logger.error("Something went wrong, state attribute not present.");
            logger.debug("State Attribute turned up null, which shouldn't happen in AccessChallenge.");
            return null;
        }

        // We need to get the reply message so we know what to ask the user
        RadiusAttribute replyAttr = challengePacket.findAttribute(Attr_ReplyMessage.TYPE);
        if (replyAttr == null) {
            logger.error("No reply message received from the server.");
            logger.debug("Expecting a Attr_ReplyMessage attribute on this packet, and did not get one.");
            return null;
        }

        // We have the required attributes - convert to strings and then generate the additional login box/field
        String replyMsg = replyAttr.toString();
        String radiusState = BaseEncoding.base16().encode(stateAttr.getValue().getBytes());
        Field radiusResponseField = new RadiusChallengeResponseField(replyMsg);
        Field radiusStateField = new RadiusStateField(radiusState);

        // Return the CredentialsInfo object that has the state and the expected response.
        return new CredentialsInfo(Arrays.asList(radiusResponseField,radiusStateField));
    }
private CredentialsInfo getRadiusChallenge ( RadiusPacket challengePacket ) { RadiusAttribute stateAttr = challengePacket . findAttribute ( Attr_State . TYPE ) ; if ( stateAttr == null ) { logger . error ( "Something went wrong, state attribute not present." ) ; logger . debug ( "State Attribute turned up null, which shouldn't happen in AccessChallenge." ) ; return null ; } RadiusAttribute replyAttr = challengePacket . findAttribute ( Attr_ReplyMessage . TYPE ) ; if ( replyAttr == null ) { logger . error ( "No reply message received from the server." ) ; logger . debug ( "Expecting a Attr_ReplyMessage attribute on this packet, and did not get one." ) ; return null ; } String replyMsg = replyAttr . toString ( ) ; String radiusState = BaseEncoding . base16 ( ) . encode ( stateAttr . getValue ( ) . getBytes ( ) ) ; Field radiusResponseField = new RadiusChallengeResponseField ( replyMsg ) ; Field radiusStateField = new RadiusStateField ( radiusState ) ; return new CredentialsInfo ( Arrays . asList ( radiusResponseField , radiusStateField ) ) ; }
Returns the expected credentials from a RADIUS challenge.

@param challengePacket
The AccessChallenge RadiusPacket received from the RADIUS
server.

@return
A CredentialsInfo object that represents fields that need to
be presented to the user in order to complete authentication.
One of these must be the RADIUS state.