1. 程式人生 > >spring boot 1.5.4 整合shiro+cas,實現單點登入和許可權控制

spring boot 1.5.4 整合shiro+cas,實現單點登入和許可權控制

1.安裝cas-server-3.5.2

官網:https://github.com/apereo/cas/releases/tag/v3.5.2

注意:

輸入 <tomcat_key> 的金鑰口令 (如果和金鑰庫口令相同, 按回車) ,這裡直接回車,也採用keystore密碼changeit,否則tomcat啟動報錯!

2.配置ehcache快取

複製程式碼
<?xml version="1.0" encoding="UTF-8"?>
<ehcache updateCheck="false" name="shiroCache">

    <defaultCache
            
maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="false" diskPersistent="false" diskExpiryThreadIntervalSeconds="120" /> </ehcache>
複製程式碼

3.新增maven依賴

複製程式碼
        <dependency
> <groupId>org.apache.shiro</groupId> <artifactId>shiro-spring</artifactId> <version>1.2.4</version> </dependency> <dependency> <groupId>org.apache.shiro</groupId> <
artifactId>shiro-ehcache</artifactId> <version>1.2.4</version> </dependency> <dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-cas</artifactId> <version>1.2.4</version> </dependency>
複製程式碼

4.啟動類新增@ServletComponentScan註解

複製程式碼
@ServletComponentScan
@SpringBootApplication
public class Application {
public static void main(String[] args){ SpringApplication.run(Application.class,args); } }
複製程式碼

5.配置shiro+cas

複製程式碼
package com.hdwang.config.shiroCas;

import com.hdwang.dao.UserDao;
import org.apache.shiro.cache.ehcache.EhCacheManager;
import org.apache.shiro.cas.CasFilter;
import org.apache.shiro.cas.CasSubjectFactory;
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.filter.authc.LogoutFilter;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.jasig.cas.client.session.SingleSignOutFilter;
import org.jasig.cas.client.session.SingleSignOutHttpSessionListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.web.filter.DelegatingFilterProxy;

import javax.servlet.Filter;
import javax.servlet.annotation.WebListener;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * Created by hdwang on 2017/6/20.
 * shiro+cas 配置
 */
@Configuration
public class ShiroCasConfiguration {

    private static final Logger logger = LoggerFactory.getLogger(ShiroCasConfiguration.class);

    // cas server地址
    public static final String casServerUrlPrefix = "https://localhost:8443/cas";
    // Cas登入頁面地址
    public static final String casLoginUrl = casServerUrlPrefix + "/login";
    // Cas登出頁面地址
    public static final String casLogoutUrl = casServerUrlPrefix + "/logout";
    // 當前工程對外提供的服務地址
    public static final String shiroServerUrlPrefix = "http://localhost:8081";
    // casFilter UrlPattern
    public static final String casFilterUrlPattern = "/cas";
    // 登入地址
    public static final String loginUrl = casLoginUrl + "?service=" + shiroServerUrlPrefix + casFilterUrlPattern;
    // 登出地址(casserver啟用service跳轉功能,需在webapps\cas\WEB-INF\cas.properties檔案中啟用cas.logout.followServiceRedirects=true)
    public static final String logoutUrl = casLogoutUrl+"?service="+shiroServerUrlPrefix;
    // 登入成功地址
    public static final String loginSuccessUrl = "/home";
    // 許可權認證失敗跳轉地址
    public static final String unauthorizedUrl = "/error/403.html";


    @Bean
    public EhCacheManager getEhCacheManager() {
        EhCacheManager em = new EhCacheManager();
        em.setCacheManagerConfigFile("classpath:ehcache-shiro.xml");
        return em;
    }

    @Bean(name = "myShiroCasRealm")
    public MyShiroCasRealm myShiroCasRealm(EhCacheManager cacheManager) {
        MyShiroCasRealm realm = new MyShiroCasRealm();
        realm.setCacheManager(cacheManager);
        //realm.setCasServerUrlPrefix(ShiroCasConfiguration.casServerUrlPrefix);
        // 客戶端回撥地址
        //realm.setCasService(ShiroCasConfiguration.shiroServerUrlPrefix + ShiroCasConfiguration.casFilterUrlPattern);
        return realm;
    }

