@@ -160,7 +160,26 @@ func TestOAuthServiceAccountClient(t *testing.T) {
160160 t .Fatalf ("Unexpected error: %v" , err )
161161 } else if ! reflect .DeepEqual (clientAuth .Scopes , []string {"user:full" }) {
162162 t .Fatalf ("Unexpected scopes: %v" , clientAuth .Scopes )
163+ } else {
164+ // update the authorization to contain only read scopes
165+ clientAuth .Scopes = []string {"user:info" }
166+ if _ , err := clusterAdminOAuthClient .OAuthClientAuthorizations ().Update (clientAuth ); err != nil {
167+ t .Fatalf ("Unexpected error: %v" , err )
168+ }
163169 }
170+ // approval steps are needed again for unscoped access
171+ runOAuthFlow (t , clusterAdminClientConfig , projectName , oauthClientConfig , nil , authorizationCodes , authorizationErrors , true , true , []string {
172+ "GET /oauth/authorize" ,
173+ "received challenge" ,
174+ "GET /oauth/authorize" ,
175+ "redirect to /oauth/authorize/approve" ,
176+ "form" ,
177+ "POST /oauth/authorize/approve" ,
178+ "redirect to /oauth/authorize" ,
179+ "redirect to /oauthcallback" ,
180+ "code" ,
181+ "scope:user:full" ,
182+ })
164183
165184 // with the authorization stored, approval steps are skipped
166185 runOAuthFlow (t , clusterAdminClientConfig , projectName , oauthClientConfig , nil , authorizationCodes , authorizationErrors , true , true , []string {
0 commit comments