Files
authentik/internal/outpost/radius/eap/protocol/mschapv2/auth.go
Jens Langhammer fad18db70b more mschap v2, start peap extension type 33
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2025-07-01 22:43:02 +02:00

27 lines
659 B
Go

package mschapv2
import (
"bytes"
"errors"
"layeh.com/radius/rfc2759"
)
func (p *Payload) checkChapPassword(res *Response) ([]byte, error) {
byteUser := []byte("foo")
bytePwd := []byte("bar")
ntResponse, err := rfc2759.GenerateNTResponse(p.st.Challenge, p.st.PeerChallenge, byteUser, bytePwd)
if err != nil {
return nil, err
}
if !bytes.Equal(ntResponse, res.NTResponse) {
return nil, errors.New("nt response mismatch")
}
authenticatorResponse, err := rfc2759.GenerateAuthenticatorResponse(p.st.Challenge, p.st.PeerChallenge, ntResponse, byteUser, bytePwd)
if err != nil {
return nil, err
}
return []byte(authenticatorResponse), nil
}