    /**
     * 註冊單點登出listener
     * @return
     */
    @Bean
    public ServletListenerRegistrationBean singleSignOutHttpSessionListener(){
        ServletListenerRegistrationBean bean = new ServletListenerRegistrationBean();
        bean.setListener(new SingleSignOutHttpSessionListener());
//        bean.setName(""); //預設為bean name
        bean.setEnabled(true);
        //bean.setOrder(Ordered.HIGHEST_PRECEDENCE); //設定優先順序
        return bean;
    }

    /**
     * 註冊單點登出filter
     * @return
     */
    @Bean
    public FilterRegistrationBean singleSignOutFilter(){
        FilterRegistrationBean bean = new FilterRegistrationBean();
        bean.setName("singleSignOutFilter");
        bean.setFilter(new SingleSignOutFilter());
        bean.addUrlPatterns("/*");
        bean.setEnabled(true);
        //bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
        return bean;
    }



    /**
     * 註冊DelegatingFilterProxy(Shiro)
     *
     * @return
     * @author SHANHY
     * @create  2016年1月13日
     */
    @Bean
    public FilterRegistrationBean delegatingFilterProxy() {
        FilterRegistrationBean filterRegistration = new FilterRegistrationBean();
        filterRegistration.setFilter(new DelegatingFilterProxy("shiroFilter"));
        //  該值預設為false,表示生命週期由SpringApplicationContext管理,設定為true則表示由ServletContainer管理
        filterRegistration.addInitParameter("targetFilterLifecycle", "true");
        filterRegistration.setEnabled(true);
        filterRegistration.addUrlPatterns("/*");
        return filterRegistration;
    }


    @Bean(name = "lifecycleBeanPostProcessor")
    public LifecycleBeanPostProcessor getLifecycleBeanPostProcessor() {
        return new LifecycleBeanPostProcessor();
    }

    @Bean
    public DefaultAdvisorAutoProxyCreator getDefaultAdvisorAutoProxyCreator() {
        DefaultAdvisorAutoProxyCreator daap = new DefaultAdvisorAutoProxyCreator();
        daap.setProxyTargetClass(true);
        return daap;
    }

    @Bean(name = "securityManager")
    public DefaultWebSecurityManager getDefaultWebSecurityManager(MyShiroCasRealm myShiroCasRealm) {
        DefaultWebSecurityManager dwsm = new DefaultWebSecurityManager();
        dwsm.setRealm(myShiroCasRealm);
//      <!-- 使用者授權/認證資訊Cache, 採用EhCache 快取 -->
        dwsm.setCacheManager(getEhCacheManager());
        // 指定 SubjectFactory
        dwsm.setSubjectFactory(new CasSubjectFactory());
        return dwsm;
    }

    @Bean
    public AuthorizationAttributeSourceAdvisor getAuthorizationAttributeSourceAdvisor(DefaultWebSecurityManager securityManager) {
        AuthorizationAttributeSourceAdvisor aasa = new AuthorizationAttributeSourceAdvisor();
        aasa.setSecurityManager(securityManager);
        return aasa;
    }


    /**
     * CAS過濾器
     *
     * @return
     * @author SHANHY
     * @create  2016年1月17日
     */
    @Bean(name = "casFilter")
    public CasFilter getCasFilter() {
        CasFilter casFilter = new CasFilter();
        casFilter.setName("casFilter");
        casFilter.setEnabled(true);
        // 登入失敗後跳轉的URL,也就是 Shiro 執行 CasRealm 的 doGetAuthenticationInfo 方法向CasServer驗證tiket
        casFilter.setFailureUrl(loginUrl);// 我們選擇認證失敗後再開啟登入頁面
        return casFilter;
    }

