本文整理了Java中net.jradius.packet.attribute.AttributeList
类的一些代码示例,展示了AttributeList
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AttributeList
类的具体详情如下:
包路径:net.jradius.packet.attribute.AttributeList
类名称:AttributeList
[英]Represents the Attribute List of a packet. Supports singleton and lists of attribute values (building packets with several of the same attribute).
[中]表示数据包的属性列表。支持单例和属性值列表(使用多个相同属性构建数据包)。
代码示例来源:origin: OpenNMS/opennms
@Override
public CompositeAttributeLists getRequest() {
final AttributeList attributes = new AttributeList();
attributes.add(new Attr_UserName(user));
attributes.add(new Attr_NASIdentifier(nasID));
attributes.add(new Attr_UserPassword(password));
return new CompositeAttributeLists(attributes);
}
代码示例来源:origin: coova/jradius
public static void recycle(AttributeList list)
{
synchronized (list)
{
for (RadiusAttribute a : list.getAttributeList())
{
recycle(a);
}
}
// poolStatus();
}
}
代码示例来源:origin: net.jradius/jradius-core
/**
* @param type The attribute type
* @return Returns the attribute, if found
*/
public RadiusAttribute findAttribute(long type)
{
return attributes.get(type);
}
代码示例来源:origin: coova/jradius
@Override
public void copy(AttributeValue value)
{
TLVValue tlvValue = (TLVValue) value;
list.clear();
list.add(tlvValue.list);
}
代码示例来源:origin: net.jradius/jradius-core
/**
* Removes all unknown (not in the configured JRadius Dictionary) attribtues.
*/
public void removeUnknown()
{
List<RadiusAttribute> list = getAttributeList();
for (RadiusAttribute a : list)
{
if (a instanceof UnknownAttribute)
{
remove(a);
}
}
}
代码示例来源:origin: coova/jradius
public void copy(AttributeList list, boolean pool)
{
if (list != null)
{
for (RadiusAttribute a : list.getAttributeList())
{
_add(AttributeFactory.copyAttribute(a, pool), false);
}
}
}
代码示例来源:origin: OpenNMS/opennms
AttributeList attributeList = new AttributeList();
attributeList.add(new Attr_UserName(username));
attributeList.add(new Attr_UserPassword(password));
RadiusPacket reply;
try {
final AccessRequest request = new AccessRequest(radiusClient, attributeList);
LOG.debug("Sending AccessRequest message to {}:{} using {} protocol with timeout = {}, retries = {}, attributes:\n{}", InetAddressUtils.str(serverIP), port, authenticator.getAuthName(), timeout, retries, attributeList.toString());
reply = radiusClient.authenticate(request, authenticator, retries);
} catch (RadiusException e) {
"AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"));
LOG.debug("Received AccessAccept message from {}:{} for user {} with attributes:\n{}", InetAddressUtils.str(serverIP), port, username, reply.getAttributes().toString());
roles = new String(defaultRoles);
} else {
Iterator<RadiusAttribute> attributes = reply.getAttributes().getAttributeList().iterator();
while (attributes.hasNext()) {
RadiusAttribute attribute = attributes.next();
代码示例来源:origin: org.jasig.cas/cas-server-support-radius
@Override
public RadiusResponse authenticate(final String username, final String password) throws PreventedException {
final AttributeList attributeList = new AttributeList();
attributeList.add(new Attr_UserName(username));
attributeList.add(new Attr_UserPassword(password));
attributeList.add(new Attr_NASIPAddress(this.nasIpAddress));
attributeList.add(new Attr_NASIPv6Address(this.nasIpv6Address));
attributeList.add(new Attr_NASIdentifier(this.nasIdentifier));
attributeList.add(new Attr_NASPort(this.nasPort));
attributeList.add(new Attr_NASPortId(this.nasPortId));
attributeList.add(new Attr_NASRealPort(this.nasRealPort));
attributeList.add(new Attr_NASPortType(this.nasPortType));
acceptedResponse.getAttributes().getAttributeList());
代码示例来源:origin: net.jradius/jradius-core
public DHCPNack(AttributeList attributes)
{
code = CODE;
this.attributes.add(attributes);
}
}
代码示例来源:origin: net.jradius/jradius-extended
for (Iterator i=attrs.getAttributeList().iterator(); i.hasNext();)
type == Attr_NASPortType.TYPE ||
type == Attr_NASPort.TYPE)
reqList.add(AttributeFactory.newAttribute(type, at.getValue().getBytes(), false));
reqList.add(new Attr_UserName(userName));
reqList.add(new Attr_AcctSessionId(RadiusRandom.getRandomString(16)));
代码示例来源:origin: net.jradius/jradius-core
/**
* @param type The type of the attribute
* @param value The value of the attribute
* @return Returns the newly created AttributeList
*/
public static AttributeList newAttributeList(long type, byte[] value, boolean pool)
{
AttributeList list = new AttributeList();
addToAttributeList(list, type, value, pool);
return list;
}
代码示例来源:origin: net.jradius/jradius-extended
public static void addAccessAcceptAttribtues(JRadiusSession session, AttributeList attrs)
{
String s;
Long i;
if ((s = session.getUsername()) != null)
{
attrs.remove(Attr_UserName.TYPE);
attrs.add(new Attr_UserName(s));
}
if ((i = session.getSessionTimeout()) != null)
{
attrs.remove(Attr_SessionTimeout.TYPE);
attrs.add(new Attr_SessionTimeout(i));
}
if ((i = session.getIdleTimeout()) != null && i.longValue() > 0)
{
attrs.remove(Attr_IdleTimeout.TYPE);
attrs.add(new Attr_IdleTimeout(i));
}
if ((i = session.getInterimInterval()) != null && i.longValue() > 0)
{
attrs.remove(Attr_AcctInterimInterval.TYPE);
attrs.add(new Attr_AcctInterimInterval(i));
}
}
}
代码示例来源:origin: coova/jradius
AttributeList attributes = new AttributeList();
active = loadAttributes(attributes, in);
if (attributes.getSize() == 0) continue;
Long status;
if ((attr = attributes.get(AttributeDictionary.ACCT_STATUS_TYPE)) != null &&
(status = (Long)attr.getValue().getValueObject()) != null &&
status.intValue() <= 3)
代码示例来源:origin: com.hynnet/jradius-extended
/**
* @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();
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);
tunnelAuth.processRequest(tunnelRequest);
}
代码示例来源:origin: net.jradius/jradius-core
@Override
public void setValue(byte[] b) {
list.clear();
if (b != null && b.length > 0)
{
ByteBuffer bb = ByteBuffer.wrap(b);
format.unpackAttributes(list, bb, bb.limit(), false);
}
}
代码示例来源:origin: coova/jradius
/**
* Removes an attribute
* @param attribute The RadiusAttribute to be removed
*/
public void removeAttribute(RadiusAttribute attribute)
{
attributes.remove(attribute);
}
代码示例来源:origin: net.jradius/jradius-core
public String toString()
{
return toString(true, true);
}
代码示例来源:origin: org.apereo.cas/cas-server-support-radius-core
@Override
public final CasRadiusResponse authenticate(final String username, final String password, final Optional state) throws Exception {
val attributeList = new AttributeList();
attributeList.add(new Attr_UserName(username));
attributeList.add(new Attr_UserPassword(password));
val clientIpAttribute = new Attr_ClientIPAddress(clientIpAddress);
LOGGER.debug("Adding client IP address attribute [{}]", clientIpAttribute);
attributeList.add(clientIpAttribute);
state.ifPresent(value -> attributeList.add(new Attr_State(Serializable.class.cast(value))));
attributeList.add(new Attr_NASIPAddress(this.nasIpAddress));
attributeList.add(new Attr_NASIPv6Address(this.nasIpv6Address));
attributeList.add(new Attr_NASPort(this.nasPort));
attributeList.add(new Attr_NASPortId(this.nasPortId));
attributeList.add(new Attr_NASIdentifier(this.nasIdentifier));
attributeList.add(new Attr_NASRealPort(this.nasRealPort));
attributeList.add(new Attr_NASPortType(this.nasPortType));
val attributes = response.getAttributes().getAttributeList();
LOGGER.debug("Radius response code [{}] accepted with attributes [{}] and identifier [{}]", response.getCode(), attributes, response.getIdentifier());
代码示例来源:origin: coova/jradius
/**
* Add an attribute, defaulting to overwriting
*
* @param a The attribute to add
*/
public void add(RadiusAttribute a)
{
add(a, true);
}
代码示例来源:origin: com.hynnet/jradius-extended
for (Iterator i=attrs.getAttributeList().iterator(); i.hasNext();)
type == Attr_NASPortType.TYPE ||
type == Attr_NASPort.TYPE)
reqList.add(AttributeFactory.newAttribute(type, at.getValue().getBytes(), false));
reqList.add(new Attr_UserName(userName));
reqList.add(new Attr_AcctSessionId(RadiusRandom.getRandomString(16)));
内容来源于网络,如有侵权,请联系作者删除!