@Test public void testAuthenticate() { assertNotNull(this.radiusServer); }
@Override public boolean authenticate(final String username, final String password) throws PreventedException { final AttributeList attributeList = new AttributeList(); attributeList.add(new Attr_UserName(username)); attributeList.add(new Attr_UserPassword(password)); RadiusClient client = null; try { client = this.radiusClientFactory.newInstance(); LOGGER.debug("Created RADIUS client instance {}", client); final AccessRequest request = new AccessRequest(client, attributeList); final RadiusPacket response = client.authenticate( request, RadiusClient.getAuthProtocol(this.protocol.getName()), this.retries); LOGGER.debug("RADIUS response from {}: {}", client.getRemoteInetAddress().getCanonicalHostName(), response.getClass().getName()); if (response instanceof AccessAccept) { return true; } } catch (final Exception e) { throw new PreventedException(e); } finally { if (client != null) { client.close(); } } return false; }
JRadiusServerImpl implements RadiusServer { @Override public boolean authenticate(final String username, final String password) throws PreventedException { final AttributeList attributeList = new AttributeList(); attributeList.add(new Attr_UserName(username)); attributeList.add(new Attr_UserPassword(password)); RadiusClient client = null; try { client = this.radiusClientFactory.newInstance(); LOGGER.debug("Created RADIUS client instance {}", client); final AccessRequest request = new AccessRequest(client, attributeList); final RadiusPacket response = client.authenticate( request, RadiusClient.getAuthProtocol(this.protocol.getName()), this.retries); LOGGER.debug("RADIUS response from {}: {}", client.getRemoteInetAddress().getCanonicalHostName(), response.getClass().getName()); if (response instanceof AccessAccept) { return true; } } catch (final Exception e) { throw new PreventedException(e); } finally { if (client != null) { client.close(); } } return false; } }
JRadiusServerImpl implements RadiusServer { @Override public boolean authenticate(final String username, final String password) throws PreventedException { final AttributeList attributeList = new AttributeList(); attributeList.add(new Attr_UserName(username)); attributeList.add(new Attr_UserPassword(password)); RadiusClient client = null; try { client = this.radiusClientFactory.newInstance(); LOGGER.debug("Created RADIUS client instance {}", client); final AccessRequest request = new AccessRequest(client, attributeList); final RadiusPacket response = client.authenticate( request, RadiusClient.getAuthProtocol(this.protocol.getName()), this.retries); LOGGER.debug("RADIUS response from {}: {}", client.getRemoteInetAddress().getCanonicalHostName(), response.getClass().getName()); if (response instanceof AccessAccept) { return true; } } catch (final Exception e) { throw new PreventedException(e); } finally { if (client != null) { client.close(); } } return false; } JRadiusServerImpl(final RadiusProtocol protocol, final RadiusClientFactory clientFactory); }
JRadiusServerImpl implements RadiusServer { @Override public boolean authenticate(final String username, final String password) throws PreventedException { final AttributeList attributeList = new AttributeList(); attributeList.add(new Attr_UserName(username)); attributeList.add(new Attr_UserPassword(password)); RadiusClient client = null; try { client = this.radiusClientFactory.newInstance(); LOGGER.debug("Created RADIUS client instance {}", client); final AccessRequest request = new AccessRequest(client, attributeList); final RadiusPacket response = client.authenticate( request, RadiusClient.getAuthProtocol(this.protocol.getName()), this.retries); LOGGER.debug("RADIUS response from {}: {}", client.getRemoteInetAddress().getCanonicalHostName(), response.getClass().getName()); if (response instanceof AccessAccept) { return true; } } catch (final Exception e) { throw new PreventedException(e); } finally { if (client != null) { client.close(); } } return false; } JRadiusServerImpl(final RadiusProtocol protocol, final RadiusClientFactory clientFactory); @Override boolean authenticate(final String username, final String password); void setRetries(final int retries); }
JRadiusServerImpl implements RadiusServer { @Override public boolean authenticate(final String username, final String password) throws PreventedException { final AttributeList attributeList = new AttributeList(); attributeList.add(new Attr_UserName(username)); attributeList.add(new Attr_UserPassword(password)); RadiusClient client = null; try { client = this.radiusClientFactory.newInstance(); LOGGER.debug("Created RADIUS client instance {}", client); final AccessRequest request = new AccessRequest(client, attributeList); final RadiusPacket response = client.authenticate( request, RadiusClient.getAuthProtocol(this.protocol.getName()), this.retries); LOGGER.debug("RADIUS response from {}: {}", client.getRemoteInetAddress().getCanonicalHostName(), response.getClass().getName()); if (response instanceof AccessAccept) { return true; } } catch (final Exception e) { throw new PreventedException(e); } finally { if (client != null) { client.close(); } } return false; } JRadiusServerImpl(final RadiusProtocol protocol, final RadiusClientFactory clientFactory); @Override boolean authenticate(final String username, final String password); void setRetries(final int retries); static final int DEFAULT_RETRY_COUNT; }