use of org.forgerock.openam.radius.common.Attribute in project OpenAM by OpenRock.
the class RadiusRequest method loadAttsMap.
/**
* Loads the attributes into a map. warning: this is lossy for atts that support duplicates like proxyState. but we
* aren't using those for authentication but only need State, UserName, and UserPassword. So we are good.
*/
private void loadAttsMap() {
final AttributeSet atts = requestPacket.getAttributeSet();
for (int i = 0; i < atts.size(); i++) {
final Attribute att = atts.getAttributeAt(i);
// warning: this is lossy for atts that support duplicates like proxyState. but we aren't using those
// for authentication but only need State, UserName, and UserPassword. So we are good.
attributeMap.put(att.getClass(), att);
}
}
use of org.forgerock.openam.radius.common.Attribute in project OpenAM by OpenRock.
the class RadiusRequestContext method getPacketRepresentation.
/**
* Formats a textual representation of the contents of a packet.
*
* @param pkt
* the packet whose content is to be logged in human read-able form.
* @return The packet's contents in human read-able form.
*/
public static String getPacketRepresentation(Packet pkt) {
final StringWriter sw = new StringWriter();
final PrintWriter pw = new PrintWriter(sw);
String packetType = null;
final Class clazz = pkt.getClass();
if (clazz == AccessRequest.class) {
packetType = "ACCESS_REQUEST";
} else if (clazz == AccessReject.class) {
packetType = "ACCESS_REJECT";
} else if (clazz == AccessAccept.class) {
packetType = "ACCESS_ACCEPT";
} else if (clazz == AccessChallenge.class) {
packetType = "ACCESS_CHALLENGE";
} else {
packetType = pkt.getClass().getSimpleName();
}
pw.println(" " + packetType + " [" + pkt.getIdentifier() + "]");
final AttributeSet atts = pkt.getAttributeSet();
for (int i = 0; i < atts.size(); i++) {
final Attribute a = atts.getAttributeAt(i);
pw.println(" - " + a);
}
pw.flush();
return sw.toString();
}
Aggregations