我试图将Shiro整合到我的spring mvc应用程序中.身份验证由LDAP服务器支持,我能够成功地对ldap服务器进行身份验证并获取cookie.
我无法执行的是在后续请求中使用此cookie并获得结果.尝试使用cookie给我一个HTTP 302来再次执行身份验证.例如:GET on(rest/assets/list),标题Cookie: JSESSIONID=abcd重定向为(rest/login)
这是保护api的正确策略吗?api正在被AngularJS应用程序使用,我希望在添加CRUD功能之前启用基于用户组的身份验证.
任何指针都很有用.
源代码如下:
applicationContext.xml文件如下
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="cacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager"/>
<bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
<bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" depends-on="lifecycleBeanPostProcessor"/>
<bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
<property name="securityManager" ref="securityManager"/>
</bean>
<bean id="ldapRealm" class="com.directv.nmsupport.security.LDAPRealm">
<property name="contextFactory" ref="ldapContextFactory" />
<property name="userDnTemplate" value="uid={0},ou=DirecTV,ou=People,dc=swengdtv,dc=net" />
</bean>
<bean id="ldapContextFactory" class="org.apache.shiro.realm.ldap.JndiLdapContextFactory">
<property name="url" value="ldap://teon:389"/>
</bean>
<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
<property name="realm" ref="ldapRealm"/>
<property name="cacheManager" ref="cacheManager"/>
<property name="sessionManager" ref="sessionManager" />
</bean>
<bean id="sessionManager" class="org.apache.shiro.web.session.mgt.DefaultWebSessionManager">
<property name="sessionIdCookieEnabled" value="true" />
</bean>
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"> …Run Code Online (Sandbox Code Playgroud) 我正在尝试设置 L1 + L2 缓存策略以与@Cacheable注释一起使用。我的目标是
我知道这不受开箱即用的支持,但我一直在尝试阅读有关如何连接此类解决方案的文档。
我当前的解决方案是将我的实际服务包装在RedisBackedService具有注释的 a 中,而该服务又包装在具有注释的a 中。不用说,这似乎是多余的。redisCacheManagercacheableCaffeineBackedServicecaffeineCacheManagercacheable
任何指示都会有帮助。