Package net.sourceforge.jradiusclient

Examples of net.sourceforge.jradiusclient.RadiusPacket


          boolean authenticated = false;
     
      try{
          log.info("Entering RADIUS Validation...");
         
          RadiusPacket accessRequest = new RadiusPacket(RadiusPacket.ACCESS_REQUEST);
          RadiusAttribute userNameAttribute;
         
          userNameAttribute = new RadiusAttribute(RadiusAttributeValues.USER_NAME, radUser.getBytes());
          accessRequest.setAttribute(userNameAttribute);
                 
          accessRequest.setAttribute(new RadiusAttribute(RadiusAttributeValues.USER_PASSWORD, radPass.getBytes()));
             
          RadiusPacket accessResponse = rc.authenticate(accessRequest);
          switch(accessResponse.getPacketType()){
              case RadiusPacket.ACCESS_ACCEPT:
                  log.debug("User " + radUser + " validated by RADIUS server");
                  setRADIUSAttributes(accessResponse);
                  authenticated = true;
                  break;
              case RadiusPacket.ACCESS_REJECT:
                  log.warn("User " + radUser + " NOT validated by RADIUS server");
                  authenticated = false;
                  break;
              case RadiusPacket.ACCESS_CHALLENGE:
                  String reply = new String(accessResponse.getAttribute(RadiusAttributeValues.REPLY_MESSAGE).getValue());
                  log.debug("User " + radUser + " Challenged with " + reply);
                  break;
              default:
                  log.warn("Whoa, what kind of RadiusPacket is this? - " + accessResponse.getPacketType());
                  break;
          }
                     
      }catch(InvalidParameterException ivpex){
          log.info("InvalidParameterException: " + ivpex.getMessage());
View Full Code Here

TOP

Related Classes of net.sourceforge.jradiusclient.RadiusPacket

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.