@Override protected RadiusResponse authenticateRequest(final RadiusClient client, final AccessRequest accessRequest) throws Exception { val authenticator = getRadiusAuthenticator(); authenticator.setupRequest(client, accessRequest); authenticator.processRequest(accessRequest); return client.sendReceive(accessRequest, getRetries()); }
auth.setupRequest(this, p); auth.processRequest(p); auth.processChallenge(p, reply);
protected boolean doTunnelAuthentication(byte id, byte[] in) throws RadiusException, SSLException, NoSuchAlgorithmException { if (tunnelChallenge != null && in != null) { AttributeList list = tunnelChallenge.getAttributes(); list.clear(); ByteBuffer buffer = ByteBuffer.wrap(in); diameterFormat.unpackAttributes(list, buffer, buffer.limit(), false); if (tunnelAuth instanceof EAPAuthenticator && tunnelChallenge.findAttribute(Attr_EAPMessage.TYPE) == null) tunnelAuth.setupRequest(client, tunnelRequest); else tunnelAuth.processChallenge(tunnelRequest, tunnelChallenge); } else tunnelChallenge = new AccessChallenge(); ByteBuffer buffer = ByteBuffer.allocate(1500); diameterFormat.packAttributeList(tunnelRequest.getAttributes(), buffer, true); putAppBuffer(buffer.array(), 0, buffer.position()); RadiusLog.debug("Tunnel Request:\n" + tunnelRequest.toString()); return true; }
public void init() throws RadiusException { super.init(); tunnelAuth = RadiusClient.getAuthProtocol(getInnerProtocol()); if (tunnelAuth == null || tunnelAuth instanceof MSCHAPv2Authenticator || tunnelAuth instanceof MSCHAPv1Authenticator || tunnelAuth instanceof CHAPAuthenticator) { throw new RadiusException("You can not currently use " + tunnelAuth.getAuthName() +" within a TLS Tunnel because of limitations in Java 1.5."); } }
/** * EAP requires a challenge/response. The request packet is reset with a new * RADIUS identifier and the EAP-Message is encoded. * @throws NoSuchAlgorithmException * @see net.jradius.client.auth.RadiusAuthenticator#processChallenge(net.jradius.packet.RadiusPacket, net.jradius.packet.RadiusPacket) */ public void processChallenge(RadiusPacket p, RadiusPacket r) throws RadiusException, NoSuchAlgorithmException { super.processChallenge(p, r); p.setIdentifier(-1); byte[] eapReply = AttributeFactory.assembleAttributeList(r.getAttributes(), AttributeDictionary.EAP_MESSAGE); byte[] eapMessage = doEAP(eapReply); RadiusAttribute a = p.findAttribute(AttributeDictionary.EAP_MESSAGE); if (a != null) p.removeAttribute(a); AttributeFactory.addToAttributeList(p.getAttributes(), AttributeDictionary.EAP_MESSAGE, eapMessage, p.isRecyclable()); RadiusLog.debug("Sending Challenge:\n" + p.toString()); }
protected boolean doTunnelAuthentication(byte id, byte[] in) throws RadiusException, SSLException, NoSuchAlgorithmException { if (tunnelChallenge != null && in != null) { AttributeList list = tunnelChallenge.getAttributes(); list.clear(); ByteBuffer buffer = ByteBuffer.wrap(in); diameterFormat.unpackAttributes(list, buffer, buffer.limit(), false); if (tunnelAuth instanceof EAPAuthenticator && tunnelChallenge.findAttribute(Attr_EAPMessage.TYPE) == null) tunnelAuth.setupRequest(client, tunnelRequest); else tunnelAuth.processChallenge(tunnelRequest, tunnelChallenge); } else tunnelChallenge = new AccessChallenge(); ByteBuffer buffer = ByteBuffer.allocate(1500); diameterFormat.packAttributeList(tunnelRequest.getAttributes(), buffer, true); putAppBuffer(buffer.array(), 0, buffer.position()); RadiusLog.debug("Tunnel Request:\n" + tunnelRequest.toString()); return true; }
public void init() throws RadiusException { super.init(); tunnelAuth = RadiusClient.getAuthProtocol(getInnerProtocol()); if (tunnelAuth == null || tunnelAuth instanceof MSCHAPv2Authenticator || tunnelAuth instanceof MSCHAPv1Authenticator || tunnelAuth instanceof CHAPAuthenticator) { throw new RadiusException("You can not currently use " + tunnelAuth.getAuthName() +" within a TLS Tunnel because of limitations in Java 1.5."); } }
/** * EAP requires a challenge/response. The request packet is reset with a new * RADIUS identifier and the EAP-Message is encoded. * @throws NoSuchAlgorithmException * @see net.jradius.client.auth.RadiusAuthenticator#processChallenge(net.jradius.packet.RadiusPacket, net.jradius.packet.RadiusPacket) */ public void processChallenge(RadiusPacket p, RadiusPacket r) throws RadiusException, NoSuchAlgorithmException { super.processChallenge(p, r); p.setIdentifier(-1); byte[] eapReply = AttributeFactory.assembleAttributeList(r.getAttributes(), AttributeDictionary.EAP_MESSAGE); byte[] eapMessage = doEAP(eapReply); RadiusAttribute a = p.findAttribute(AttributeDictionary.EAP_MESSAGE); if (a != null) p.removeAttribute(a); AttributeFactory.addToAttributeList(p.getAttributes(), AttributeDictionary.EAP_MESSAGE, eapMessage, p.isRecyclable()); RadiusLog.debug("Sending Challenge:\n" + p.toString()); }
/** * @throws NoSuchAlgorithmException * @see net.jradius.client.auth.RadiusAuthenticator#setupRequest(net.jradius.client.RadiusClient, net.jradius.packet.RadiusPacket) */ public void setupRequest(RadiusClient c, RadiusPacket p) throws RadiusException, NoSuchAlgorithmException { super.setupRequest(c, p); tunnelRequest = new AccessRequest(tunneledAttributes); AttributeList attrs = tunnelRequest.getAttributes(); if (attrs.get(Attr_UserName.TYPE) == null) attrs.add(AttributeFactory.copyAttribute(username, false)); if (attrs.get(Attr_UserPassword.TYPE) == null) attrs.add(AttributeFactory.copyAttribute(password, false)); tunnelAuth.setupRequest(c, tunnelRequest); if (!(tunnelAuth instanceof PAPAuthenticator)) // do not encode pap password { tunnelAuth.processRequest(tunnelRequest); } }
auth.setupRequest(this, p); auth.processRequest(p); auth.processChallenge(p, reply);
protected boolean doTunnelAuthentication(byte id, byte[] in) throws RadiusException, SSLException, NoSuchAlgorithmException { if (tunnelChallenge != null && in != null) { AttributeList list = tunnelChallenge.getAttributes(); list.clear(); ByteBuffer buffer = ByteBuffer.wrap(in); diameterFormat.unpackAttributes(list, buffer, buffer.limit(), false); if (tunnelAuth instanceof EAPAuthenticator && tunnelChallenge.findAttribute(Attr_EAPMessage.TYPE) == null) tunnelAuth.setupRequest(client, tunnelRequest); else tunnelAuth.processChallenge(tunnelRequest, tunnelChallenge); } else tunnelChallenge = new AccessChallenge(); ByteBuffer buffer = ByteBuffer.allocate(1500); diameterFormat.packAttributeList(tunnelRequest.getAttributes(), buffer, true); putAppBuffer(buffer.array(), 0, buffer.position()); RadiusLog.debug("Tunnel Request:\n" + tunnelRequest.toString()); return true; }
public void init() throws RadiusException { super.init(); tunnelAuth = RadiusClient.getAuthProtocol(getInnerProtocol()); if (tunnelAuth == null || tunnelAuth instanceof MSCHAPv2Authenticator || tunnelAuth instanceof MSCHAPv1Authenticator || tunnelAuth instanceof CHAPAuthenticator) { throw new RadiusException("You can not currently use " + tunnelAuth.getAuthName() +" within a TLS Tunnel because of limitations in Java 1.5."); } }
/** * @throws NoSuchAlgorithmException * @see net.jradius.client.auth.RadiusAuthenticator#setupRequest(net.jradius.client.RadiusClient, net.jradius.packet.RadiusPacket) */ public void setupRequest(RadiusClient c, RadiusPacket p) throws RadiusException, NoSuchAlgorithmException { super.setupRequest(c, p); tunnelRequest = new AccessRequest(tunneledAttributes); AttributeList attrs = tunnelRequest.getAttributes(); if (attrs.get(Attr_UserName.TYPE) == null) attrs.add(AttributeFactory.copyAttribute(username, false)); if (attrs.get(Attr_UserPassword.TYPE) == null) attrs.add(AttributeFactory.copyAttribute(password, false)); tunnelAuth.setupRequest(c, tunnelRequest); if (!(tunnelAuth instanceof PAPAuthenticator)) // do not encode pap password { tunnelAuth.processRequest(tunnelRequest); } }
final AccessRequest request = new AccessRequest(radiusClient, attributeList); LOG.debug("Sending AccessRequest message to {}:{} using {} protocol with timeout = {}, retries = {}, attributes:\n{}", InetAddressUtils.str(serverIP), port, authenticator.getAuthName(), timeout, retries, attributeList.toString()); reply = radiusClient.authenticate(request, authenticator, retries); } catch (RadiusException e) {
/** * @throws NoSuchAlgorithmException * @see net.jradius.client.auth.RadiusAuthenticator#setupRequest(net.jradius.client.RadiusClient, net.jradius.packet.RadiusPacket) */ public void setupRequest(RadiusClient c, RadiusPacket p) throws RadiusException, NoSuchAlgorithmException { super.setupRequest(c, p); tunnelRequest = new AccessRequest(tunneledAttributes); AttributeList attrs = tunnelRequest.getAttributes(); if (attrs.get(Attr_UserName.TYPE) == null) attrs.add(AttributeFactory.copyAttribute(username, false)); if (attrs.get(Attr_UserPassword.TYPE) == null) attrs.add(AttributeFactory.copyAttribute(password, false)); tunnelAuth.setupRequest(c, tunnelRequest); if (!(tunnelAuth instanceof PAPAuthenticator)) // do not encode pap password { tunnelAuth.processRequest(tunnelRequest); } }