diff options
| -rwxr-xr-x | bin/idp | 9 | ||||
| -rw-r--r-- | test/e2e_test.go | 19 |
2 files changed, 14 insertions, 14 deletions
@@ -179,13 +179,13 @@ module Authn <h2>Recieved SAML Request</h2> <textarea readonly="readonly" disabled="disabled" cols=225 rows=6><%=- saml_request.to_xml(pretty: true) -%></textarea> - <form action="/saml/login" method="post"> - <input type="input" placeholder="Username" name="username" value="" /> - <input type="password" placeholder="Password" name="password" value="" /> + <form id="login-form" action="/saml/login" method="post"> + <input type="input" placeholder="Username" id="username" name="username" value="" /> + <input type="password" placeholder="Password" id="password" name="password" value="" /> <%- saml_params.each do |(key, value)| -%> <input type="hidden" name="<%= key %>" value="<%= value %>" /> <%- end -%> - <input type="submit" value="Login" /> + <input type="submit" id="login-button" value="Login" /> </form> </body> </html> @@ -345,7 +345,6 @@ module Authz return post_authorize(Rack::Request.new(env)) when "/token" # RFC-6749 request = Rack::Request.new(env) - request.body return [200, { 'Content-Type' => "application/json" }, [JSON.pretty_generate({ access_token: ::Authz::JWT.new(sub: SecureRandom.uuid, iat: Time.now.to_i).to_jwt, diff --git a/test/e2e_test.go b/test/e2e_test.go index a0d87ffe..12e28edd 100644 --- a/test/e2e_test.go +++ b/test/e2e_test.go @@ -35,15 +35,12 @@ func TestAuthx(t *testing.T) { }() t.Run("SAML", func(t *testing.T) { - t.Run("GET http://idp.example.com:8080/saml/metadata.xml", func(t *testing.T) { - response := x.Must(http.Get("http://idp.example.com:8080/saml/metadata.xml")) - assert.Equal(t, http.StatusOK, response.StatusCode) - }) - - t.Run("GET http://ui.example.com:8080/saml/metadata.xml", func(t *testing.T) { - response := x.Must(http.Get("http://ui.example.com:8080/saml/metadata.xml")) - assert.Equal(t, http.StatusOK, response.StatusCode) - }) + for _, url := range []string{"http://idp.example.com:8080/saml/metadata.xml", "http://ui.example.com:8080/saml/metadata.xml"} { + t.Run("GET "+url, func(t *testing.T) { + response := x.Must(http.Get(url)) + assert.Equal(t, http.StatusOK, response.StatusCode) + }) + } t.Run("GET http://ui.example.com:8080/saml/new", func(t *testing.T) { x.Must(page.Goto("http://ui.example.com:8080/saml/new")) @@ -51,6 +48,10 @@ func TestAuthx(t *testing.T) { assert.Equal(t, "http://idp.example.com:8080/saml/new", action) assert.NoError(t, page.Locator("#submit-button").Click()) + page.Locator("#username").Fill("username1") + page.Locator("#password").Fill("password1") + assert.NoError(t, page.Locator("#login-button").Click()) + action = x.Must(page.Locator("#postback-form").GetAttribute("action")) assert.Equal(t, "http://ui.example.com:8080/saml/assertions", action) assert.NoError(t, page.Locator("#submit-button").Click()) |
