From c4af8fc09c6eb91ba63260693229cefe1ae93a9c Mon Sep 17 00:00:00 2001 From: Hafsa Imran Date: Fri, 6 Dec 2024 17:33:27 -0500 Subject: [PATCH] improving / fixing comments and var names --- saml/response_test.go | 16 ++++++++-------- saml/test/provider.go | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/saml/response_test.go b/saml/response_test.go index c45b693..0818690 100644 --- a/saml/response_test.go +++ b/saml/response_test.go @@ -68,14 +68,14 @@ func TestServiceProvider_ParseResponse(t *testing.T) { { name: "success - with just response signed", sp: testSp, - samlResp: base64.StdEncoding.EncodeToString([]byte(tp.SamlResponse(t, testprovider.WithJustResponseElemSigned()))), + samlResp: base64.StdEncoding.EncodeToString([]byte(tp.SamlResponse(t, testprovider.WithJustResponseSigned()))), opts: []saml.Option{}, requestID: testRequestId, }, { name: "success - with just assertion signed", sp: testSp, - samlResp: base64.StdEncoding.EncodeToString([]byte(tp.SamlResponse(t, testprovider.WithJustAssertionElemSigned()))), + samlResp: base64.StdEncoding.EncodeToString([]byte(tp.SamlResponse(t, testprovider.WithJustAssertionSigned()))), opts: []saml.Option{}, requestID: testRequestId, }, @@ -89,14 +89,14 @@ func TestServiceProvider_ParseResponse(t *testing.T) { { name: "success - with option validate response signature and with only response signed", sp: testSp, - samlResp: base64.StdEncoding.EncodeToString([]byte(tp.SamlResponse(t, testprovider.WithJustResponseElemSigned()))), + samlResp: base64.StdEncoding.EncodeToString([]byte(tp.SamlResponse(t, testprovider.WithJustResponseSigned()))), opts: []saml.Option{saml.ValidateResponseSignature()}, requestID: testRequestId, }, { name: "success - with option validate assertion signature and with only assertion signed", sp: testSp, - samlResp: base64.StdEncoding.EncodeToString([]byte(tp.SamlResponse(t, testprovider.WithJustAssertionElemSigned()))), + samlResp: base64.StdEncoding.EncodeToString([]byte(tp.SamlResponse(t, testprovider.WithJustAssertionSigned()))), opts: []saml.Option{saml.ValidateAssertionSignature()}, requestID: testRequestId, }, @@ -111,7 +111,7 @@ func TestServiceProvider_ParseResponse(t *testing.T) { { name: "error-invalid-signature - with option validate both signatures and with just response signed", sp: testSp, - samlResp: base64.StdEncoding.EncodeToString([]byte(tp.SamlResponse(t, testprovider.WithJustResponseElemSigned()))), + samlResp: base64.StdEncoding.EncodeToString([]byte(tp.SamlResponse(t, testprovider.WithJustResponseSigned()))), opts: []saml.Option{saml.ValidateResponseAndAssertionSignatures()}, requestID: testRequestId, wantErrContains: "invalid signature", @@ -119,7 +119,7 @@ func TestServiceProvider_ParseResponse(t *testing.T) { { name: "error-invalid-signature - with option validate both signatures and with just assertion signed", sp: testSp, - samlResp: base64.StdEncoding.EncodeToString([]byte(tp.SamlResponse(t, testprovider.WithJustAssertionElemSigned()))), + samlResp: base64.StdEncoding.EncodeToString([]byte(tp.SamlResponse(t, testprovider.WithJustAssertionSigned()))), opts: []saml.Option{saml.ValidateResponseAndAssertionSignatures()}, requestID: testRequestId, wantErrContains: "invalid signature", @@ -127,7 +127,7 @@ func TestServiceProvider_ParseResponse(t *testing.T) { { name: "error-invalid-signature - with option validate response signature and with just assertion signed", sp: testSp, - samlResp: base64.StdEncoding.EncodeToString([]byte(tp.SamlResponse(t, testprovider.WithJustAssertionElemSigned()))), + samlResp: base64.StdEncoding.EncodeToString([]byte(tp.SamlResponse(t, testprovider.WithJustAssertionSigned()))), opts: []saml.Option{saml.ValidateResponseSignature()}, requestID: testRequestId, wantErrContains: "invalid signature", @@ -135,7 +135,7 @@ func TestServiceProvider_ParseResponse(t *testing.T) { { name: "error-invalid-signature -with option validate assertion signature and with just response signed", sp: testSp, - samlResp: base64.StdEncoding.EncodeToString([]byte(tp.SamlResponse(t, testprovider.WithJustResponseElemSigned()))), + samlResp: base64.StdEncoding.EncodeToString([]byte(tp.SamlResponse(t, testprovider.WithJustResponseSigned()))), opts: []saml.Option{saml.ValidateAssertionSignature()}, requestID: testRequestId, wantErrContains: "invalid signature", diff --git a/saml/test/provider.go b/saml/test/provider.go index 9b8a35d..453f344 100644 --- a/saml/test/provider.go +++ b/saml/test/provider.go @@ -458,13 +458,13 @@ func WithResponseAndAssertionSigned() ResponseOption { } } -func WithJustAssertionElemSigned() ResponseOption { +func WithJustAssertionSigned() ResponseOption { return func(o *responseOptions) { o.signAssertionElem = true } } -func WithJustResponseElemSigned() ResponseOption { +func WithJustResponseSigned() ResponseOption { return func(o *responseOptions) { o.signResponseElem = true }