(t *testing.T)
| 85 | } |
| 86 | |
| 87 | func TestWorkspaceApplicationAuth(t *testing.T) { |
| 88 | t.Parallel() |
| 89 | |
| 90 | cases := []struct { |
| 91 | name string |
| 92 | accessURL string |
| 93 | appHostname string |
| 94 | proxyURL string |
| 95 | proxyAppHostname string |
| 96 | |
| 97 | redirectURI string |
| 98 | expectRedirect string |
| 99 | }{ |
| 100 | { |
| 101 | name: "OK", |
| 102 | accessURL: "https://test.coder.com", |
| 103 | appHostname: "*.test.coder.com", |
| 104 | proxyURL: "https://proxy.test.coder.com", |
| 105 | proxyAppHostname: "*.proxy.test.coder.com", |
| 106 | redirectURI: "https://something.test.coder.com", |
| 107 | expectRedirect: "https://something.test.coder.com", |
| 108 | }, |
| 109 | { |
| 110 | name: "ProxyPathOK", |
| 111 | accessURL: "https://test.coder.com", |
| 112 | appHostname: "*.test.coder.com", |
| 113 | proxyURL: "https://proxy.test.coder.com", |
| 114 | proxyAppHostname: "*.proxy.test.coder.com", |
| 115 | redirectURI: "https://proxy.test.coder.com/path", |
| 116 | expectRedirect: "https://proxy.test.coder.com/path", |
| 117 | }, |
| 118 | { |
| 119 | name: "ProxySubdomainOK", |
| 120 | accessURL: "https://test.coder.com", |
| 121 | appHostname: "*.test.coder.com", |
| 122 | proxyURL: "https://proxy.test.coder.com", |
| 123 | proxyAppHostname: "*.proxy.test.coder.com", |
| 124 | redirectURI: "https://something.proxy.test.coder.com/path?yeah=true", |
| 125 | expectRedirect: "https://something.proxy.test.coder.com/path?yeah=true", |
| 126 | }, |
| 127 | { |
| 128 | name: "ProxySubdomainSuffixOK", |
| 129 | accessURL: "https://test.coder.com", |
| 130 | appHostname: "*.test.coder.com", |
| 131 | proxyURL: "https://proxy.test.coder.com", |
| 132 | proxyAppHostname: "*--suffix.proxy.test.coder.com", |
| 133 | redirectURI: "https://something--suffix.proxy.test.coder.com/", |
| 134 | expectRedirect: "https://something--suffix.proxy.test.coder.com/", |
| 135 | }, |
| 136 | { |
| 137 | name: "NormalizeSchemePrimaryAppHostname", |
| 138 | accessURL: "https://test.coder.com", |
| 139 | appHostname: "*.test.coder.com", |
| 140 | proxyURL: "https://proxy.test.coder.com", |
| 141 | proxyAppHostname: "*.proxy.test.coder.com", |
| 142 | redirectURI: "http://x.test.coder.com", |
| 143 | expectRedirect: "https://x.test.coder.com", |
| 144 | }, |
nothing calls this directly
no test coverage detected