src/main/resources/spring-shiro.xml

(开头部分) 9KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

	<description>== Shiro Components ==</description>
    
	<!-- 会话Session ID生成器 -->
	<bean id="sessionIdGenerator" class="org.apache.shiro.session.mgt.eis.JavaUuidSessionIdGenerator"/>

	<!-- 会话Cookie模板 -->
	<bean id="sessionIdCookie" class="org.apache.shiro.web.servlet.SimpleCookie">
		<!--cookie的name,我故意取名叫xxxxbaidu -->
	    <constructor-arg value="v_v-s-baidu"/>
	    <property name="httpOnly" value="true"/>
	    <!--cookie的有效时间 -->
	    <property name="maxAge" value="-1"/>
	    <!-- 配置存储Session Cookie的domain为 一级域名
	    <property name="domain" value=".itboy.net"/>
	     -->
	</bean>
	<!-- custom shiro session listener -->
	<bean id="customSessionListener" class="com.sojson.core.shiro.listenter.CustomSessionListener">
	    <property name="shiroSessionRepository" ref="jedisShiroSessionRepository"/>
	</bean>
	<!-- 用户信息记住我功能的相关配置 -->
	<bean id="rememberMeCookie" class="org.apache.shiro.web.servlet.SimpleCookie">
	    <constructor-arg value="v_v-re-baidu"/>
	    <property name="httpOnly" value="true"/>
	    <!-- 配置存储rememberMe Cookie的domain为 一级域名
	    <property name="domain" value=".itboy.net"/>
	     -->
	    <property name="maxAge" value="2592000"/><!-- 30天时间,记住我30天 -->
	</bean>

    <!-- rememberMe管理器 -->
    <bean id="rememberMeManager" class="org.apache.shiro.web.mgt.CookieRememberMeManager">
        <!-- rememberMe cookie加密的密钥 建议每个项目都不一样 默认AES算法 密钥长度(128 256 512 位)-->
        <property name="cipherKey"
                  value="#{T(org.apache.shiro.codec.Base64).decode('3AvVhmFLUs0KTA3Kprsdag==')}"/>
        <property name="cookie" ref="rememberMeCookie"/>
    </bean>
 	
 	
	<!-- custom shiro session listener -->
	<bean id="customShiroSessionDAO" class="com.sojson.core.shiro.CustomShiroSessionDAO">
	    <property name="shiroSessionRepository" ref="jedisShiroSessionRepository"/>
	    <property name="sessionIdGenerator" ref="sessionIdGenerator"/>
	</bean>
	<!-- 手动操作Session,管理Session -->
	<bean id="customSessionManager" class="com.sojson.core.shiro.session.CustomSessionManager">
		<property name="shiroSessionRepository" ref="jedisShiroSessionRepository"/>
		 <property name="customShiroSessionDAO" ref="customShiroSessionDAO"/>
后面还有 133 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。