MCPcopy Index your code
hub / github.com/coder/coder / TestWorkspaceApplicationAuth

Function TestWorkspaceApplicationAuth

coderd/workspaceapps_test.go:87–269  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

85}
86
87func 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 },

Callers

nothing calls this directly

Calls 15

ContextFunction · 0.92
LoggerFunction · 0.92
NewDBFunction · 0.92
NewEncryptionCacheFunction · 0.92
NewFunction · 0.92
CreateFirstUserFunction · 0.92
WorkspaceProxyFunction · 0.92
ReadBodyAsErrorFunction · 0.92
DecryptFunction · 0.92
WithDecryptExpectedFunction · 0.92
EncodeMethod · 0.80
FatalMethod · 0.80

Tested by

no test coverage detected