reta commented on code in PR #3627:
URL: https://github.com/apache/cxf/pull/3627#discussion_r4372086679


##########
rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthScopesFilter.java:
##########
@@ -78,11 +91,16 @@ protected void checkSecureClass(Class<?> cls) {
             if (SKIP_METHODS.contains(m.getName())) {
                 continue;
             }
+            // Subclasses are scanned before their superclasses and 
interfaces, so the most
+            // specific declaration of a given signature is recorded first and 
kept
+            String signature = getMethodSignature(m);
             Scopes methodScopes = m.getAnnotation(Scopes.class);
-            Scopes theScopes = methodScopes == null ? classScopes : 
methodScopes;
-            if (theScopes != null) {
-                scopesMap.put(m.getName(), Arrays.asList(theScopes.value()));
-                scopesMatchAllMap.put(m.getName(), theScopes.matchAll());
+            if (methodScopes != null) {
+                methodScopesBySignature.putIfAbsent(signature, methodScopes);
+                annotationScopesByName.computeIfAbsent(m.getName(), k -> new 
HashSet<>()).add(methodScopes);

Review Comment:
   I am wondering what happens if there are several overrides for the same 
method but different scope annotations? 
   
   ```
   @Scopes
   void foo() {
   }
   
   @Scopes
   void foo(arg1, ..) {
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to