    /**
     * ShiroFilter<br/>
     * 注意這裡引數中的 StudentService 和 IScoreDao 只是一個例子,因為我們在這裡可以用這樣的方式獲取到相關訪問資料庫的物件,
     * 然後讀取資料庫相關配置,配置到 shiroFilterFactoryBean 的訪問規則中。實際專案中,請使用自己的Service來處理業務邏輯。
     *
     * @param securityManager
     * @param casFilter
     * @param userDao
     * @return
     * @author SHANHY
     * @create  2016年1月14日
     */
    @Bean(name = "shiroFilter")
    public ShiroFilterFactoryBean getShiroFilterFactoryBean(DefaultWebSecurityManager securityManager, CasFilter casFilter, UserDao userDao) {
        ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
        // 必須設定 SecurityManager
        shiroFilterFactoryBean.setSecurityManager(securityManager);
        // 如果不設定預設會自動尋找Web工程根目錄下的"/login.jsp"頁面
        shiroFilterFactoryBean.setLoginUrl(loginUrl);
        // 登入成功後要跳轉的連線
        shiroFilterFactoryBean.setSuccessUrl(loginSuccessUrl);
        shiroFilterFactoryBean.setUnauthorizedUrl(unauthorizedUrl);
        // 新增casFilter到shiroFilter中
        Map<String, Filter> filters = new HashMap<>();
        filters.put("casFilter", casFilter);
       // filters.put("logout",logoutFilter());
        shiroFilterFactoryBean.setFilters(filters);

        loadShiroFilterChain(shiroFilterFactoryBean, userDao);
        return shiroFilterFactoryBean;
    }

    /**
     * 載入shiroFilter許可權控制規則(從資料庫讀取然後配置),角色/許可權資訊由MyShiroCasRealm物件提供doGetAuthorizationInfo實現獲取來的
     *
     * @author SHANHY
     * @create  2016年1月14日
     */
    private void loadShiroFilterChain(ShiroFilterFactoryBean shiroFilterFactoryBean, UserDao userDao){
        /////////////////////// 下面這些規則配置最好配置到配置檔案中 ///////////////////////
        Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();

        // authc:該過濾器下的頁面必須登入後才能訪問,它是Shiro內建的一個攔截器org.apache.shiro.web.filter.authc.FormAuthenticationFilter
        // anon: 可以理解為不攔截
        // user: 登入了就不攔截
        // roles["admin"] 使用者擁有admin角色
        // perms["permission1"] 使用者擁有permission1許可權
        // filter順序按照定義順序匹配,匹配到就驗證,驗證完畢結束。
        // url匹配萬用字元支援:? * **,分別表示匹配1個,匹配0-n個(不含子路徑),匹配下級所有路徑

        //1.shiro整合cas後,首先新增該規則
        filterChainDefinitionMap.put(casFilterUrlPattern, "casFilter");
        //filterChainDefinitionMap.put("/logout","logout"); //logut請求採用logout filter

        //2.不攔截的請求
        filterChainDefinitionMap.put("/css/**","anon");
        filterChainDefinitionMap.put("/js/**","anon");
        filterChainDefinitionMap.put("/login", "anon");
        filterChainDefinitionMap.put("/logout","anon");
        filterChainDefinitionMap.put("/error","anon");
        //3.攔截的請求(從本地資料庫獲取或者從casserver獲取(webservice,http等遠端方式),看你的角色許可權配置在哪裡)
        filterChainDefinitionMap.put("/user", "authc"); //需要登入
        filterChainDefinitionMap.put("/user/add/**", "authc,roles[admin]"); //需要登入,且使用者角色為admin
        filterChainDefinitionMap.put("/user/delete/**", "authc,perms[\"user:delete\"]"); //需要登入,且使用者有許可權為user:delete

        //4.登入過的不攔截
        filterChainDefinitionMap.put("/**", "user");

        shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
    }

}
複製程式碼 複製程式碼
package com.hdwang.config.shiroCas;

import javax.annotation.PostConstruct;

import com.hdwang.dao.UserDao;
import com.hdwang.entity.User;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.cas.CasRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.HashSet;
import java.util.Set;

