Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove go 1.17, add go 1.20 to tests; remove version specific tests #506

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.17.x', '1.18.x', '1.19.x']
go: [ '1.18.x', '1.19.x', '1.20.x']
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
Expand Down
57 changes: 0 additions & 57 deletions identity_provider_go116_test.go

This file was deleted.

57 changes: 0 additions & 57 deletions identity_provider_go117_test.go

This file was deleted.

42 changes: 42 additions & 0 deletions identity_provider_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package saml

import (
"bytes"
"compress/flate"
"crypto"
"crypto/rsa"
"crypto/x509"
"encoding/base64"
"encoding/pem"
"encoding/xml"
"fmt"
"io"
"math/rand"
"net/http"
"net/http/httptest"
Expand Down Expand Up @@ -1013,3 +1016,42 @@ func TestIDPNoDestination(t *testing.T) {
err = req.MakeResponse()
assert.Check(t, err)
}

func TestIDPHTTPCanHandleSSORequest(t *testing.T) {
test := NewIdentifyProviderTest(t)
w := httptest.NewRecorder()

const validRequest = `lJJBayoxFIX%2FypC9JhnU5wszAz7lgWCLaNtFd5fMbQ1MkmnunVb%2FfUfbUqEgdhs%2BTr5zkmLW8S5s8KVD4mzvm0Cl6FIwEciRCeCRDFuznd2sTD5Upk2Ro42NyGZEmNjFMI%2BBOo9pi%2BnVWbzfrEqxY27JSEntEPfg2waHNnpJ4JtcgiWRLfoLXYBjwDfu6p%2B8JIoiWy5K4eqBUipXIzVRUwXKKtRK53qkJ3qqQVuNPUjU4TIQQ%2BBS5EqPBzofKH2ntBn%2FMervo8jWnyX%2BuVC78FwKkT1gopNKX1JUxSklXTMIfM0gsv8xeeDL%2BPGk7%2FF0Qg0GdnwQ1cW5PDLUwFDID6uquO1Dlot1bJw9%2FPLRmia%2BzRMCYyk4dSiq6205QSDXOxfy3KAq5Pkvqt4DAAD%2F%2Fw%3D%3D`

r, _ := http.NewRequest("GET", "https://idp.example.com/saml/sso?RelayState=ThisIsTheRelayState&"+
"SAMLRequest="+validRequest, nil)
test.IDP.Handler().ServeHTTP(w, r)
assert.Check(t, is.Equal(http.StatusOK, w.Code))

// rejects requests that are invalid
w = httptest.NewRecorder()
r, _ = http.NewRequest("GET", "https://idp.example.com/saml/sso?RelayState=ThisIsTheRelayState&"+
"SAMLRequest=PEF1dGhuUmVxdWVzdA%3D%3D", nil)
test.IDP.Handler().ServeHTTP(w, r)
assert.Check(t, is.Equal(http.StatusBadRequest, w.Code))

// rejects requests that contain malformed XML
{
a, _ := url.QueryUnescape(validRequest)
b, _ := base64.StdEncoding.DecodeString(a)
c, _ := io.ReadAll(flate.NewReader(bytes.NewReader(b)))
d := bytes.Replace(c, []byte("<AuthnRequest"), []byte("<AuthnRequest ::foo=\"bar\">]]"), 1)
f := bytes.Buffer{}
e, _ := flate.NewWriter(&f, flate.DefaultCompression)
e.Write(d)
e.Close()
g := base64.StdEncoding.EncodeToString(f.Bytes())
invalidRequest := url.QueryEscape(g)

w = httptest.NewRecorder()
r, _ = http.NewRequest("GET", "https://idp.example.com/saml/sso?RelayState=ThisIsTheRelayState&"+
"SAMLRequest="+invalidRequest, nil)
test.IDP.Handler().ServeHTTP(w, r)
assert.Check(t, is.Equal(http.StatusBadRequest, w.Code))
}
}
136 changes: 0 additions & 136 deletions service_provider_go116_test.go

This file was deleted.

Loading