thenatog commented on a change in pull request #4988:
URL: https://github.com/apache/nifi/pull/4988#discussion_r618475268



##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessResource.java
##########
@@ -1812,4 +1826,25 @@ public void setLogoutRequestManager(LogoutRequestManager 
logoutRequestManager) {
         this.logoutRequestManager = logoutRequestManager;
     }
 
+    private void logOutUser(HttpServletRequest httpServletRequest) throws 
LogoutException {
+        final String jwt = getJwtFromRequest(httpServletRequest);
+        jwtService.logOut(jwt);
+    }
+
+    private String getJwtFromRequest(HttpServletRequest httpServletRequest) {
+        final String authCookie = 
getCookieValue(httpServletRequest.getCookies(), 
JwtAuthenticationFilter.JWT_COOKIE_NAME);
+        final String authHeader = 
httpServletRequest.getHeader(httpServletRequest.getHeader(JwtAuthenticationFilter.AUTHORIZATION));
+
+        String jwt = null;
+
+        if (authCookie != null && !authCookie.isEmpty()) {
+            jwt = authCookie;
+        }
+
+        if (authHeader != null && !authHeader.isEmpty()) {
+            jwt = JwtAuthenticationFilter.getTokenFromHeader(authHeader);

Review comment:
       Added a BearerTokenResolver/interface as this Spring class is not 
introduced until Spring Security 5.1 and we are using 4.2.13.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to