/**
 * Created by hdwang on 2017/6/20.
 * 安全資料來源
 */
public class MyShiroCasRealm extends CasRealm{

    private static final Logger logger = LoggerFactory.getLogger(MyShiroCasRealm.class);

    @Autowired
    private UserDao userDao;

    @PostConstruct
    public void initProperty(){
//      setDefaultRoles("ROLE_USER");
        setCasServerUrlPrefix(ShiroCasConfiguration.casServerUrlPrefix);
        // 客戶端回撥地址
        setCasService(ShiroCasConfiguration.shiroServerUrlPrefix + ShiroCasConfiguration.casFilterUrlPattern);
    }

//    /**
//     * 1、CAS認證 ,驗證使用者身份
//     * 2、將使用者基本資訊設定到會話中(不用了,隨時可以獲取的)
//     */
//    @Override
//    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) {
//
//        AuthenticationInfo authc = super.doGetAuthenticationInfo(token);
//
//        String account = (String) authc.getPrincipals().getPrimaryPrincipal();
//
//        User user = userDao.getByName(account);
//        //將使用者資訊存入session中
//        SecurityUtils.getSubject().getSession().setAttribute("user", user);
//
//        return authc;
//    }

    /**
     * 許可權認證,為當前登入的Subject授予角色和許可權
     * @see 經測試:本例中該方法的呼叫時機為需授權資源被訪問時
     * @see 經測試:並且每次訪問需授權資源時都會執行該方法中的邏輯,這表明本例中預設並未啟用AuthorizationCache
     * @see 經測試:如果連續訪問同一個URL(比如重新整理),該方法不會被重複呼叫,Shiro有一個時間間隔(也就是cache時間,在ehcache-shiro.xml中配置),超過這個時間間隔再重新整理頁面,該方法會被執行
     */
    @Override
    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {
        logger.info("##################執行Shiro許可權認證##################");
        //獲取當前登入輸入的使用者名稱,等價於(String) principalCollection.fromRealm(getName()).iterator().next();
        String loginName = (String)super.getAvailablePrincipal(principalCollection);

        //到資料庫查是否有此物件(1.本地查詢 2.可以遠端查詢casserver 3.可以由casserver帶過來角色/許可權其它資訊)
        User user=userDao.getByName(loginName);// 實際專案中,這裡可以根據實際情況做快取,如果不做,Shiro自己也是有時間間隔機制,2分鐘內不會重複執行該方法
        if(user!=null){
            //許可權資訊物件info,用來存放查出的使用者的所有的角色(role)及許可權(permission)
            SimpleAuthorizationInfo info=new SimpleAuthorizationInfo();
            //給使用者新增角色(讓shiro去驗證)
            Set<String> roleNames = new HashSet<>();
            if(user.getName().equals("boy5")){
                roleNames.add("admin");
            }
            info.setRoles(roleNames);

            if(user.getName().equals("李四")){
                //給使用者新增許可權(讓shiro去驗證)
                info.addStringPermission("user:delete");
            }


            // 或者按下面這樣新增
            //新增一個角色,不是配置意義上的新增,而是證明該使用者擁有admin角色
//            simpleAuthorInfo.addRole("admin");
            //新增許可權
//            simpleAuthorInfo.addStringPermission("admin:manage");
//            logger.info("已為使用者[mike]賦予了[admin]角色和[admin:manage]許可權");
            return info;
        }
        // 返回null的話,就會導致任何使用者訪問被攔截的請求時,都會自動跳轉到unauthorizedUrl指定的地址
        return null;
    }

}
複製程式碼 複製程式碼
package com.hdwang.controller;

import com.hdwang.config.shiroCas.ShiroCasConfiguration;
import com.hdwang.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpSession;

/**
 * Created by hdwang on 2017/6/21.
 * 跳轉至cas server去登入(一個入口)
 */
@Controller
@RequestMapping("")
public class CasLoginController {

