Commits

pi songsiritat committed bd86f42

OAUTH-273: addressed code review comments

Comments (0)

Files changed (1)

service-provider-plugin/src/main/java/com/atlassian/oauth/serviceprovider/internal/AuthenticatorImpl.java

 import java.net.URI;
 import java.net.URISyntaxException;
 import java.security.Principal;
+import java.util.Locale;
 import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 
             if (!consumer.getThreeLOAllowed())
             {
-                LOG.info("3-Legged OAuth request not allowed for Consumer key:'{}'" + consumer.getKey());
+                LOG.info("3-Legged-OAuth request has been attempted but 3-Legged-OAuth is not enabled for consumer:'{}'." + consumer.getKey());
                 throw new OAuthProblemException(PERMISSION_DENIED);
             }
         }
             // if 2LO impersonation is not on, the operation is not allowed.
             if (!consumer.getTwoLOImpersonationAllowed())
             {
-                LOG.info("2LO Impersonation is not allowed. Cannot access resource as user '{}'", userId);
+                LOG.info("2-Legged-OAuth with Impersonation request has been attempted but 2-Legged-OAuth with Impersonation is not enabled for consumer:'{}'. Cannot access resource as user '{}'", consumer.getName(), userId);
                 sendError(response, HttpServletResponse.SC_UNAUTHORIZED, message);
                 return new Authenticator.Result.Failure(new OAuthProblem.PermissionDenied(userId));
             }
             // This is 2LO with no impersonation. We only resolve to the user assigned for execution.
             if (!consumer.getTwoLOAllowed())
             {
-                LOG.info("2LO request has been attempted but the 2LO feature is not enabled for consumer:'{}'.", consumer.getName());
+                LOG.info("2-Legged-OAuth request has been attempted but 2-Legged-OAuth is not enabled for consumer:'{}'.", consumer.getName());
                 sendError(response, HttpServletResponse.SC_UNAUTHORIZED, message);
                 return new Authenticator.Result.Failure(new OAuthProblem.PermissionDenied());
             }
 
         if (ope.getProblem().equals(CONSUMER_KEY_UNKNOWN))
         {
-            return new Result.Failure(new OAuthProblem(Problem.valueOf(ope.getProblem().toUpperCase())));
+            return new Result.Failure(new OAuthProblem(Problem.valueOf(ope.getProblem().toUpperCase(Locale.ENGLISH))));
         }
 
         if (tokenStr != null)
         {
-            return new Result.Failure(new OAuthProblem(Problem.valueOf(ope.getProblem().toUpperCase()), tokenStr));
+            return new Result.Failure(new OAuthProblem(Problem.valueOf(ope.getProblem().toUpperCase(Locale.ENGLISH)), tokenStr));
         }
         else
         {
-            return new Result.Failure(new OAuthProblem(Problem.valueOf(ope.getProblem().toUpperCase())));
+            return new Result.Failure(new OAuthProblem(Problem.valueOf(ope.getProblem().toUpperCase(Locale.ENGLISH))));
         }
     }
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.