You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by lp...@apache.org on 2023/03/29 14:44:40 UTC
[shiro-site] branch main updated: ShiroPrincipal -> Supplier
This is an automated email from the ASF dual-hosted git repository.
lprimak pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shiro-site.git
The following commit(s) were added to refs/heads/main by this push:
new 1d3f1c066 ShiroPrincipal -> Supplier
1d3f1c066 is described below
commit 1d3f1c06669f804d3774ff1f9273485a1a60a3d6
Author: lprimak <le...@flowlogix.com>
AuthorDate: Wed Mar 29 09:44:24 2023 -0500
ShiroPrincipal -> Supplier
---
src/site/content/jakarta-ee.adoc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/site/content/jakarta-ee.adoc b/src/site/content/jakarta-ee.adoc
index e11f01629..f9316551f 100644
--- a/src/site/content/jakarta-ee.adoc
+++ b/src/site/content/jakarta-ee.adoc
@@ -149,7 +149,7 @@ public class MyBean {
@Inject
@Principal
- ShiroPrincipal<MyUserAccount> userAccount;
+ Supplier<MyUserAccount> userAccount;
@Inject
Session session;
@@ -159,9 +159,9 @@ public class MyBean {
Session optionalSession;
}
----
-`Subject`, `Session` and `ShiroPrincipal` are always treated as Request-Scoped beans. They are injectable into any Jakarta EE bean including Jax-RS, Servlet and other CDI beans. +
+`Subject`, `Session` and `@Principal` are always treated as Request-Scoped beans. They are injectable into any Jakarta EE bean including Jax-RS, Servlet and other CDI beans. +
If `Session` is annotated with `@NoSessionCreation` and there is no existing session, `InvalidSessionException` is thrown when accessing the Injected session. +
-Any Shiro principal object can be injected if annotated by `@Principal`. It must be injected as `ShiroPrincipal`, and `ShiroPrincipal.get()` may return null if there are no principals available of the injected type.
+Any Shiro principal object can be injected if annotated by `@Principal`. It must be injected as `Supplier<MyPrincipalClass>`, and `Supplier.get()` may return null if there are no principals available of the injected type.
== Jakarta EE Integration Module
Jakarta EE integration module was inspired by this link:https://balusc.omnifaces.org/2013/01/apache-shiro-is-it-ready-for-java-ee-6.html[OmniFaces article] and brings everything together to seamlessly create secure Jakarta EE applications easily and with minimal configuration. The module works "the Shiro way" and uses shiro.ini in a straight-forward and intuitive way.