mraible commented on code in PR #165:
URL: https://github.com/apache/roller/pull/165#discussion_r3891405462


##########
app/src/main/java/org/apache/roller/weblogger/webservices/oauth/AuthorizationServlet.java:
##########
@@ -71,40 +81,93 @@ public void doPost(HttpServletRequest request, 
HttpServletResponse response)
         
         try{
             OAuthMessage requestMessage = OAuthServlet.getMessage(request, 
null);
-            
+
             OAuthManager omgr = 
WebloggerFactory.getWeblogger().getOAuthManager();
             OAuthAccessor accessor = omgr.getAccessor(requestMessage);
-
-            String userId = request.getParameter("userId");
-            if (userId == null) {
-                userId = request.getParameter("xoauth_requestor_id");
+            if (accessor == null || accessor.consumer == null || 
accessor.requestToken == null) {
+                denyPermission(response);
+                return;
             }
-            
-            if (userId == null) {
-                // no user associted with the key, must be site-wide key,
-                // so get user to login and do the authorization process
+
+            // The approving identity comes from the browser session, 
consistent
+            // with the rest of the UI. Without a session there is nobody to
+            // approve on behalf of, so send the caller through the login flow.
+            User user = getAuthenticatedUser(request);
+            if (user == null) {
                 sendToAuthorizePage(request, response, accessor);

Review Comment:
   The comment says a session-less request goes through the login flow, but 
`sendToAuthorizePage` forwards to `/roller-ui/oauthAuthorize.rol`, which isn't 
a Spring-protected URL: UISecurityInterceptor returns DENIED and the user lands 
on the access-denied tile with no way to log in or resume. A user whose login 
expired mid-consent, or a first-time consent with no session, dead-ends there 
and the consumer's request token is stranded. A redirect to the login page with 
a saved request would do what the comment describes.



-- 
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