Skip to content

Commit

Permalink
improving / fixing comments and var names
Browse files Browse the repository at this point in the history
  • Loading branch information
himran92 committed Dec 6, 2024
1 parent c9cf0d9 commit c4af8fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions saml/response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand All @@ -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,
},
Expand All @@ -111,31 +111,31 @@ 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",
},
{
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",
},
{
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",
},
{
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",
Expand Down
4 changes: 2 additions & 2 deletions saml/test/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit c4af8fc

Please sign in to comment.