本文整理汇总了Java中net.jradius.exception.RadiusException类的典型用法代码示例。如果您正苦于以下问题:Java RadiusException类的具体用法?Java RadiusException怎么用?Java RadiusException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RadiusException类属于net.jradius.exception包,在下文中一共展示了RadiusException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onPostProcessing
import net.jradius.exception.RadiusException; //导入依赖的package包/类
public void onPostProcessing(JRadiusRequest request) throws RadiusException
{
// If we have a session, fire off events
switch(request.getType())
{
case JRadiusServer.JRADIUS_authorize:
onAuthorization(request);
break;
case JRadiusServer.JRADIUS_post_auth:
onPostAuthentication(request);
break;
case JRadiusServer.JRADIUS_preacct:
onAccounting(request);
break;
}
}
开发者ID:coova,项目名称:jradius,代码行数:17,代码来源:RadiusSession.java
示例2: getKeyFromAttributeType
import net.jradius.exception.RadiusException; //导入依赖的package包/类
protected Serializable getKeyFromAttributeType(RadiusPacket req, long type, boolean required) throws RadiusException
{
RadiusAttribute a = req.findAttribute(type);
if (a == null)
{
if (required)
{
a = AttributeFactory.newAttribute(type, null, false);
throw new RadiusException("Missing required attribute: " + a.getAttributeName());
}
return null;
}
AttributeValue v = a.getValue();
return v.toString();
}
开发者ID:coova,项目名称:jradius,代码行数:18,代码来源:RadiusSessionKeyProvider.java
示例3: setupRequest
import net.jradius.exception.RadiusException; //导入依赖的package包/类
/**
* @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);
}
}
开发者ID:coova,项目名称:jradius,代码行数:20,代码来源:EAPTTLSAuthenticator.java
示例4: doTunnelAuthentication
import net.jradius.exception.RadiusException; //导入依赖的package包/类
protected boolean doTunnelAuthentication(byte id, byte[] in) throws RadiusException, SSLException, NoSuchAlgorithmException
{
byte []out;
if (in != null && in.length > 0)
{
out = tunnelAuth.doEAP(in);
}
else
{
out = tunnelAuth.eapResponse(EAP_IDENTITY, (byte)0, getUsername());
}
putAppBuffer(out);
return true;
}
开发者ID:coova,项目名称:jradius,代码行数:17,代码来源:PEAPAuthenticator.java
示例5: writeResponse
import net.jradius.exception.RadiusException; //导入依赖的package包/类
public void writeResponse(JRadiusRequest request, ByteBuffer buffer, OutputStream outputStream) throws IOException, RadiusException, InvalidKeyException, NoSuchAlgorithmException
{
if (Configuration.isDebug())
request.printDebugInfo();
RadiusPacket[] rp = request.getPackets();
RadiusRequest req = (RadiusRequest) rp[0];
RadiusResponse res = (RadiusResponse) rp[1];
String sharedSecret = (String) req.getAttributeValue(Attr_SharedSecret.TYPE);
RadiusFormat format = RadiusFormat.getInstance();
MessageAuthenticator.generateResponseMessageAuthenticator(req, res, sharedSecret);
res.generateAuthenticator(req.getAuthenticator(), sharedSecret);
buffer.clear();
format.packPacket(res, sharedSecret, buffer, true);
outputStream.write(buffer.array(), 0, buffer.position());
outputStream.flush();
}
开发者ID:coova,项目名称:jradius,代码行数:24,代码来源:RadSecProcessor.java
示例6: updateAccounting
import net.jradius.exception.RadiusException; //导入依赖的package包/类
public void updateAccounting(AccountingRequest acctRequest) throws RadiusException
{
AccountingRequest newRequest = new AccountingRequest(radiusClient, reqList);
AttributeList attrs = acctRequest.getAttributes();
for (Iterator i=attrs.getAttributeList().iterator(); i.hasNext();)
{
RadiusAttribute at = (RadiusAttribute)i.next();
long type = at.getFormattedType();
if (type == Attr_AcctInputOctets.TYPE ||
type == Attr_AcctOutputOctets.TYPE ||
type == Attr_AcctInputGigawords.TYPE ||
type == Attr_AcctOutputGigawords.TYPE ||
type == Attr_AcctInputPackets.TYPE ||
type == Attr_AcctOutputPackets.TYPE ||
type == Attr_AcctTerminateCause.TYPE ||
type == Attr_AcctSessionStartTime.TYPE ||
type == Attr_AcctDelayTime.TYPE ||
type == Attr_AcctSessionTime.TYPE ||
type == Attr_AcctStatusType.TYPE)
newRequest.addAttribute(AttributeFactory.newAttribute(type, at.getValue().getBytes(), false));
}
radiusClient.accounting(newRequest, 2);
}
开发者ID:coova,项目名称:jradius,代码行数:25,代码来源:OTPProxyRequest.java
示例7: getSession
import net.jradius.exception.RadiusException; //导入依赖的package包/类
public JRadiusSession getSession(JRadiusRequest request, Serializable key) throws RadiusException
{
Element element = sessionCache.get(key);
JRadiusSession session = null;
if (element != null)
{
session = (JRadiusSession) element.getValue();
}
if (session == null && request != null)
{
SessionFactory sf = getSessionFactory(request.getSender());
session = sf.getSession(request, key);
if (session != null)
{
put(session.getJRadiusKey(), session);
put(session.getSessionKey(), session);
}
}
if (session == null) return null;
return session;
}
开发者ID:coova,项目名称:jradius,代码行数:26,代码来源:JRadiusSessionManager.java
示例8: receive
import net.jradius.exception.RadiusException; //导入依赖的package包/类
protected RadiusResponse receive(RadiusRequest req) throws Exception
{
if (statusListener != null)
{
statusListener.onBeforeReceive(this);
}
byte replyBytes[] = new byte[RadiusPacket.MAX_PACKET_LENGTH];
DatagramPacket reply = new DatagramPacket(replyBytes, replyBytes.length);
socket.receive(reply);
RadiusPacket replyPacket = PacketFactory.parse(reply, req.isRecyclable());
if (!(replyPacket instanceof RadiusResponse))
{
throw new RadiusException("Received something other than a RADIUS Response to a Request");
}
if (statusListener != null)
{
statusListener.onAfterReceive(this, replyPacket);
}
return (RadiusResponse)replyPacket;
}
开发者ID:coova,项目名称:jradius,代码行数:27,代码来源:UDPClientTransport.java
示例9: processChallenge
import net.jradius.exception.RadiusException; //导入依赖的package包/类
/**
* 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());
}
开发者ID:coova,项目名称:jradius,代码行数:24,代码来源:EAPAuthenticator.java
示例10: processRequest
import net.jradius.exception.RadiusException; //导入依赖的package包/类
public void processRequest(RadiusPacket p) throws RadiusException, NoSuchAlgorithmException
{
if (password == null) throw new RadiusException("no password given");
p.removeAttribute(password);
RadiusAttribute attr;
byte authChallenge[] = RadiusRandom.getBytes(16);
byte chapResponse[] = MSCHAP.doMSCHAPv1(password.getValue().getBytes(), authChallenge);
p.addAttribute(attr = AttributeFactory.newAttribute("MS-CHAP-Challenge"));
attr.setValue(authChallenge);
p.addAttribute(attr = AttributeFactory.newAttribute("MS-CHAP-Response"));
attr.setValue(chapResponse);
}
开发者ID:coova,项目名称:jradius,代码行数:17,代码来源:MSCHAPv1Authenticator.java
示例11: processRequest
import net.jradius.exception.RadiusException; //导入依赖的package包/类
public void processRequest(RadiusPacket p) throws RadiusException, NoSuchAlgorithmException
{
if (password == null) throw new RadiusException("no password given");
p.removeAttribute(password);
RadiusAttribute attr;
byte authChallenge[] = RadiusRandom.getBytes(16);
byte chapResponse[] = CHAP.chapResponse((byte)p.getIdentifier(), password.getValue().getBytes(), authChallenge);
p.addAttribute(attr = AttributeFactory.newAttribute("CHAP-Challenge"));
attr.setValue(authChallenge);
p.addAttribute(attr = AttributeFactory.newAttribute("CHAP-Password"));
attr.setValue(chapResponse);
}
开发者ID:coova,项目名称:jradius,代码行数:17,代码来源:CHAPAuthenticator.java
示例12: setupRequest
import net.jradius.exception.RadiusException; //导入依赖的package包/类
/**
* @param c The RadiusClient context being used
* @param p Setup the Authenticator with packet data
* @throws RadiusException
* @throws NoSuchAlgorithmException
*/
public void setupRequest(RadiusClient c, RadiusPacket p) throws RadiusException, NoSuchAlgorithmException
{
RadiusAttribute a;
client = c;
if (username == null)
{
a = p.findAttribute(AttributeDictionary.USER_NAME);
if (a == null)
throw new RadiusException("You must at least have a User-Name attribute in a Access-Request");
username = AttributeFactory.copyAttribute(a, false);
}
if (password == null)
{
a = p.findAttribute(AttributeDictionary.USER_PASSWORD);
if (a != null)
{
password = AttributeFactory.copyAttribute(a, false);
}
}
}
开发者ID:coova,项目名称:jradius,代码行数:32,代码来源:RadiusAuthenticator.java
示例13: handleRadiusException
import net.jradius.exception.RadiusException; //导入依赖的package包/类
protected int handleRadiusException(JRadiusRequest request, RadiusException e)
{
JRadiusSession session = request.getSession();
String error = e.getMessage();
RadiusLog.warn(error);
if (session != null)
{
try
{
session.getLogEntry(request).addMessage(error);
}
catch (RadiusException re)
{
RadiusLog.problem(request, session, re, re.getMessage());
}
// lets not remove the session and let it expire, or maybe
// this was a RADIUS retransmission that should simply be forgotten
//session.setSessionState(JRadiusSession.RADIUS_ERROR);
//sessionManager.removeSession(session);
}
return (e instanceof RadiusSecurityException) ? JRadiusServer.RLM_MODULE_REJECT : JRadiusServer.RLM_MODULE_FAIL;
}
开发者ID:coova,项目名称:jradius,代码行数:25,代码来源:RadiusProcessor.java
示例14: parse
import net.jradius.exception.RadiusException; //导入依赖的package包/类
/**
* Parse a UDP RADIUS message
* @param dp The Datagram to be parsed
* @return Returns the RadiusPacket
* @throws RadiusException
*/
public static RadiusPacket parse(DatagramPacket dp, boolean pool) throws RadiusException
{
ByteBuffer buffer = ByteBuffer.wrap(dp.getData(), dp.getOffset(), dp.getLength());
RadiusPacket rp = null;
try
{
rp = parseUDP(buffer, pool);
}
catch (IOException e)
{
RadiusLog.error(e.getMessage(), e);
}
return rp;
}
开发者ID:coova,项目名称:jradius,代码行数:23,代码来源:PacketFactory.java
示例15: attributeFromString
import net.jradius.exception.RadiusException; //导入依赖的package包/类
/**
* Parses a string to create a RadiusAttribute. Will either return the
* attribute, or throw an Exception.
* @param src The source String
* @return Returns the RadiusAttribute parsed from String
* @throws RadiusException
* @throws UnknownAttributeException
*/
public static RadiusAttribute attributeFromString(String src) throws RadiusException, UnknownAttributeException
{
String parts[] = src.split("=", 2);
if (parts.length == 2)
{
String attribute = parts[0].trim();
String value = parts[1].trim();
char q = value.charAt(0);
if (q == value.charAt(value.length() - 1) && (q == '\'' || q == '"'))
{
value = value.substring(1, value.length() - 1);
}
return newAttribute(attribute, value, "=");
}
throw new RadiusException("Syntax error for attributes: " + src);
}
开发者ID:coova,项目名称:jradius,代码行数:29,代码来源:AttributeFactory.java
示例16: getLogEntry
import net.jradius.exception.RadiusException; //导入依赖的package包/类
public JRadiusLogEntry getLogEntry(JRadiusRequest request) throws RadiusException
{
AttributeList ci = request.getConfigItems();
RadiusAttribute a = ci.get(Attr_JRadiusRequestId.TYPE);
String key;
if (a != null) key = (String)a.getValue().getValueObject();
else key = Integer.toString((char)request.getRequestPacket().getIdentifier());
JRadiusLogEntry entry = getLogEntry(request, key);
entry.setCode(new Integer(request.getReturnValue()));
return entry;
}
开发者ID:coova,项目名称:jradius,代码行数:14,代码来源:RadiusSession.java
示例17: onPostAuthentication
import net.jradius.exception.RadiusException; //导入依赖的package包/类
public void onPostAuthentication(JRadiusRequest request) throws RadiusException
{
RadiusPacket rep = request.getReplyPacket();
boolean success = (rep instanceof AccessAccept && request.getReturnValue() != JRadiusServer.RLM_MODULE_REJECT);
RadiusLog.debug("Authentication: " + request + " was" + (success ? "" : " NOT") + " sucessful");
if (success)
{
Long sessionTimeout = (Long)rep.getAttributeValue(Attr_SessionTimeout.TYPE);
if (checkSessionState(ACCT_STARTED))
{
if (sessionTimeout != null)
{
Long sessionTime = getSessionTime();
if (sessionTime != null)
{
// Compensate the sessionTimeout for re-authentications
sessionTimeout = new Long(sessionTimeout.longValue() - sessionTime.longValue());
}
}
}
else
{
setSessionState(AUTH_ACCEPTED);
}
setIdleTimeout((Long)rep.getAttributeValue(Attr_IdleTimeout.TYPE));
setInterimInterval((Long)rep.getAttributeValue(Attr_AcctInterimInterval.TYPE));
setSessionTimeout(sessionTimeout);
}
else
{
setSessionState(AUTH_REJECTED);
}
}
开发者ID:coova,项目名称:jradius,代码行数:34,代码来源:RadiusSession.java
示例18: ensureSessionState
import net.jradius.exception.RadiusException; //导入依赖的package包/类
public void ensureSessionState(JRadiusRequest request, int state) throws RadiusException
{
if (!checkSessionState(state))
{
// Remove any Proxy-To-Realm in the control items to prevent the proxy
request.getConfigItems().remove(Attr_ProxyToRealm.TYPE);
throw new RadiusSecurityException("Received unexpected packet for session: " + getSessionKey() + " (" + getSessionState() + " != " + state + ")");
}
}
开发者ID:coova,项目名称:jradius,代码行数:10,代码来源:RadiusSession.java
示例19: onNoAccountingStatusType
import net.jradius.exception.RadiusException; //导入依赖的package包/类
public boolean onNoAccountingStatusType(JRadiusRequest request) throws RadiusException
{
JRadiusLogEntry logEntry = getLogEntry(request);
String error = "Accounting packet without a Acct-Status-Type!";
RadiusLog.error(error);
logEntry.addMessage(error);
request.setReturnValue(JRadiusServer.RLM_MODULE_REJECT);
return true;
}
开发者ID:coova,项目名称:jradius,代码行数:10,代码来源:RadiusSession.java
示例20: getRequestSessionKey
import net.jradius.exception.RadiusException; //导入依赖的package包/类
/**
* Generates the session key for the given session. If the key is changing, as
* in the case when we move from authentication to accounting, this method will
* return an Object[2] which instructs the session manage to "rehash" the session
* under a new key (for uniqueness).
*
* @param request The JRadiusRequest
* @return the session key, or an array of 2 keys, the second replacing the first
* as the session hash key.
* @throws RadiusException
*/
public Serializable getRequestSessionKey(JRadiusRequest request) throws RadiusException
{
RadiusPacket req = request.getRequestPacket();
if (req == null)
{
return null;
}
else if (req instanceof AccessRequest)
{
return getAccessRequestKey(request);
}
else if (req instanceof DHCPPacket)
{
return getDHCPRequestKey(request);
}
else if (req instanceof AccountingRequest)
{
int type = request.getType();
int status = ((AccountingRequest)req).getAccountingStatusType();
Serializable key = getAccountingRequestKey(request);
if (type == JRadiusServer.JRADIUS_preacct &&
( status == AccountingRequest.ACCT_STATUS_START ||
status == AccountingRequest.ACCT_STATUS_ACCOUNTING_ON) )
{
// rekey the request during pre-accounting
return new Serializable[] { getAccessRequestKey(request), key };
}
return key;
}
return null;
}
开发者ID:coova,项目名称:jradius,代码行数:48,代码来源:RadiusSessionKeyProvider.java
注:本文中的net.jradius.exception.RadiusException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论