    /**
     * 一般用不到
     * @param model
     * @return
     */
    @RequestMapping(value="/login",method= RequestMethod.GET)
    public String loginForm(Model model){
        model.addAttribute("user", new User());
//      return "login";
        return "redirect:" + ShiroCasConfiguration.loginUrl;
    }


    @RequestMapping(value = "logout", method = { RequestMethod.GET,
            RequestMethod.POST })
    public String loginout(HttpSession session)
    {
        return "redirect:"+ShiroCasConfiguration.logoutUrl;
    }
}
複製程式碼 複製程式碼
package com.hdwang.controller;

import com.alibaba.fastjson.JSONObject;
import com.hdwang.entity.User;
import com.hdwang.service.datajpa.UserService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.mgt.SecurityManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * Created by hdwang on 2017/6/19.
 */
@Controller
@RequestMapping("/home")
public class HomeController {

    @Autowired
    UserService userService;

    @RequestMapping("")
    public String index(HttpSession session, ModelMap map, HttpServletRequest request){
//        User user = (User) session.getAttribute("user");

        System.out.println(request.getUserPrincipal().getName());
        System.out.println(SecurityUtils.getSubject().getPrincipal());

        User loginUser = userService.getLoginUser();
        System.out.println(JSONObject.toJSONString(loginUser));

        map.put("user",loginUser);
        return "home";
    }



}
複製程式碼

6.執行驗證

登入 

訪問:http://localhost:8081/home

輸入正確使用者名稱密碼登入跳轉回:http://localhost:8081/cas?ticket=ST-203-GUheN64mOZec9IWZSH1B-cas01.example.org

登出

訪問:http://localhost:8081/logout

cas server端登出(也行)

訪問:https://localhost:8443/cas/logout

再訪問:http://localhost:8081/home 會跳轉至登入頁,perfect!

參考文章

相關推薦

spring boot 1.5.4 整合shiro+cas實現登入許可權控制

1.安裝cas-server-3.5.2 官網:https://github.com/apereo/cas/releases/tag/v3.5.2 注意: 輸入 <tomcat_key> 的金鑰口令 (如果和金鑰庫口令相同, 按回車) ,這裡直接回車,也採用keystore密碼changei

spring boot 1.5.4 整合rabbitMQ(十七)

rabbitmq springboot springboot1.5.4 springboot整合jsp springboot整合rabbitmq 上一篇:spring boot 1.5.4 整合redis、攔截器、過濾器、監聽器、靜態資源配置(十六) 關於rabbitMQ原理,請參閱博客:

spring boot 1.5.4 集成devTools(五)

springboot springboot1.5.4 springboot整合jsp springboot之web開發 springboot熱部署devtools 上一篇:spring boot 1.5.4 整合JSP(四)1.1 Spring Boot集成devToolssprin

spring boot 1.5.4 定時任務異步調用(十)

springboot springboot1.5.4 springboot之web開發 springboot定時任務 springboot異步回調 上一篇:spring boot1.5.4 統一異常處理(九) 1 Spring Boot定時任務和異步調用我們在編寫Spring B

spring boot 1.5.4 統一異常處理(九)

springboot springboot1.5.4 springboot整合springdatajpa springboot集成jdbctemplate springboot異常處理 上一篇:springboot 1.5.4 配置文件詳解(八) 1 Spring Boot統一異

spring boot 1.5.4 從入門到實踐

springbootSpring Boot四個重要核心:自動配置:針對很多Sping應用程序常見的應用功能,Spring Boot能自動提供相關配置;起步依賴:告訴Spring Boot需要什麽功能,它就能引入需要的庫;命令行界面:這是Spring Boot的可選特性,借此你只需寫代碼就能完成完整的應用程序,

Spring Security3 使用中心認證服務(CAS)進行登入

高階CAS配置 CAS認證框架提供了高階的配置和與CAS服務的資料交換。在本節中,我們將會介紹CAS整合的高階配置。在我們覺得重要的地方將會包含相關的CAS配置指令,但是要記住的是CAS配置是很複雜的並超出了本書的範圍。 從CAS  assertion中獲取屬性 在CAS

