当前位置: 首页>>代码示例>>Java>>正文


Java RadiusAttribute.setValue方法代码示例

本文整理汇总了Java中net.jradius.packet.attribute.RadiusAttribute.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java RadiusAttribute.setValue方法的具体用法?Java RadiusAttribute.setValue怎么用?Java RadiusAttribute.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.jradius.packet.attribute.RadiusAttribute的用法示例。


在下文中一共展示了RadiusAttribute.setValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processRequest

import net.jradius.packet.attribute.RadiusAttribute; //导入方法依赖的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

示例2: processRequest

import net.jradius.packet.attribute.RadiusAttribute; //导入方法依赖的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

示例3: verifyRequest

import net.jradius.packet.attribute.RadiusAttribute; //导入方法依赖的package包/类
public static Boolean verifyRequest(RadiusPacket request, String sharedSecret) throws IOException, InvalidKeyException, NoSuchAlgorithmException
{
    byte[] hash = new byte[16];
    ByteBuffer buffer = ByteBuffer.allocate(4096);

    RadiusAttribute attr = request.findAttribute(AttributeDictionary.MESSAGE_AUTHENTICATOR);
    if (attr == null) return null;
    
    byte[] pval = attr.getValue().getBytes();
    attr.setValue(hash);
    
    format.packPacket(request, sharedSecret, buffer, true);
    System.arraycopy(MD5.hmac_md5(buffer.array(), 0, buffer.position(), sharedSecret.getBytes()), 0, hash, 0, 16);

    attr.setValue(pval);
    
    return new Boolean(Arrays.equals(pval, hash));
}
 
开发者ID:coova,项目名称:jradius,代码行数:19,代码来源:MessageAuthenticator.java

示例4: processRequest

import net.jradius.packet.attribute.RadiusAttribute; //导入方法依赖的package包/类
public void processRequest(RadiusPacket p) throws RadiusException
{
	if (password == null) throw new RadiusException("no password given");

	p.removeAttribute(password);
    
    RadiusAttribute attr;
    p.addAttribute(attr = AttributeFactory.newAttribute("User-Password"));
    attr.setValue(RadiusUtils.encodePapPassword(
			password.getValue().getBytes(), 
         // Create an authenticator (AccessRequest just needs shared secret)
			p.createAuthenticator(null, 0, 0, client.getSharedSecret()), 
         client.getSharedSecret()));
}
 
开发者ID:coova,项目名称:jradius,代码行数:15,代码来源:PAPAuthenticator.java

示例5: processRequest

import net.jradius.packet.attribute.RadiusAttribute; //导入方法依赖的package包/类
public void processRequest(RadiusPacket p) throws RadiusException, NoSuchAlgorithmException
{
    if (password == null) throw new RadiusException("Password required");
    p.removeAttribute(password);
    
    RadiusAttribute attr;
    byte authChallenge[] = RadiusRandom.getBytes(16);
    byte chapResponse[] = MSCHAP.doMSCHAPv2(username.getValue().getBytes(), password.getValue().getBytes(), authChallenge);

    p.addAttribute(attr = AttributeFactory.newAttribute("MS-CHAP-Challenge"));
    attr.setValue(authChallenge);
    
    p.addAttribute(attr = AttributeFactory.newAttribute("MS-CHAP2-Response"));
    attr.setValue(chapResponse);
}
 
开发者ID:coova,项目名称:jradius,代码行数:16,代码来源:MSCHAPv2Authenticator.java

示例6: verifyReply

import net.jradius.packet.attribute.RadiusAttribute; //导入方法依赖的package包/类
public static Boolean verifyReply(byte[] requestAuth, RadiusPacket reply, String sharedSecret) throws IOException, InvalidKeyException, NoSuchAlgorithmException
{
    byte[] replyAuth = reply.getAuthenticator();
    byte[] hash = new byte[16];

    ByteBuffer buffer = ByteBuffer.allocate(4096);

    RadiusAttribute attr = reply.findAttribute(AttributeDictionary.MESSAGE_AUTHENTICATOR);
    if (attr == null) return null;
    
    byte[] pval = attr.getValue().getBytes();
    attr.setValue(hash);
    
    reply.setAuthenticator(requestAuth);

    format.packPacket(reply, sharedSecret, buffer, true);
    System.arraycopy(MD5.hmac_md5(buffer.array(), 0, buffer.position(), sharedSecret.getBytes()), 0, hash, 0, 16);

    reply.setAuthenticator(replyAuth);
    
    return new Boolean(Arrays.equals(pval, hash));
}
 
开发者ID:coova,项目名称:jradius,代码行数:23,代码来源:MessageAuthenticator.java


注:本文中的net.jradius.packet.attribute.RadiusAttribute.setValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。