Search in sources :

Example 1 with RadiusAuthenticator

use of net.jradius.client.auth.RadiusAuthenticator in project opennms by OpenNMS.

the class RadiusAuthenticationProviderTest method testRetrieveUserChap.

@Test
@Ignore("Need to have a RADIUS server running on localhost")
public void testRetrieveUserChap() throws IOException {
    RadiusAuthenticationProvider provider = new RadiusAuthenticationProvider(m_radiusServer, m_sharedSecret);
    RadiusAuthenticator authTypeClass = new CHAPAuthenticator();
    provider.setAuthTypeClass(authTypeClass);
    provider.setRolesAttribute("Unknown-VSAttribute(5813:1)");
    UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(m_principal, m_credentials);
    provider.retrieveUser(m_username, token);
}
Also used : CHAPAuthenticator(net.jradius.client.auth.CHAPAuthenticator) UsernamePasswordAuthenticationToken(org.springframework.security.authentication.UsernamePasswordAuthenticationToken) RadiusAuthenticator(net.jradius.client.auth.RadiusAuthenticator) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with RadiusAuthenticator

use of net.jradius.client.auth.RadiusAuthenticator in project opennms by OpenNMS.

the class RadiusAuthenticationProviderTest method testRetrieveUserPap.

@Test
@Ignore("Need to have a RADIUS server running on localhost")
public void testRetrieveUserPap() throws IOException {
    RadiusAuthenticationProvider provider = new RadiusAuthenticationProvider(m_radiusServer, m_sharedSecret);
    RadiusAuthenticator authTypeClass = new PAPAuthenticator();
    provider.setAuthTypeClass(authTypeClass);
    provider.setRolesAttribute("Unknown-VSAttribute(5813:1)");
    UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(m_principal, m_credentials);
    provider.retrieveUser(m_username, token);
}
Also used : UsernamePasswordAuthenticationToken(org.springframework.security.authentication.UsernamePasswordAuthenticationToken) PAPAuthenticator(net.jradius.client.auth.PAPAuthenticator) RadiusAuthenticator(net.jradius.client.auth.RadiusAuthenticator) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 3 with RadiusAuthenticator

use of net.jradius.client.auth.RadiusAuthenticator in project opennms by OpenNMS.

the class RadiusAuthenticationProviderTest method doTestRetrieveUserMultipleTimes.

public void doTestRetrieveUserMultipleTimes(RadiusAuthenticator authenticator) {
    RadiusAuthenticationProvider provider = new RadiusAuthenticationProvider(m_radiusServer, m_sharedSecret);
    RadiusAuthenticator authTypeClass = authenticator;
    provider.setAuthTypeClass(authTypeClass);
    provider.setRolesAttribute("Unknown-VSAttribute(5813:1)");
    UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(m_principal, m_credentials);
    provider.retrieveUser(m_username, token);
    provider.retrieveUser(m_username, token);
    provider.retrieveUser(m_username, token);
    provider.retrieveUser(m_username, token);
    provider.retrieveUser(m_username, token);
    provider.retrieveUser(m_username, token);
}
Also used : UsernamePasswordAuthenticationToken(org.springframework.security.authentication.UsernamePasswordAuthenticationToken) RadiusAuthenticator(net.jradius.client.auth.RadiusAuthenticator)

Example 4 with RadiusAuthenticator

use of net.jradius.client.auth.RadiusAuthenticator in project opennms by OpenNMS.

the class RadiusAuthDetector method getAuthenticator.

