Search in sources :

Example 1 with PacketType

use of org.forgerock.openam.radius.common.PacketType in project OpenAM by OpenRock.

the class RadiusAuditLoggerEventBus method setRequestDetails.

private void setRequestDetails(AMAccessAuditEventBuilder builder, AcceptedRadiusEvent accessRequestEvent) {
    LOG.message("Entering RadiusAuditLoggerEventBus.setRequestDetails()");
    RadiusRequest request = accessRequestEvent.getRequest();
    if (request != null) {
        Packet packet = request.getRequestPacket();
        if (packet != null) {
            PacketType packetType = packet.getType();
            Short packetId = packet.getIdentifier();
            if (packetType != null && packetId != null) {
                String operationName = packetType.toString();
                JsonValue requestId = json(object(field("radiusId", packetId)));
                builder.request("RADIUS", operationName, requestId);
            }
        }
    }
    LOG.message("Leaving RadiusAuditLoggerEventBus.setRequestDetails()");
}
Also used : Packet(org.forgerock.openam.radius.common.Packet) PacketType(org.forgerock.openam.radius.common.PacketType) JsonValue(org.forgerock.json.JsonValue) RadiusRequest(org.forgerock.openam.radius.server.RadiusRequest)

Example 2 with PacketType

use of org.forgerock.openam.radius.common.PacketType in project OpenAM by OpenRock.

the class RadiusAuditLoggerEventBus method setResponseDetails.

/**
     * Sets the response details of the builder, using the details provided in the <code>RadiusResponse</code>.
     *
     * @param builder
     * @param response
     */
private void setResponseDetails(AMAccessAuditEventBuilder builder, RadiusResponse response) {
    LOG.message("Entering RadiusAuditLoggerEventBus.setResponseDetails()");
    ResponseStatus responseStatus = null;
    PacketType packetType = response.getResponsePacket().getType();
    if ((packetType == PacketType.ACCESS_ACCEPT) || (packetType == PacketType.ACCESS_CHALLENGE)) {
        responseStatus = ResponseStatus.SUCCESSFUL;
    } else if (packetType == PacketType.ACCESS_REJECT) {
        responseStatus = ResponseStatus.FAILED;
    } else {
        LOG.warning("Unexpected packet type in RadiusAuditLoggerEventBus.setResponseDetails()");
    }
    builder.response(responseStatus, packetType.toString(), response.getTimeToServiceRequestInMilliSeconds(), TimeUnit.MILLISECONDS);
    LOG.message("Leaving RadiusAuditLoggerEventBus.setResponseDetails()");
}
Also used : ResponseStatus(org.forgerock.audit.events.AccessAuditEventBuilder.ResponseStatus) PacketType(org.forgerock.openam.radius.common.PacketType)

Aggregations

PacketType (org.forgerock.openam.radius.common.PacketType)2 ResponseStatus (org.forgerock.audit.events.AccessAuditEventBuilder.ResponseStatus)1 JsonValue (org.forgerock.json.JsonValue)1 Packet (org.forgerock.openam.radius.common.Packet)1 RadiusRequest (org.forgerock.openam.radius.server.RadiusRequest)1