more mschap v2, start peap extension type 33
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
26
internal/outpost/radius/eap/protocol/mschapv2/auth.go
Normal file
26
internal/outpost/radius/eap/protocol/mschapv2/auth.go
Normal file
@ -0,0 +1,26 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user