-
Notifications
You must be signed in to change notification settings - Fork 95
Issue peap : problem authenticating with peap after release 1.1.5 #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jm-k
wants to merge
2
commits into
coova:master
Choose a base branch
from
jm-k:Issue-peap
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
120 changes: 120 additions & 0 deletions
120
example/src/test/java/net/jradius/testAuth/TestRadiusCLientAuth.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| package net.jradius.testAuth; | ||
|
|
||
| import static org.junit.Assert.*; | ||
|
|
||
| import java.io.IOException; | ||
| import java.net.Inet4Address; | ||
| import java.net.InetAddress; | ||
| import java.security.NoSuchAlgorithmException; | ||
|
|
||
| import org.junit.Ignore; | ||
| import org.junit.Test; | ||
|
|
||
| import net.jradius.client.RadiusClient; | ||
| import net.jradius.client.auth.EAPTTLSAuthenticator; | ||
| import net.jradius.client.auth.PEAPAuthenticator; | ||
| import net.jradius.client.auth.RadiusAuthenticator; | ||
| import net.jradius.dictionary.Attr_CleartextPassword; | ||
| import net.jradius.dictionary.Attr_Password; | ||
| import net.jradius.dictionary.Attr_UserName; | ||
| import net.jradius.dictionary.Attr_UserPassword; | ||
| import net.jradius.exception.RadiusException; | ||
| import net.jradius.exception.UnknownAttributeException; | ||
| import net.jradius.packet.AccessAccept; | ||
| import net.jradius.packet.AccessRequest; | ||
| import net.jradius.packet.RadiusResponse; | ||
| import net.jradius.packet.attribute.AttributeFactory; | ||
|
|
||
| /** | ||
| * @author jmk <jm+jradius@kubek.fr> | ||
| * | ||
| */ | ||
| public class TestRadiusCLientAuth { | ||
|
|
||
| @Test | ||
| @Ignore("This test require a radius server rinning on localhost") | ||
| public void testPap() throws IOException, UnknownAttributeException, NoSuchAlgorithmException, RadiusException{ | ||
| InetAddress localhost = Inet4Address.getLocalHost(); | ||
| String secret = "testing123"; | ||
| RadiusClient rc = new RadiusClient(localhost,secret,1812,1813,2000); | ||
| AccessRequest accessRequest = new AccessRequest(); | ||
| RadiusAuthenticator auth = RadiusClient.getAuthProtocol("pap"); | ||
| accessRequest.addAttribute(new Attr_UserName("bob")); | ||
| auth.setPassword(new Attr_CleartextPassword("hello")); | ||
| AttributeFactory.loadAttributeDictionary("net.jradius.dictionary.AttributeDictionaryImpl"); | ||
|
|
||
| int retries =0; | ||
| RadiusResponse response = rc.authenticate(accessRequest, auth, 0); | ||
| assertTrue(response instanceof AccessAccept); | ||
| } | ||
|
|
||
| @Test | ||
| @Ignore("This test require a radius server rinning on localhost") | ||
| public void testChap() throws IOException, UnknownAttributeException, NoSuchAlgorithmException, RadiusException{ | ||
| InetAddress localhost = Inet4Address.getLocalHost(); | ||
| String secret = "testing123"; | ||
| RadiusClient rc = new RadiusClient(localhost,secret,1812,1813,2000); | ||
| AccessRequest accessRequest = new AccessRequest(); | ||
| RadiusAuthenticator auth = RadiusClient.getAuthProtocol("chap"); | ||
| accessRequest.addAttribute(new Attr_UserName("bob")); | ||
| auth.setPassword(new Attr_CleartextPassword("hello")); | ||
| AttributeFactory.loadAttributeDictionary("net.jradius.dictionary.AttributeDictionaryImpl"); | ||
|
|
||
| int retries =0; | ||
| RadiusResponse response = rc.authenticate(accessRequest, auth, 0); | ||
| assertTrue(response instanceof AccessAccept); | ||
| } | ||
|
|
||
| @Test | ||
| @Ignore("This test require a radius server rinning on localhost") | ||
| public void testMsChap() throws IOException, UnknownAttributeException, NoSuchAlgorithmException, RadiusException{ | ||
| InetAddress localhost = Inet4Address.getLocalHost(); | ||
| String secret = "testing123"; | ||
| RadiusClient rc = new RadiusClient(localhost,secret,1812,1813,2000); | ||
| AccessRequest accessRequest = new AccessRequest(); | ||
| RadiusAuthenticator auth = RadiusClient.getAuthProtocol("eap-md5"); | ||
| accessRequest.addAttribute(new Attr_UserName("bob")); | ||
| auth.setPassword(new Attr_CleartextPassword("hello")); | ||
| AttributeFactory.loadAttributeDictionary("net.jradius.dictionary.AttributeDictionaryImpl"); | ||
|
|
||
| int retries =0; | ||
| RadiusResponse response = rc.authenticate(accessRequest, auth, 0); | ||
| assertTrue(response instanceof AccessAccept); | ||
| } | ||
|
|
||
| @Test | ||
| @Ignore("This test require a radius server rinning on localhost") | ||
| public void testEapTTLS() throws IOException, UnknownAttributeException, NoSuchAlgorithmException, RadiusException{ | ||
| InetAddress localhost = Inet4Address.getLocalHost(); | ||
| String secret = "testing123"; | ||
| RadiusClient rc = new RadiusClient(localhost,secret,1812,1813,2000); | ||
| AccessRequest accessRequest = new AccessRequest(); | ||
| RadiusAuthenticator auth = RadiusClient.getAuthProtocol("eap-ttls"); | ||
| assertNotNull(auth); | ||
| accessRequest.addAttribute(new Attr_UserName("bob")); | ||
| accessRequest.addAttribute(new Attr_UserPassword("hello")); | ||
| AttributeFactory.loadAttributeDictionary("net.jradius.dictionary.AttributeDictionaryImpl"); | ||
| int retries =0; | ||
| RadiusResponse response = rc.authenticate(accessRequest, auth, 0); | ||
| assertTrue(response instanceof AccessAccept); | ||
| } | ||
|
|
||
| @Test | ||
| @Ignore("This test require a radius server rinning on localhost") | ||
| public void testPeap() throws IOException, UnknownAttributeException, NoSuchAlgorithmException, RadiusException{ | ||
| InetAddress localhost = Inet4Address.getLocalHost(); | ||
| String secret = "testing123"; | ||
| RadiusClient rc = new RadiusClient(localhost,secret,1812,1813,2000); | ||
| AccessRequest accessRequest = new AccessRequest(); | ||
| accessRequest.addAttribute(new Attr_UserName("bob2")); | ||
| //accessRequest.addAttribute(new Attr_UserPassword("test")); | ||
| RadiusAuthenticator auth = RadiusClient.getAuthProtocol("peap"); | ||
| assertNotNull(auth); | ||
| ((PEAPAuthenticator)auth).setPassword(new Attr_Password("test")); | ||
| ((PEAPAuthenticator)auth).setTrustAll(true); | ||
| AttributeFactory.loadAttributeDictionary("net.jradius.dictionary.AttributeDictionaryImpl"); | ||
| int retries =0; | ||
| RadiusResponse response = rc.authenticate(accessRequest, auth, 0); | ||
| assertTrue(response.getClass().getName(),response instanceof AccessAccept); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLientvsClient