@Test
    @OperateOnDeployment(TESTABLE_MODE)
    void principalInjection() {
        SecurityUtils.getSubject().login(new UsernamePasswordToken("user", "password"));
        assertNotNull(injectedComponents.getPropertyPrincipal());
        assertEquals("user", Optional.ofNullable(injectedComponents.getPropertyPrincipal().get()).orElseThrow().getUserName());
        injectedComponents.getSubject().logout();
    }
Tests @Injecting Subject, Session, Principal and SecurityManager with CDI
integration-tests/jakarta-ee/src/test/java/org/apache/shiro/testing/cdi/ComponentInjectionIT.java