@Test
    @OperateOnDeployment(TESTABLE_MODE)
    void subjectInjection() {
        assertNotNull(injectedComponents.getSubject());
        assertNull(injectedComponents.getSubject().getPrincipal());
        assertFalse(injectedComponents.getSubject().isAuthenticated());
        UsernamePasswordToken token = new UsernamePasswordToken("user", "password");
        injectedComponents.getSubject().login(token);
        assertTrue(injectedComponents.getSubject().isAuthenticated());

        injectedComponents.getSubject().logout();
        assertFalse(injectedComponents.getSubject().isAuthenticated());
    }
Tests @Injecting Subject, Session, Principal and SecurityManager with CDI
integration-tests/jakarta-ee/src/test/java/org/apache/shiro/testing/cdi/ComponentInjectionIT.java