test_class.file: src/server/src/test/java/io/cassandrareaper/resources/auth/ShiroJwtVerifyingFilterTest.java
test_class.identifier: ShiroJwtVerifyingFilterTest
test_case.body: @Test
    public void testAuthorizationValid() throws Exception {
      try {
        SecurityUtils.setSecurityManager(new DefaultSecurityManager());
        HttpServletRequest req = Mockito.mock(HttpServletRequest.class);
        Principal principal = Mockito.mock(Principal.class);
        Mockito.when(principal.getName()).thenReturn("test-user");
        Mockito.when(req.getUserPrincipal()).thenReturn(principal);
        String jwt = new ShiroJwtProvider(Mockito.mock(AppContext.class)).getJwt(req);
        Mockito.when(req.getHeader("Authorization")).thenReturn("Bearer " + jwt);
        ShiroJwtVerifyingFilter filter = new ShiroJwtVerifyingFilter();
  
        Assertions.assertThat(
            filter.isAccessAllowed(
                req,
                Mockito.mock(ServletResponse.class),
                Mockito.mock(Object.class)))
            .isTrue();
      } finally {
        ThreadContext.unbindSubject();
        ThreadContext.unbindSecurityManager();
      }
    }
test_case.class_method_signature: ShiroJwtVerifyingFilterTest.testAuthorizationValid()
test_case.full_signature: @Test public void testAuthorizationValid()
test_case.identifier: testAuthorizationValid
test_case.invocations: setSecurityManager mock mock thenReturn when getName thenReturn when getUserPrincipal getJwt mock thenReturn when getHeader isTrue assertThat isAccessAllowed mock mock unbindSubject unbindSecurityManager
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testAuthorizationValid()
focal_class.declarator: LOG = LoggerFactory.getLogger(ShiroJwtVerifyingFilter.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(ShiroJwtVerifyingFilter.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.file: src/server/src/main/java/io/cassandrareaper/resources/auth/ShiroJwtVerifyingFilter.java
focal_class.identifier: ShiroJwtVerifyingFilter
focal_class.class_method_signature: ShiroJwtVerifyingFilter.ShiroJwtVerifyingFilter()
focal_class.full_signature: public  ShiroJwtVerifyingFilter()
focal_class.identifier: ShiroJwtVerifyingFilter
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  ShiroJwtVerifyingFilter()
focal_class.class_method_signature: ShiroJwtVerifyingFilter.isAccessAllowed(ServletRequest req, ServletResponse res, Object mappedValue)
focal_class.full_signature: @Override protected boolean isAccessAllowed(ServletRequest req, ServletResponse res, Object mappedValue)
focal_class.identifier: isAccessAllowed
focal_class.modifiers: @Override protected
focal_class.parameters: (ServletRequest req, ServletResponse res, Object mappedValue)
focal_class.return: boolean
focal_class.signature: boolean isAccessAllowed(ServletRequest req, ServletResponse res, Object mappedValue)
focal_class.class_method_signature: ShiroJwtVerifyingFilter.getJwtSubject(Subject nonJwt, ServletRequest req, ServletResponse res)
focal_class.full_signature: static Subject getJwtSubject(Subject nonJwt, ServletRequest req, ServletResponse res)
focal_class.identifier: getJwtSubject
focal_class.modifiers: static
focal_class.parameters: (Subject nonJwt, ServletRequest req, ServletResponse res)
focal_class.return: Subject
focal_class.signature: Subject getJwtSubject(Subject nonJwt, ServletRequest req, ServletResponse res)
focal_class.class_method_signature: ShiroJwtVerifyingFilter.onAccessDenied(ServletRequest req, ServletResponse res)
focal_class.full_signature: @Override protected boolean onAccessDenied(ServletRequest req, ServletResponse res)
focal_class.identifier: onAccessDenied
focal_class.modifiers: @Override protected
focal_class.parameters: (ServletRequest req, ServletResponse res)
focal_class.return: boolean
focal_class.signature: boolean onAccessDenied(ServletRequest req, ServletResponse res)
focal_class.class_method_signature: ShiroJwtVerifyingFilter.getJwtUser(ServletRequest req)
focal_class.full_signature: private static Optional<String> getJwtUser(ServletRequest req)
focal_class.identifier: getJwtUser
focal_class.modifiers: private static
focal_class.parameters: (ServletRequest req)
focal_class.return: Optional<String>
focal_class.signature: Optional<String> getJwtUser(ServletRequest req)
focal_class.superclass: extends AccessControlFilter
focal_method.body: @Override
    protected boolean isAccessAllowed(ServletRequest req, ServletResponse res, Object mappedValue) throws Exception {
      Subject nonJwt = getSubject(req, res);
  
      return null != nonJwt.getPrincipal() && (nonJwt.isRemembered() || nonJwt.isAuthenticated())
        ? true
        : getJwtUser(req).isPresent();
    }
focal_method.class_method_signature: ShiroJwtVerifyingFilter.isAccessAllowed(ServletRequest req, ServletResponse res, Object mappedValue)
focal_method.full_signature: @Override protected boolean isAccessAllowed(ServletRequest req, ServletResponse res, Object mappedValue)
focal_method.identifier: isAccessAllowed
focal_method.invocations: getSubject getPrincipal isRemembered isAuthenticated isPresent getJwtUser
focal_method.modifiers: @Override protected
focal_method.parameters: (ServletRequest req, ServletResponse res, Object mappedValue)
focal_method.return: boolean
focal_method.signature: boolean isAccessAllowed(ServletRequest req, ServletResponse res, Object mappedValue)