Skip to content

Commit aad1b28

Browse files
Merge pull request #243 from samuelvl/openshift-sar-resourcename
Use resourceName in Openshift SAR rule
2 parents 48de457 + d3ece83 commit aad1b28

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Cons:
6565
Example:
6666

6767
# Allows access if the user can view the service 'proxy' in namespace 'app-dev'
68-
--openshift-sar='{"namespace":"app-dev","resource":"services","name":"proxy","verb":"get"}'
68+
--openshift-sar='{"namespace":"app-dev","resource":"services","resourceName":"proxy","verb":"get"}'
6969

7070
A user who visits the proxy will be redirected to an OAuth login with OpenShift, and must grant
7171
access to the proxy to view their user info and request permissions for them. Once they have granted
@@ -89,7 +89,7 @@ to be able to access the backed server.
8989
Example:
9090

9191
# Allows access to foo.example.com if the user can view the service 'proxy' in namespace 'app-dev'
92-
--openshift-sar-by-host='{"foo.example.com":{"namespace":"app-dev","resource":"services","name":"proxy","verb":"get"}}'
92+
--openshift-sar-by-host='{"foo.example.com":{"namespace":"app-dev","resource":"services","resourceName":"proxy","verb":"get"}}'
9393

9494
#### Delegate authentication and authorization to OpenShift for infrastructure
9595

‎test/e2e/proxy_test.go‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,20 @@ func TestOAuthProxyE2E(t *testing.T) {
8383
},
8484
expectedErr: "did not reach upstream site",
8585
},
86+
"sar-name-ok": {
87+
oauthProxyArgs: []string{
88+
"--upstream=http://localhost:8080",
89+
`--openshift-sar={"namespace":"` + ns + `","resource":"routes","resourceName":"proxy-route","verb":"get"}`,
90+
},
91+
pageResult: "URI: /",
92+
},
93+
"sar-name-fail": {
94+
oauthProxyArgs: []string{
95+
"--upstream=http://localhost:8080",
96+
`--openshift-sar={"namespace":"other","resource":"routes","resourceName":"proxy-route","verb":"get"}`,
97+
},
98+
expectedErr: "did not reach upstream site",
99+
},
86100
"sar-multi-ok": {
87101
oauthProxyArgs: []string{
88102
"--upstream=http://localhost:8080",

0 commit comments

Comments
 (0)