encode extension AVPs

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer
2025-05-24 01:46:33 +02:00
parent fad18db70b
commit fb01a117ad
5 changed files with 25 additions and 6 deletions

View File

@ -124,7 +124,16 @@ func (p *Payload) Handle(ctx protocol.Context) protocol.Payload {
if err != nil {
ctx.Log().WithError(err).Warning("PEAP: failed to handle inner EAP")
}
return &Payload{eap: res.(*eap.Payload)}
// Normal payloads need to be wrapped in PEAP to use the correct encoding (see Encode() above)
// Extension payloads handle encoding differently
pres := res.(*eap.Payload)
if _, ok := pres.Payload.(*ExtensionPayload); ok {
// HandleInnerEAP will set the MsgType to the PEAP type, however we need to override that
pres.MsgType = TypePEAPExtension
ctx.Log().Debug("PEAP: Encoding response as extension")
return res
}
return &Payload{eap: pres}
}
func (p *Payload) GetEAPSettings() protocol.Settings {