fix: rp verification process (#95)
* fix: rp verification process * types * comments * fix cli client
This commit is contained in:
parent
400f5c4de4
commit
850faa159d
11 changed files with 175 additions and 55 deletions
10
pkg/op/op.go
10
pkg/op/op.go
|
@ -272,20 +272,16 @@ type openIDKeySet struct {
|
|||
//VerifySignature implements the oidc.KeySet interface
|
||||
//providing an implementation for the keys stored in the OP Storage interface
|
||||
func (o *openIDKeySet) VerifySignature(ctx context.Context, jws *jose.JSONWebSignature) ([]byte, error) {
|
||||
keyID := ""
|
||||
for _, sig := range jws.Signatures {
|
||||
keyID = sig.Header.KeyID
|
||||
break
|
||||
}
|
||||
keySet, err := o.Storage.GetKeySet(ctx)
|
||||
if err != nil {
|
||||
return nil, errors.New("error fetching keys")
|
||||
}
|
||||
payload, err, ok := oidc.CheckKey(keyID, jws, keySet.Keys...)
|
||||
keyID, alg := oidc.GetKeyIDAndAlg(jws)
|
||||
key, ok := oidc.FindKey(keyID, oidc.KeyUseSignature, alg, keySet.Keys...)
|
||||
if !ok {
|
||||
return nil, errors.New("invalid kid")
|
||||
}
|
||||
return payload, err
|
||||
return jws.Verify(key)
|
||||
}
|
||||
|
||||
type Option func(o *openidProvider) error
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue