Interface RadiusResponse
- All Superinterfaces:
AttributeHolder<RadiusResponse>
,NestedAttributeHolder<RadiusResponse>
,RadiusPacket<RadiusResponse>
- All Known Implementing Classes:
AccessResponse
,AccessResponse.Accept
,AccessResponse.Challenge
,AccessResponse.Reject
,GenericResponse
-
Field Summary
Fields inherited from interface org.tinyradius.core.attribute.AttributeHolder
attrHolderLogger
Fields inherited from interface org.tinyradius.core.packet.RadiusPacket
HEADER_LENGTH, MAX_PACKET_LENGTH
-
Method Summary
Modifier and TypeMethodDescriptionstatic RadiusResponse
create
(Dictionary dictionary, byte type, byte id, byte[] authenticator, List<RadiusAttribute> attributes) Creates a RadiusPacket object.static RadiusResponse
create
(Dictionary dictionary, io.netty.buffer.ByteBuf header, List<RadiusAttribute> attributes) decodeResponse
(String sharedSecret, byte[] requestAuth) Decodes the response against the supplied shared secret and request authenticator.encodeResponse
(String sharedSecret, byte[] requestAuth) Encode and generate authenticator.static RadiusResponse
fromByteBuf
(Dictionary dictionary, io.netty.buffer.ByteBuf byteBuf) Reads a response from the given input stream and creates an appropriate RadiusPacket/subclass.static RadiusResponse
fromDatagram
(Dictionary dictionary, io.netty.channel.socket.DatagramPacket datagram) Reads a response from the given input stream and creates an appropriate RadiusPacket/subclass.Methods inherited from interface org.tinyradius.core.attribute.AttributeHolder
addAttribute, addAttribute, decodeAttributes, encodeAttributes, getAttribute, getAttribute, getAttributeByteBuf, getAttributes, getAttributes, getAttributes, getAttributes, getChildVendorId, getDictionary, removeAttributes, removeLastAttribute, withAttributes
Methods inherited from interface org.tinyradius.core.attribute.NestedAttributeHolder
addAttribute, getAttribute, getAttributes, getAttributes, getFlattenedAttributes, getVendorAttributes, removeAttribute, removeAttributes
Methods inherited from interface org.tinyradius.core.packet.RadiusPacket
genHashedAuth, getAuthenticator, getHeader, getId, getLength, getType, toByteBuf, toByteBuffer, toBytes
-
Method Details
-
create
static RadiusResponse create(Dictionary dictionary, io.netty.buffer.ByteBuf header, List<RadiusAttribute> attributes) throws RadiusPacketException - Throws:
RadiusPacketException
-
create
static RadiusResponse create(Dictionary dictionary, byte type, byte id, byte[] authenticator, List<RadiusAttribute> attributes) throws RadiusPacketException Creates a RadiusPacket object. Depending on the passed type, an appropriate packet is created. Also sets the type, and the the packet id.- Parameters:
dictionary
- custom dictionary to usetype
- packet typeid
- packet idauthenticator
- authenticator for packet, nullableattributes
- list of attributes for packet- Returns:
- RadiusPacket object
- Throws:
RadiusPacketException
- packet validation exceptions
-
fromDatagram
static RadiusResponse fromDatagram(Dictionary dictionary, io.netty.channel.socket.DatagramPacket datagram) throws RadiusPacketException Reads a response from the given input stream and creates an appropriate RadiusPacket/subclass.Decodes the encrypted fields and attributes of the packet, and checks authenticator if appropriate.
- Parameters:
dictionary
- dictionary to use for attributesdatagram
- DatagramPacket to read packet from- Returns:
- new RadiusPacket object
- Throws:
RadiusPacketException
- malformed packet
-
fromByteBuf
static RadiusResponse fromByteBuf(Dictionary dictionary, io.netty.buffer.ByteBuf byteBuf) throws RadiusPacketException Reads a response from the given input stream and creates an appropriate RadiusPacket/subclass.Decodes the encrypted fields and attributes of the packet, and checks authenticator if appropriate.
- Parameters:
dictionary
- dictionary to use for attributesbyteBuf
- byteBuf to read packet from- Returns:
- new RadiusPacket object
- Throws:
RadiusPacketException
- malformed packet
-
encodeResponse
Encode and generate authenticator.Requires request authenticator to generate response authenticator.
Must be idempotent.
- Parameters:
sharedSecret
- shared secret to be used to encode this packetrequestAuth
- request packet authenticator- Returns:
- new RadiusPacket instance with same properties and valid authenticator
- Throws:
RadiusPacketException
- errors encoding packet
-
decodeResponse
Decodes the response against the supplied shared secret and request authenticator.Must be idempotent.
- Parameters:
sharedSecret
- shared secretrequestAuth
- authenticator for corresponding request- Returns:
- verified RadiusResponse with decoded attributes if appropriate
- Throws:
RadiusPacketException
- errors verifying or decoding packet
-