springBoot整合spring security+JWT實現登入許可權管理前後端分離--築基中期

## 寫在前面 在前一篇文章當中,我們介紹了springBoot整合spring security單體應用版,在這篇文章當中,我將介紹springBoot整合spring secury+JWT實現單點登入與許可權管理。 本文涉及的許可權管理模型是**基於資源的動態許可權管理**。資料庫設計的表有 user

Shiro結合JWT實現登入

簡述 Apache Shiro是java的一個安全框架,Shiro可以幫助我們完成認證、授權、加密、會話管理、與Web整合、快取等。而且Shiro的API也比較簡單,這裡我們就不進行過多的贅述,想要詳細瞭解Shiro的,推薦看開濤的部落格(點這裡) 在Shiro的強大許可

fsockopen被禁用搞定discuz X2.5通訊實現登入登出

        空間安裝了discuz X2.5,安裝時提示fsockopen和pfsockopen函式被禁用,沒有理會繼續安裝,安裝過程沒出現錯誤但是進入後臺Ucenter卻發現通訊失敗,跟蹤了一下程式碼發現問題出現在uc_server/model/misc.php的9

SSO之CAS+LDAP實現登入認證

目錄: 概述 詳細步驟 LDAP安裝配置 CAS基礎安裝配置 CAS整合LDAP的配置 [一]、概述 本來主要詳細是介紹CAS和LDAP整合實現單點登入的步驟。 [二]、詳細步驟 安裝配置,新增部分測試資料如下

CAS+LDAP實現登入認證

<groupId>org.jasig.cas</groupId> <artifactId>cas-server-support-ldap</artifactId> <version>${cas.version}</version> <

基於CAS實現登入(SSO):CAS+LDAP實現登入認證

[一]、概述 CAS是N個系統的中心認證入口,而貫穿多個系統的使用者資訊是共用的,應該被單獨維護,而這些資訊可能屬於不用的系統,不用的組織,不用的國家,從而形成了樹形結構,而使用關係型資料庫維護樹形結構資訊是它的弱點,這就是本文CAS和LDAP整合的初衷。 本來主要

基於Spring Security Oauth2的SSO登入+JWT許可權控制實踐

概 述 在前文《基於Spring Security和 JWT的許可權系統設計》之中已經討論過基於 Spring Securit

spring-boot-1.5.15.RELEASE上傳檔案大小限制

背景 有一個上傳檔案介面,在其他專案執行正常 @PostMapping("/upload") public String upload(@RequestParam("file") MultipartFile file, @RequestParam("orgId") I

Spring Boot 1.5.* 升級 2.1 - 完善中

Spring Boot 原版本 1.5.12.RELEASE 新版本 2.1.0.RELEASE Spring Cloud 原版本 Edgware.SR3 新版本 Finchley.SR2   一、Actuator 部分   1. 原版本中暴露所有端點的配置是 management.secu

Spring Boot 1.5.x新特性:動態修改日誌級

Spring Boot 1.5.x新特性:動態修改日誌級 前天Spring Boot 1.5終於迎來了第一個RELEASE版本:1.5.0,但是由於一個編譯依賴問題在第二天直接連擊到了1.5.1。該版本的釋出包含了超過320位貢獻者的奉獻、10000多次的程式碼提交。 每次Sprin

spring boot整合Shiro實現登入

前面的部落格中,我們說道了Shiro的兩個最大的特點,認證和授權,而單點登入也是屬於認證的一部分,預設情況下,Shiro已經為我們實現了和Cas的整合,我們加入整合的一些配置就ok了。 1、加入shiro-cas包 <!-- shiro整合cas單點 -->

cas+tomcat+shiro實現登入-4-Apache Shiro 整合Cas作為cas client端實現

目錄 4.Apache Shiro 整合Cas作為cas client端實現 Apache Shiro 整合Cas作為cas client端實現 第一步、新增maven依賴      <!-- shiro依賴包 -->