You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
os::cmd::expect_failure_and_text "oc get pods --token='${whoamitoken}' -n '${project}'""prevent this action; User \"scoped-user\" cannot list pods in project\"${project}\""
50
+
os::cmd::expect_failure_and_text "oc get pods --token='${whoamitoken}' -n '${project}'""prevent this action; User \"scoped-user\" cannot list pods in the namespace\"${project}\""
51
51
52
52
listprojecttoken="$(oc process -f "${OS_ROOT}/test/testdata/authentication/scoped-token-template.yaml" TOKEN_PREFIX=listproject SCOPE=user:list-scoped-projects USER_NAME="${username}" USER_UID="${useruid}"| oc create -f - -o name | awk -F/ '{print $2}')"
53
53
# this token doesn't have rights to see any projects even though it can hit the list endpoint, so an empty list is correct
54
54
# we'll add another scope that allows listing all known projects even if this token has no other powers in them.
55
55
os::cmd::expect_success_and_not_text "oc get projects --token='${listprojecttoken}'""${project}"
56
56
os::cmd::expect_failure_and_text "oc get user/~ --token='${listprojecttoken}'"'prevent this action; User "scoped-user" cannot get users at the cluster scope'
57
-
os::cmd::expect_failure_and_text "oc get pods --token='${listprojecttoken}' -n '${project}'""prevent this action; User \"scoped-user\" cannot list pods in project\"${project}\""
57
+
os::cmd::expect_failure_and_text "oc get pods --token='${listprojecttoken}' -n '${project}'""prevent this action; User \"scoped-user\" cannot list pods in the namespace\"${project}\""
58
58
59
59
listprojecttoken="$(oc process -f "${OS_ROOT}/test/testdata/authentication/scoped-token-template.yaml" TOKEN_PREFIX=listallprojects SCOPE=user:list-projects USER_NAME="${username}" USER_UID="${useruid}"| oc create -f - -o name | awk -F/ '{print $2}')"
60
60
os::cmd::expect_success_and_text "oc get projects --token='${listprojecttoken}'""${project}"
61
61
62
62
adminnonescalatingpowerstoken="$(oc process -f "${OS_ROOT}/test/testdata/authentication/scoped-token-template.yaml" TOKEN_PREFIX=admin SCOPE=role:admin:* USER_NAME="${username}" USER_UID="${useruid}"| oc create -f - -o name | awk -F/ '{print $2}')"
63
63
os::cmd::expect_failure_and_text "oc get user/~ --token='${adminnonescalatingpowerstoken}'"'prevent this action; User "scoped-user" cannot get users at the cluster scope'
64
-
os::cmd::expect_failure_and_text "oc get secrets --token='${adminnonescalatingpowerstoken}' -n '${project}'""prevent this action; User \"scoped-user\" cannot list secrets in project\"${project}\""
64
+
os::cmd::expect_failure_and_text "oc get secrets --token='${adminnonescalatingpowerstoken}' -n '${project}'""prevent this action; User \"scoped-user\" cannot list secrets in the namespace\"${project}\""
65
65
os::cmd::expect_success_and_text "oc get 'projects/${project}' --token='${adminnonescalatingpowerstoken}' -n '${project}'""${project}"
66
66
67
67
allescalatingpowerstoken="$(oc process -f "${OS_ROOT}/test/testdata/authentication/scoped-token-template.yaml" TOKEN_PREFIX=clusteradmin SCOPE='role:cluster-admin:*:!' USER_NAME="${username}" USER_UID="${useruid}"| oc create -f - -o name | awk -F/ '{print $2}')"
68
68
os::cmd::expect_success_and_text "oc get user/~ --token='${allescalatingpowerstoken}'""${username}"
69
69
os::cmd::expect_success "oc get secrets --token='${allescalatingpowerstoken}' -n '${project}'"
70
70
# scopes allow it, but authorization doesn't
71
71
os::cmd::try_until_failure "oc get secrets --token='${allescalatingpowerstoken}' -n default"
72
-
os::cmd::expect_failure_and_text "oc get secrets --token='${allescalatingpowerstoken}' -n default"'cannot list secrets in project'
72
+
os::cmd::expect_failure_and_text "oc get secrets --token='${allescalatingpowerstoken}' -n default"'cannot list secrets in the namespace'
73
73
os::cmd::expect_success_and_text "oc get projects --token='${allescalatingpowerstoken}'""${project}"
os::cmd::expect_success_and_text 'oc status'"You don't have any projects. You can try to create a new project, by running"
45
45
os::cmd::expect_success_and_text 'oc status --all-namespaces'"Showing all projects on server"
46
46
# make sure `oc status` does not re-use the "no projects" message from `oc login` if -n is specified
47
-
os::cmd::expect_failure_and_text 'oc status -n forbidden''Error from server \(Forbidden\): User "test-user" cannot get project "forbidden"'
47
+
os::cmd::expect_failure_and_text 'oc status -n forbidden''Error from server \(Forbidden\): User "test-user" cannot get projects in the namespace "forbidden"'
# make sure `oc status` does not use "no projects" message if there is a project created
54
54
os::cmd::expect_success_and_text 'oc status'"In project my project \(project-bar\) on server"
55
-
os::cmd::expect_failure_and_text 'oc status -n forbidden''Error from server \(Forbidden\): User "test-user" cannot get project "forbidden"'
55
+
os::cmd::expect_failure_and_text 'oc status -n forbidden''Error from server \(Forbidden\): User "test-user" cannot get projects in the namespace "forbidden"'
unauthorizedError="the server has asked for the client to provide credentials (get users ~)"
38
-
anonymousError=`User "system:anonymous" cannot get users at the cluster scope`
38
+
anonymousError=`User "system:anonymous" cannot get users at the cluster scope.: "User \"system:anonymous\" cannot get users at the cluster scope" (get users ~)`
0 commit comments