mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
ea9b408b70
* Remove unused mongo docker-compose file. * Default redirection URL was not taken into account. * Fix possible storage options in config template. * Remove useless checks in u2f registration endpoints. * Add default redirection url in config of duo suite. * Fix log line in response handler of 2FA methods. * Fix integration tests. Co-authored-by: Amir Zarrinkafsh <nightah@me.com>
29 lines
764 B
Go
29 lines
764 B
Go
package handlers
|
|
|
|
import (
|
|
"crypto/elliptic"
|
|
|
|
"github.com/tstranex/u2f"
|
|
)
|
|
|
|
type U2FVerifier interface {
|
|
Verify(keyHandle []byte, publicKey []byte, signResponse u2f.SignResponse, challenge u2f.Challenge) error
|
|
}
|
|
|
|
type U2FVerifierImpl struct{}
|
|
|
|
func (uv *U2FVerifierImpl) Verify(keyHandle []byte, publicKey []byte,
|
|
signResponse u2f.SignResponse, challenge u2f.Challenge) error {
|
|
var registration u2f.Registration
|
|
registration.KeyHandle = keyHandle
|
|
x, y := elliptic.Unmarshal(elliptic.P256(), publicKey)
|
|
registration.PubKey.Curve = elliptic.P256()
|
|
registration.PubKey.X = x
|
|
registration.PubKey.Y = y
|
|
|
|
// TODO(c.michaud): store the counter to help detecting cloned U2F keys.
|
|
_, err := registration.Authenticate(
|
|
signResponse, challenge, 0)
|
|
return err
|
|
}
|