Interface RadiusResponse
- All Superinterfaces:
AttributeHolder<RadiusResponse>
,NestedAttributeHolder<RadiusResponse>
,RadiusPacket<RadiusResponse>
- All Known Implementing Classes:
AccessResponse
,AccessResponse.Accept
,AccessResponse.Challenge
,AccessResponse.Reject
,GenericResponse
public interface RadiusResponse extends RadiusPacket<RadiusResponse>
-
Field Summary
Fields inherited from interface org.tinyradius.core.packet.RadiusPacket
HEADER_LENGTH, MAX_PACKET_LENGTH, packetLogger
-
Method Summary
Modifier and Type Method Description static RadiusResponse
create(Dictionary dictionary, byte type, byte identifier, byte[] authenticator, java.util.List<RadiusAttribute> attributes)
Creates a RadiusPacket object.RadiusResponse
decodeResponse(java.lang.String sharedSecret, byte[] requestAuth)
Decodes the response against the supplied shared secret and request authenticator.RadiusResponse
encodeResponse(java.lang.String sharedSecret, byte[] requestAuth)
Encode and generate authenticator.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, filterAttributes, filterAttributes, filterAttributes, getAttribute, getAttribute, getAttributeBytes, getChildVendorId, removeAttributes, removeLastAttribute, withAttributes
Methods inherited from interface org.tinyradius.core.attribute.NestedAttributeHolder
addAttribute, filterAttributes, filterAttributes, getAttribute, getFlattenedAttributes, getVendorAttributes, removeAttribute, removeAttributes
Methods inherited from interface org.tinyradius.core.packet.RadiusPacket
genHashedAuth, getAttributes, getAuthenticator, getDictionary, getId, getType, toDatagram, toDatagram, verifyPacketAuth
-
Method Details
-
create
static RadiusResponse create(Dictionary dictionary, byte type, byte identifier, byte[] authenticator, java.util.List<RadiusAttribute> attributes)Creates a RadiusPacket object. Depending on the passed type, an appropriate packet is created. Also sets the type, and the the packet identifier.- Parameters:
dictionary
- custom dictionary to usetype
- packet typeidentifier
- packet identifierauthenticator
- authenticator for packet, nullableattributes
- list of attributes for packet- Returns:
- RadiusPacket object
-
fromDatagram
static RadiusResponse fromDatagram(Dictionary dictionary, io.netty.channel.socket.DatagramPacket datagram) throws RadiusPacketExceptionReads 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
-
encodeResponse
RadiusResponse encodeResponse(java.lang.String sharedSecret, byte[] requestAuth) throws RadiusPacketExceptionEncode 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
RadiusResponse decodeResponse(java.lang.String sharedSecret, byte[] requestAuth) throws RadiusPacketExceptionDecodes 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
-