Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 3 commits
  • 9 files changed
  • 0 commit comments
  • 1 contributor
View
7 .classpath
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
View
3  .gitignore
@@ -3,3 +3,6 @@ dist
build
doc/apidoc
target
+.settings
+.classpath
+.project
View
23 .project
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>TinyRadius</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- </natures>
-</projectDescription>
View
3  .settings/org.eclipse.core.resources.prefs
@@ -1,3 +0,0 @@
-#Fri Feb 17 19:15:36 CET 2006
-eclipse.preferences.version=1
-encoding/CHANGES=UTF-8
View
13 .settings/org.eclipse.jdt.core.prefs
@@ -1,13 +0,0 @@
-#Tue Dec 06 14:42:56 PST 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.5
View
3  .settings/org.eclipse.jdt.ui.prefs
@@ -1,3 +0,0 @@
-#Sun Aug 28 12:00:41 CEST 2005
-eclipse.preferences.version=1
-internal.default.compliance=default
View
22 pom.xml
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.tinyradius</groupId>
<artifactId>tinyradius</artifactId>
- <version>1.0.2-SNAPSHOT</version>
+ <version>1.0.2</version>
<packaging>jar</packaging>
<name>TinyRadius Java Radius Library</name>
<description>
@@ -26,7 +26,7 @@
<licenses>
<license>
<name>Lesser General Public License (LGPL)</name>
- <url>${project.basedir}/LICENSE.txt</url>
+ <url>${project.basedir}/LICENSE</url>
<distribution>local</distribution>
</license>
</licenses>
@@ -37,4 +37,22 @@
<version>1.1</version>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.1.2</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>jar-no-fork</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
View
0  project.index
No changes.
View
40 src/main/java/org/tinyradius/util/RadiusClient.java
@@ -70,7 +70,7 @@ public RadiusClient(RadiusEndpoint client) {
* retries)
*/
public synchronized boolean authenticate(String userName, String password) throws IOException, RadiusException {
- return authenticate(userName, password, AccessRequest.AUTH_PAP);
+ return authenticate(userName, password, authProtocol);
}
/**
@@ -80,7 +80,7 @@ public synchronized boolean authenticate(String userName, String password) throw
* user name
* @param password
* password
- * @param authProtocol
+ * @param protocol
* either {@link AccessRequest#AUTH_PAP} or {@link AccessRequest#AUTH_CHAP}
* @return true if authentication is successful, false otherwise
* @exception RadiusException
@@ -89,9 +89,9 @@ public synchronized boolean authenticate(String userName, String password) throw
* communication error (after getRetryCount()
* retries)
*/
- public synchronized boolean authenticate(String userName, String password, String authProtocol) throws IOException, RadiusException {
+ public synchronized boolean authenticate(String userName, String password, String protocol) throws IOException, RadiusException {
AccessRequest request = new AccessRequest(userName, password);
- request.setAuthProtocol(authProtocol);
+ request.setAuthProtocol(protocol);
RadiusPacket response = authenticate(request);
return response.getPacketType() == RadiusPacket.ACCESS_ACCEPT;
}
@@ -148,8 +148,8 @@ public synchronized RadiusPacket account(AccountingRequest request) throws IOExc
* Closes the socket of this client.
*/
public void close() {
- if (socket != null)
- socket.close();
+ if (serverSocket != null)
+ serverSocket.close();
}
/**
@@ -256,8 +256,8 @@ public void setSocketTimeout(int socketTimeout) throws SocketException {
if (socketTimeout < 1)
throw new IllegalArgumentException("socket tiemout must be positive");
this.socketTimeout = socketTimeout;
- if (socket != null)
- socket.setSoTimeout(socketTimeout);
+ if (serverSocket != null)
+ serverSocket.setSoTimeout(socketTimeout);
}
/**
@@ -282,6 +282,19 @@ public int getAcctPort() {
}
/**
+ * Set the Radius authentication protocol.
+ *
+ * @see AccessRequest#AUTH_CHAP
+ * @see AccessRequest#AUTH_PAP
+ *
+ * @param protocol
+ * the protocol, PAP or CHAP
+ */
+ public void setAuthProtocol(String protocol) {
+ this.authProtocol = protocol;
+ }
+
+ /**
* Sends a Radius packet to the server and awaits an answer.
*
* @param request
@@ -353,11 +366,11 @@ public static RadiusPacket communicate(RadiusEndpoint remoteServer, RadiusPacket
* @throws SocketException
*/
protected DatagramSocket getSocket() throws SocketException {
- if (socket == null) {
- socket = new DatagramSocket();
- socket.setSoTimeout(getSocketTimeout());
+ if (serverSocket == null) {
+ serverSocket = new DatagramSocket();
+ serverSocket.setSoTimeout(getSocketTimeout());
}
- return socket;
+ return serverSocket;
}
/**
@@ -398,9 +411,10 @@ protected RadiusPacket makeRadiusPacket(DatagramPacket packet, RadiusPacket requ
private int acctPort = 1813;
private String hostName = null;
private String sharedSecret = null;
- private DatagramSocket socket = null;
+ private DatagramSocket serverSocket = null;
private int retryCount = 3;
private int socketTimeout = 3000;
+ private String authProtocol = AccessRequest.AUTH_PAP;
private static Log logger = LogFactory.getLog(RadiusClient.class);
}

No commit comments for this range

Something went wrong with that request. Please try again.