You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by "lprimak (via GitHub)" <gi...@apache.org> on 2023/03/29 01:28:46 UTC

[GitHub] [shiro] lprimak opened a new pull request, #815: Reworked CDI principal injection

lprimak opened a new pull request, #815:
URL: https://github.com/apache/shiro/pull/815

   Instead of `Optional`, using generic `ShiroPrincipal` object as an injection point


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

To unsubscribe, e-mail: commits-unsubscribe@shiro.apache.org

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


[GitHub] [shiro] lprimak merged pull request #815: Reworked CDI principal injection API using Supplier

Posted by "lprimak (via GitHub)" <gi...@apache.org>.
lprimak merged PR #815:
URL: https://github.com/apache/shiro/pull/815


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

To unsubscribe, e-mail: commits-unsubscribe@shiro.apache.org

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


[GitHub] [shiro] lprimak commented on a diff in pull request #815: Reworked CDI principal injection API using Supplier

Posted by "lprimak (via GitHub)" <gi...@apache.org>.
lprimak commented on code in PR #815:
URL: https://github.com/apache/shiro/pull/815#discussion_r1153601383


##########
integration-tests/jakarta-ee/src/test/java/org/apache/shiro/testing/cdi/ComponentInjectionIT.java:
##########
@@ -103,8 +104,8 @@ void sessionInjection() {
     @OperateOnDeployment(TESTABLE_MODE)
     void principalInjection() {
         SecurityUtils.getSubject().login(new UsernamePasswordToken("user", "password"));
-        assertNotNull(injectedComponents.getPropertyPincipal());
-        assertEquals("user", injectedComponents.getPropertyPincipal().orElseThrow().getUserName());
+        assertNotNull(injectedComponents.getPropertyPrincipal());
+        assertEquals("user", Optional.ofNullable(injectedComponents.getPropertyPrincipal().get()).orElseThrow().getUserName());

Review Comment:
   get() comes from Supplier now, not Optional



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

To unsubscribe, e-mail: commits-unsubscribe@shiro.apache.org

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


[GitHub] [shiro] bmarwell commented on a diff in pull request #815: Reworked CDI principal injection API using Supplier

Posted by "bmarwell (via GitHub)" <gi...@apache.org>.
bmarwell commented on code in PR #815:
URL: https://github.com/apache/shiro/pull/815#discussion_r1153592928


##########
integration-tests/jakarta-ee/src/test/java/org/apache/shiro/testing/cdi/ComponentInjectionIT.java:
##########
@@ -103,8 +104,8 @@ void sessionInjection() {
     @OperateOnDeployment(TESTABLE_MODE)
     void principalInjection() {
         SecurityUtils.getSubject().login(new UsernamePasswordToken("user", "password"));
-        assertNotNull(injectedComponents.getPropertyPincipal());
-        assertEquals("user", injectedComponents.getPropertyPincipal().orElseThrow().getUserName());
+        assertNotNull(injectedComponents.getPropertyPrincipal());
+        assertEquals("user", Optional.ofNullable(injectedComponents.getPropertyPrincipal().get()).orElseThrow().getUserName());

Review Comment:
   Don't use `get()`, use `orElseThrow()` (on 8 with `NoSuchElementException::new`)



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

To unsubscribe, e-mail: commits-unsubscribe@shiro.apache.org

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