public RadiusAuthenticator getAuthenticator() {
    final RadiusAuthenticator auth;
    final String authType = getAuthType();
    if (authType.equalsIgnoreCase("chap")) {
        auth = new CHAPAuthenticator();
    } else if (authType.equalsIgnoreCase("pap")) {
        auth = new PAPAuthenticator();
    } else if (authType.equalsIgnoreCase("mschapv1")) {
        auth = new MSCHAPv1Authenticator();
    } else if (authType.equalsIgnoreCase("mschapv2")) {
        auth = new MSCHAPv2Authenticator();
    } else if (authType.equalsIgnoreCase("eapmd5") || authType.equalsIgnoreCase("eap-md5")) {
        auth = new EAPMD5Authenticator();
    } else if (authType.equalsIgnoreCase("eapmschapv2") || authType.equalsIgnoreCase("eap-mschapv2")) {
        auth = new EAPMSCHAPv2Authenticator();
    } else if (RadiusUtils.isEAPTTLS(authType)) {
        auth = new EAPTTLSAuthenticator();
    } else {
        auth = null;
    }
    return auth;
}
Also used : CHAPAuthenticator(net.jradius.client.auth.CHAPAuthenticator) EAPTTLSAuthenticator(net.jradius.client.auth.EAPTTLSAuthenticator) EAPMD5Authenticator(net.jradius.client.auth.EAPMD5Authenticator) EAPMSCHAPv2Authenticator(net.jradius.client.auth.EAPMSCHAPv2Authenticator) MSCHAPv1Authenticator(net.jradius.client.auth.MSCHAPv1Authenticator) PAPAuthenticator(net.jradius.client.auth.PAPAuthenticator) RadiusAuthenticator(net.jradius.client.auth.RadiusAuthenticator) EAPMSCHAPv2Authenticator(net.jradius.client.auth.EAPMSCHAPv2Authenticator) MSCHAPv2Authenticator(net.jradius.client.auth.MSCHAPv2Authenticator)

Example 5 with RadiusAuthenticator

use of net.jradius.client.auth.RadiusAuthenticator in project opennms by OpenNMS.

the class RadiusAuthenticationProviderTest method testRetrieveUserDefault.

@Test
@Ignore("Need to have a RADIUS server running on localhost")
public void testRetrieveUserDefault() throws IOException {
    RadiusAuthenticationProvider provider = new RadiusAuthenticationProvider(m_radiusServer, m_sharedSecret);
    RadiusAuthenticator authTypeClass = null;
    provider.setAuthTypeClass(authTypeClass);
    provider.setRolesAttribute("Unknown-VSAttribute(5813:1)");
    UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(m_principal, m_credentials);
    provider.retrieveUser(m_username, token);
}
Also used : UsernamePasswordAuthenticationToken(org.springframework.security.authentication.UsernamePasswordAuthenticationToken) RadiusAuthenticator(net.jradius.client.auth.RadiusAuthenticator) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

RadiusAuthenticator (net.jradius.client.auth.RadiusAuthenticator)6 UsernamePasswordAuthenticationToken (org.springframework.security.authentication.UsernamePasswordAuthenticationToken)4 CHAPAuthenticator (net.jradius.client.auth.CHAPAuthenticator)3 PAPAuthenticator (net.jradius.client.auth.PAPAuthenticator)3 Ignore (org.junit.Ignore)3 Test (org.junit.Test)3 EAPMD5Authenticator (net.jradius.client.auth.EAPMD5Authenticator)2 EAPMSCHAPv2Authenticator (net.jradius.client.auth.EAPMSCHAPv2Authenticator)2 EAPTTLSAuthenticator (net.jradius.client.auth.EAPTTLSAuthenticator)2 MSCHAPv1Authenticator (net.jradius.client.auth.MSCHAPv1Authenticator)2 MSCHAPv2Authenticator (net.jradius.client.auth.MSCHAPv2Authenticator)2 InetAddress (java.net.InetAddress)1 RadiusClient (net.jradius.client.RadiusClient)1 EAPTLSAuthenticator (net.jradius.client.auth.EAPTLSAuthenticator)1 Attr_NASIdentifier (net.jradius.dictionary.Attr_NASIdentifier)1 Attr_Password (net.jradius.dictionary.Attr_Password)1 Attr_UserName (net.jradius.dictionary.Attr_UserName)1 Attr_UserPassword (net.jradius.dictionary.Attr_UserPassword)1 AccessAccept (net.jradius.packet.AccessAccept)1 AccessRequest (net.jradius.packet.AccessRequest)1