You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by bd...@apache.org on 2021/04/12 15:13:31 UTC

[shiro-site] branch spring-boot-docs-move created (now 7c2235b)

This is an automated email from the ASF dual-hosted git repository.

bdemers pushed a change to branch spring-boot-docs-move
in repository https://gitbox.apache.org/repos/asf/shiro-site.git.


      at 7c2235b  Move Spring Boot Web docs to the top of the page

This branch includes the following new commits:

     new 7c2235b  Move Spring Boot Web docs to the top of the page

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[shiro-site] 01/01: Move Spring Boot Web docs to the top of the page

Posted by bd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bdemers pushed a commit to branch spring-boot-docs-move
in repository https://gitbox.apache.org/repos/asf/shiro-site.git

commit 7c2235bd3d71d9d1ff7c4f3468874a04245ce394
Author: Brian Demers <bd...@apache.org>
AuthorDate: Mon Apr 12 11:13:24 2021 -0400

    Move Spring Boot Web docs to the top of the page
---
 spring-boot.md.vtl | 73 +++++++++++++++++++++++++++---------------------------
 1 file changed, 36 insertions(+), 37 deletions(-)

diff --git a/spring-boot.md.vtl b/spring-boot.md.vtl
index 1747e93..4388217 100644
--- a/spring-boot.md.vtl
+++ b/spring-boot.md.vtl
@@ -5,43 +5,6 @@
 
 Shiro's Spring-Boot integration is the easiest way to integrate Shiro into a Spring-base application, for more general Spring Framework integration, take a the [annotation](spring-framework.html) or [XML](spring-xml.html) guides.  
 
-<a name="Spring-StandaloneApplications"></a>
-Standalone Applications
----
-
-Include the Shiro Spring starter dependency in you application classpath (we recomend using a tool such as Apache Maven or Gradle to manage this).
-
-#dependencies('cli', [['org.apache.shiro', 'shiro-spring-boot-starter', "${latestRelease}"]])
-
-The only thing that is left is to configure a [realm](realm.html):
-
-``` java
-@Bean
-public Realm realm() {
-  ...
-}
-```
-
-The easiest way to setup Shiro, so that all SecurityUtils.* methods work in all cases, is to make the `SecurityManager` bean a static singleton.  DO NOT do this in web applications - see the [Web Applications](#Spring-WebApplications) section below instead.
- 
-``` java
-@Autowired
-private SecurityManager securityManager;
-    
- @PostConstruct
- private void initStaticSecurityManager() {
-     SecurityUtils.setSecurityManager(securityManager);
- }
-```
-
-That is it, now you can get the current `Subject` using:
-
-``` java
-SecurityUtils.getSubject();
-```
-
-You can see a full example in our [samples on Github](https://github.com/apache/shiro/tree/master/samples/spring-boot).
-
 <a name="Spring-WebApplications"></a>
 Web Applications
 ---
@@ -169,4 +132,40 @@ protected CacheManager cacheManager() {
 | shiro.successUrl | `/` | Default landing page after a user logs in (if alternative cannot be found in the current session) |
 | shiro.unauthorizedUrl | null | Page to redirect user to if they are unauthorized (403 page) |
 
+<a name="Spring-StandaloneApplications"></a>
+# Standalone Applications
+
+Include the Shiro Spring starter dependency in you application classpath (we recomend using a tool such as Apache Maven or Gradle to manage this).
+
+#dependencies('cli', [['org.apache.shiro', 'shiro-spring-boot-starter', "${latestRelease}"]])
+
+The only thing that is left is to configure a [realm](realm.html):
+
+``` java
+@Bean
+public Realm realm() {
+  ...
+}
+```
+
+The easiest way to setup Shiro, so that all SecurityUtils.* methods work in all cases, is to make the `SecurityManager` bean a static singleton.  DO NOT do this in web applications - see the [Web Applications](#Spring-WebApplications) section below instead.
+ 
+``` java
+@Autowired
+private SecurityManager securityManager;
+    
+ @PostConstruct
+ private void initStaticSecurityManager() {
+     SecurityUtils.setSecurityManager(securityManager);
+ }
+```
+
+That is it, now you can get the current `Subject` using:
+
+``` java
+SecurityUtils.getSubject();
+```
+
+You can see a full example in our [samples on Github](https://github.com/apache/shiro/tree/master/samples/spring-boot).
+
 <input type="hidden" id="ghEditPage" value="spring-boot.md.vtl"></input>