Cas整合Shiro

Shiro与CAS集成:实现单点登录(SSO) 想象一个企业有OA系统、CRM系统、财务系统和HR系统。如果没有SSO,一个员工每天需要在这四个系统里分别登录,管理四套不同的密码,效率低下且容易混淆。单点登录(Single Sign-On)在一个多应用环境中,用户只需登录一次,就可以访问所有相互信任的应用系统,无需再次输入用户名和密码。它通过一个独立的、中央的认证中心来实现。所有的应用系统都信任这个中心,并将认证的"工作"全部委托给它。委托思想:SSO的核心是将认证的职责完全委托给一个可信的中央服务。 阅读详情

1.简介

CAS:Yale 大学发起的一个开源项目,旨在为 Web 应用系统提供一种可靠的单点登录方法。

Shiro:Apache Shiro是一个Java安全框架,可以帮助我们完成认证、授权、会话管理、加密等,并且提供与web集成、缓存、rememberMed等功能。

Shiro支持与CAS进行整合使用.

2.整合步骤

2.1.新建工程

在这里插入图片描述

2.2.导入项目中需要的依赖
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.bruce.cas.shiro.demo</groupId>
    <artifactId>CasShiro</artifactId>
    <version>1.0-SNAPSHOT</version>

    <!--导入SpringBoot的依赖-->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.4.RELEASE</version>
        <relativePath/>
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <shiro.version>1.2.4</shiro.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>


        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-ehcache</artifactId>
            <version>${shiro.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-spring</artifactId>
            <version>${shiro.version}</version>
        </dependency>


        <dependency>
            <groupId>org.apache.shiro</groupId>
            <artifactId>shiro-cas</artifactId>
            <version>${shiro.version}</version>
        </dependency>

        <dependency>
            <groupId>net.mingsoft</groupId>
            <artifactId>shiro-freemarker-tags</artifactId>
            <version>0.1</version>
        </dependency>

        <!--导入thymeleaf支持shiro的标签-->
        <dependency>
            <groupId>com.github.theborakompanioni</groupId>
            <artifactId>thymeleaf-extras-shiro</artifactId>
            <version>2.0.0</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>


</project>
2.3.启动类
package com.bruce;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * @BelongsProject: CasShiro
 * @BelongsPackage: com.bruce
 * @Author: bruceliu
 * @QQ:1241488705
 * @CreateTime: 2020-04-10 23:08
 * @Description: TODO
 */
@SpringBootApplication
public class App {

    public static void main(String[] args) {
        SpringApplication.run(App.class,args);
    }
}
2.4.配置文件
server.port=8888

#Thymeleaf配置
spring.thymeleaf.cache=false
spring.thymeleaf.encoding=utf-8
#设置为LEGACYHTML5编码格式
spring.thymeleaf.mode=LEGACYHTML5
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html

cas.casServerUrlPrefix=http://127.0.0.1:8080
cas.casServerLoginUrl=${cas.casServerUrlPrefix}/login
#cas.casServerLoginUrl=http://127.0.0.1:8081/shiroCAS/toLogin
cas.casServerLogoutUrl=${cas.casServerUrlPrefix}/logout?service=http://www.baidu.com
cas.casFilterUrlPattern=/shiro-cas
cas.localServerUrlPrefix=http://localhost:${server.port}
cas.localServerLoginUrl=${cas.casServerLoginUrl}?service=${cas.localServerUrlPrefix}${cas.casFilterUrlPattern}
2.5.加载CAS的配置文件

在这里插入图片描述

package com.bruce.config;

/**
 * @BelongsProject: CasShiro
 * @BelongsPackage: com.bruce.config
 * @Author: bruceliu
 * @QQ:1241488705
 * @CreateTime: 2020-04-17 22:45
 * @Description: TODO
 */
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * 这个类是shiro整合cas的时候需要的一些配置
 * 申明的一些变量
 */
@SpringBootConfiguration
@ConfigurationProperties(prefix = "cas")
public class CasConfig {

    private String casServerUrlPrefix = "https://server.fable.com:8443/cas";
    private String casServerLoginUrl = casServerUrlPrefix + "/login";
    private String casServerLogoutUrl = casServerUrlPrefix + "/logout";
    private String localServerUrlPrefix = "http://client1.fable.com:8081/aaaa";
    private String casFilterUrlPattern = "/shiro-cas";
    private String localServerLoginUrl = casServerLoginUrl + "?service=" + localServerUrlPrefix + casFilterUrlPattern;

    public String getCasServerUrlPrefix() {
        return casServerUrlPrefix;
    }

    public void setCasServerUrlPrefix(String casServerUrlPrefix) {
        this.casServerUrlPrefix = casServerUrlPrefix;
    }

    public String getCasServerLoginUrl() {
        return casServerLoginUrl;
    }

    public void setCasServerLoginUrl(String casServerLoginUrl) {
        this.casServerLoginUrl = casServerLoginUrl;
    }

    public String getCasServerLogoutUrl() {
        return casServerLogoutUrl;
    }

    public void setCasServerLogoutUrl(String casServerLogoutUrl) {
        this.casServerLogoutUrl = casServerLogoutUrl;
    }

    public String getLocalServerUrlPrefix() {
        return localServerUrlPrefix;
    }

    public void setLocalServerUrlPrefix(String localServerUrlPrefix) {
        this.localServerUrlPrefix = localServerUrlPrefix;
    }

    public String getCasFilterUrlPattern() {
        return casFilterUrlPattern;
    }

    public void setCasFilterUrlPattern(String casFilterUrlPattern) {
        this.casFilterUrlPattern = casFilterUrlPattern;
    }

    public String getLocalServerLoginUrl() {
        return localServerLoginUrl;
    }

    public void setLocalServerLoginUrl(String localServerLoginUrl) {
        this.localServerLoginUrl = localServerLoginUrl;
    }

    public String getCasService() {
        return localServerUrlPrefix + casFilterUrlPattern;
    }
}


2.6.配置Realm
package com.bruce.shiro;

import com.bruce.pojo.User;
import com.bruce.service.IUserService;
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.springframework.beans.factory.annotation.Autowired;

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


/**
 * shiro和cas整合之后 继承CasRealm
 */
public class MyShiroCasRealm extends CasRealm{

    @Autowired
    private IUserService userService;

    /**
     * 权限认证(为当前登录的Subject授予角色和权限)
     *
     * 该方法的调用时机为需授权资源被访问时,并且每次访问需授权资源都会执行该方法中的逻辑,这表明本例中并未启用AuthorizationCache,
     * 如果连续访问同一个URL(比如刷新),该方法不会被重复调用,Shiro有一个时间间隔(也就是cache时间,在ehcache-shiro.xml中配置),
     * 超过这个时间间隔再刷新页面,该方法会被执行
     */
    @Override
    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
        String loginName = (String) super.getAvailablePrincipal(principals);
        User user = userService.findByUsername(loginName);
        if (user != null){
            
            // 权限信息对象info,用来存放查出的用户的所有的角色及权限
            SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
            //下面就是查询用户的权限
            Set<String> roles=new HashSet<String>();
            roles.add("admin");
            roles.add("normal");
            //下面也就可以查询用户的角色
            Set<String> perms=new HashSet<String>();
            perms.add("del");
            perms.add("query");
            perms.add("user:query");

            info.setRoles(roles);
            info.setStringPermissions(perms);

            System.out.println("这里是授权的地方..............................");
            return info;
        }
        // 返回null将会导致用户访问任何被拦截的请求时都会自动跳转到unauthorizedUrl指定的地址
        return null;
    }
}
2.7.配置ShiroFilterFactoryBean
package com.bruce.shiro;

import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.filter.mgt.FilterChainManager;
import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver;
import org.apache.shiro.web.mgt.WebSecurityManager;
import org.apache.shiro.web.servlet.AbstractShiroFilter;
import org.springframework.beans.factory.BeanInitializationException;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;

/**
 * 继承ShiroFilterFactoryBean处理拦截资源文件问题
 */
public class MyShiroFilterFactoryBean extends ShiroFilterFactoryBean {
    // ShiroFilter将直接忽略的请求
    private Set<String> ignoreExt;

    public MyShiroFilterFactoryBean() {
        super();
        ignoreExt = new HashSet<String>();
        ignoreExt.add(".jpg");
        ignoreExt.add(".png");
        ignoreExt.add(".gif");
        ignoreExt.add(".bmp");
        ignoreExt.add(".js");
        ignoreExt.add(".css");
    }

    @Override
    protected AbstractShiroFilter createInstance() throws Exception {
        SecurityManager securityManager = getSecurityManager();
        if (securityManager == null) {
            throw new BeanInitializationException("SecurityManager property must be set.");
        }

        if (!(securityManager instanceof WebSecurityManager)) {
            throw new BeanInitializationException("The security manager does not implement the WebSecurityManager interface.");
        }

        PathMatchingFilterChainResolver chainResolver = new PathMatchingFilterChainResolver();
        FilterChainManager chainManager = createFilterChainManager();
        chainResolver.setFilterChainManager(chainManager);
        return new MySpringShiroFilter((WebSecurityManager) securityManager, chainResolver);
    }

    private class MySpringShiroFilter extends AbstractShiroFilter {
        public MySpringShiroFilter(
                WebSecurityManager securityManager, PathMatchingFilterChainResolver chainResolver) {
            super();
            if (securityManager == null) {
                throw new IllegalArgumentException("WebSecurityManager property cannot be null.");
            }
            setSecurityManager(securityManager);
            if (chainResolver != null) {
                setFilterChainResolver(chainResolver);
            }
        }

        @Override
        protected void doFilterInternal(ServletRequest servletRequest, ServletResponse servletResponse,
                                        FilterChain chain)
                throws ServletException, IOException {
            HttpServletRequest request = (HttpServletRequest) servletRequest;
            String str = request.getRequestURI().toLowerCase();
            boolean flag = true;
            int idx = 0;
            if ((idx = str.indexOf(".")) > 0) {
                str = str.substring(idx);
                if (ignoreExt.contains(str.toLowerCase())) {
                    flag = false;
                }
            }
            if (flag) {
                super.doFilterInternal(servletRequest, servletResponse, chain);
            } else {
                chain.doFilter(servletRequest, servletResponse);
            }
        }
    }
}

2.8. Shiro集成CAS配置
package com.bruce.shiro;

import com.bruce.config.CasConfig;
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.mgt.DefaultWebSecurityManager;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.DelegatingFilterProxy;

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

/**
 * Shiro集成CAS配置
 */
@Configuration
@EnableConfigurationProperties(CasConfig.class)
public class ShiroCasConfiguration {

    private static final String CAS_FILTER = "casFilter";

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

    @Bean(name = "myShiroCasRealm")
    public MyShiroCasRealm myShiroRealm(EhCacheManager ehCacheManager, CasConfig casConfig){
        MyShiroCasRealm realm = new MyShiroCasRealm();
        realm.setCacheManager(ehCacheManager);
        realm.setCasServerUrlPrefix(casConfig.getCasServerUrlPrefix());
        realm.setCasService(casConfig.getCasService());
        return realm;
    }

    /**
     * 注册shiroFilter
     */
    @Bean
    public FilterRegistrationBean filterRegistrationBean(){
        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 lifecycleBeanPostProcessor(){
        return new LifecycleBeanPostProcessor();
    }

    @Bean
    public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator(){
        DefaultAdvisorAutoProxyCreator creator = new DefaultAdvisorAutoProxyCreator();
        creator.setProxyTargetClass(true);
        return creator;
    }

    @Bean(name = "securityManager")
    public DefaultWebSecurityManager defaultWebSecurityManager(MyShiroCasRealm realm){
        DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
        securityManager.setRealm(realm);
        securityManager.setCacheManager(ehcacheManager());
        // 指定SubjectFactory
        securityManager.setSubjectFactory(new CasSubjectFactory());
        return securityManager;
    }

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

    @Bean(name = "shiroFilter")
    public ShiroFilterFactoryBean shiroFilterFactoryBean(DefaultWebSecurityManager securityManager, CasConfig casConfig, CasFilter casFilter){
        ShiroFilterFactoryBean factoryBean = new MyShiroFilterFactoryBean();
        factoryBean.setSecurityManager(securityManager);
        factoryBean.setLoginUrl(casConfig.getLocalServerLoginUrl());
        factoryBean.setSuccessUrl("/user");
        factoryBean.setUnauthorizedUrl("/403");
        // 添加casFilter到shiroFilter中
        Map<String, Filter> filterMap = new HashMap<String, Filter>(1);
        filterMap.put(CAS_FILTER, casFilter);
        factoryBean.setFilters(filterMap);
        loadShiroFilterChain(factoryBean, casConfig);
        return factoryBean;
    }

    /**
     * 加载ShiroFilter权限控制规则
     */
    private void loadShiroFilterChain(ShiroFilterFactoryBean factoryBean, CasConfig casConfig) {
        /**下面这些规则配置最好配置到配置文件中*/
        Map<String, String> filterChainMap = new LinkedHashMap<String, String>();
        filterChainMap.put(casConfig.getCasFilterUrlPattern(), CAS_FILTER);//shiro集成cas后,首先添加该规则
        filterChainMap.put("/main", "anon");
        filterChainMap.put("/**", "authc");
        factoryBean.setFilterChainDefinitionMap(filterChainMap);
    }

    /**
     * CAS过滤器
     */
    @Bean
    public CasFilter casFilter(CasConfig casConfig){
        CasFilter casFilter = new CasFilter();
        casFilter.setName(CAS_FILTER);
        casFilter.setEnabled(true);
        casFilter.setFailureUrl(casConfig.getLocalServerLoginUrl());
        return casFilter;
    }

}

2.9.集成Shiro标签
import at.pollux.thymeleaf.shiro.dialect.ShiroDialect;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Bean;

/**
 * 集成Shiro标签
 */
@SpringBootConfiguration
public class ShiroTagThymeleafConfigurer{
    /**
     * 配置的是方言
     * @return
     */
    @Bean
    public ShiroDialect shiroDialect() {
        return new ShiroDialect();
    }
}
2.10.页面使用
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="UTF-8"/>
    <title>Title</title>
</head>
<body>
<h1>用户列表-<a href="logout">登出</a></h1>
<h2>权限列表</h2>
<shiro:authenticated>用户已经登录显示此内容</shiro:authenticated><br/>
<shiro:hasRole name="manager">manager角色登录显示此内容</shiro:hasRole><br/>
<shiro:hasRole name="admin">admin角色登录显示此内容</shiro:hasRole><br/>
<shiro:hasRole name="normal">normal角色登录显示此内容</shiro:hasRole><br/>
<shiro:hasAnyRoles name="manager,admin">manager或admin角色用户登录显示此内容</shiro:hasAnyRoles><br/>
<shiro:principal>-显示当前登录用户名-</shiro:principal><br/>
<shiro:hasPermission name="add">add权限用户显示此内容</shiro:hasPermission><br/>
<br/>所有用户列表:<br/>

<ul th:each="user1,iterStat: ${userList}">
    <li th:text="${user1.userName}"></li>
</ul>

</body>
</html>
shiro整合cas多次验证或者重复重定向问题 很多人初学都会遇到多次验证或者重复重定向,然后拿着异常网上各种查资料,到最后会发现,是因为shiro封装了指定的返回路劲:/、/index、上次request地址 通过配置文件配置的路劲,只是一个辅助作用,在shiro找不到跳转路劲后才会跳转到配置的路劲,所以我们要做的就是:重写跳转方法。 阅读详情

相关推荐

Axure RP 9在Windows 11环境下的高效安装与配置指南

本文提供Axure RP 9在Windows 11系统下的详细安装步骤与配置指南。针对Win11安全特性,从获取官方安装资源、调整系统权限,到定制化安装路径、精准汉化及性能优化,系统性地解决了安装闪退、汉化失败、运行卡顿等常见问题,确保用户获得稳定流畅的原型设计体验。

mango的博客 480

Cas单点登录(整合shiro版本)

单点登录:Single Sign On,简称SSO,SSO使得在多个应用系统中,用户只需要登录一次就可以访问所有相互信任的应用系统。 CAS框架:CAS(Central Authentication Service)是实现SSO单点登录的框架。 逻辑关系图:(注:图为转载) [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-bnslZ5ZI-1649903084532)(https://blog.youkuaiyun.com/qq_25223941/article/details/78316

m0_67392811的博客 2473

计算机网络实验(华为eNSP模拟器)——第十章 Eth-Trunk(链路聚合)

目录一、Eth-Trunk的定义二、Eth-Trunk的工作模式(一)LACP模式1、定义2、命令(二)手工负载分担模式1、定义2、命令三、结语 一、Eth-Trunk的定义 Eth-Trunk是指设备的链路聚合,即将该设备的多个接口捆绑成一个接口,从而达到了增加带宽和提高可靠性的目的。我们要注意它是将多条物理链路,在逻辑上合并成一条,而不是串在一起。例我们将LSW1交换机S5700的三个端口(即GE0/0/1 、GE0/0/2、GE0/0/3)定义为一个Eth-Trunk接口与LSW2交换机相连,如下:

小宇y的博客 8417

Shiro和Cas的集成

前面的博客中,我们说道了Shiro的两个最大的特点,认证和授权,而单点登录也是属于认证的一部分,默认情况下,Shiro已经为我们实现了和Cas的集成,我们加入集成的一些配置就ok了。 1、加入shiro-cas包 <dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-cas</artifactId> <v...

梦想起飞的地方......... 5834

51单片机也能玩转GC9A01彩屏?超详细移植指南与性能优化技巧

本文详细介绍了如何在51单片机上高效驱动GC9A01彩屏,包括硬件连接优化、SPI模拟驱动、内存管理策略及高级刷新技术。通过分段缓冲、颜色压缩和差异化刷新等技巧,显著提升显示性能,使51单片机也能流畅运行240x240分辨率的彩色TFT屏幕。

hp777的博客 190

硬全桥副边钳位管Vds电压凸台揭秘——寄生参数引发的导通异常

本文深入分析了硬全桥副边钳位管Vds电压凸台现象,揭示了寄生参数如何引发导通异常。通过波形分析和工程实践,详细解析了走线电感的蓄能效应和体二极管的接力作用,并提供了PCB布局优化、元件选型和驱动电路调整等解决方案,帮助工程师有效应对这一常见问题。

weixin_30825581的博客 430

基于SpringbootShiro实现的CAS单点登录

单点登录(Single Sign On,SSO)是一种登录管理机制,主要用于多系统集成,即在多个系统中,用户只需要到一个中央服务器登录一次即可访问这些系统中的任何一个,无须多次登录。常见的例子就是,当我们在淘宝网上登录了之后,如果再访问天猫网的话是不需要再次登录的。

神尐破 4557

Xilinx Aurora 8B/10B IP核详解和仿真

Xilinx Aurora 8b/10b IP核的详解,以及使用与仿真示例,对IP核的配置和如何仿真有非常详细的说明,除了对IP核官方文档的内容进行了解析以外,还对GTX引脚的选择等比较容易混淆和不好理解的地方进行了说明。最后对IP核的仿真运行进行了STEP BY STEP 的说明,对仿真的结果也进行了简要的说明。 该文档对Xilinx FPGA和ZYNQ SOC下 AURORA 8B/10B IP核的使用提供了一个快速上手的指导。

weixin_43354598的博客 1万+

CAS整合Shiro单点登录企业级实战(基于Java,附源码)

Cas的全称是Centeral Authentication Service,是对单点登录SSO(Single Sign On)的一种实现。其由Cas Server和Cas Client两部分组成,Cas Server是核心,而Cas Client通常就对应于我们的应用。一个Cas Server可以对应于多个Cas Client。它允许我们在一个Client进行登录以后无需再让用户输入用户名和密码进行认证即可访问其它Client应用。

系统磁盘从MBR格式转换成GPT格式来升级win11

之前的《》中说到,需要把磁盘格式转化为MBR格式才能执行下去。问题是,win10升级win11要求启动方式为UEFI的话,磁盘格式不能为MBR。其实不升级也不影响啥,但是就是想好看点。所以花了点时间折腾了一下。我这是双系统,所以直接去A系统修复B系统的磁盘格式和引导。

qq_42520962的博客 9041

【温室气体数据集】CAMS 发布的温室气体(GHG)数据集总结

【温室气体数据集】CAMS 发布的温室气体(GHG)数据集总结

WW、forever的博客 555

springboot shiro cas整合

springboot shiro cas整合pom.xml中引入如下jar增加ShiroCasConfig.java配置类自定义MyShiroCasRealm.java继承CasRealmcas退出过滤器LogoutFilter.java pom.xml中引入如下jar <!--shiro 和 cas单点登录--> <dependency> <group...

csdn565973850的博客 5159

3D Slicer学习记录(4)-PLUSapp连接双目相机Intel Realsense

plusapp是基于openIGTLink协议的免费的开源库和应用程序API接口,用于数据采集、预处理、校准和实时流成像、位置跟踪和其他传感器数据。这里以intel realsense双目相机为例详细的演示整个图像流导入到3D Slicer的流程。

weixin_39090239的博客 1346

shiro与cas整合实现单点登陆

1.简介 CAS:Yale 大学发起的一个开源项目,旨在为 Web 应用系统提供一种可靠的单点登录方法。 Shiro:Apache Shiro是一个Java安全框架,可以帮助我们完成认证、授权、会话管理、加密等,并且提供与web集成、缓存、rememberMed等功能。 *Shiro支持与CAS进行整合使用. 2.CAS Server搭建 参考:https://w...

gshzh的博客 1258

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

cas4.2.7与shiro进行整合

准备工作   cas单点登录开始前准备,请参考cas4.2.7实现单点登录。 与shiro进行整合   注:准备工作的基础上,对cas客户端进行如下改进。   引入相关jar包 shiro-cas-1.2.6.jar shiro-core-1.2.6.jar shiro-spring-1.2.6.jar shiro-web-1.2.6.jar   web.xml...

aipiannian6725的博客 184

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

shiro安全框架扩展教程--整合cas框架扩展自定义CasRealm

这次我给大家讲讲如何在shiro中整合cas框架,以及扩展自定义的角色和资源体系,啰嗦话不多说了,直接上代码说明第一步,搭建cas服务器,我也不说拉,这个大家用现有的cas服务就行了第二步,先加入cas-client的包到我们的项目,然后再下载个shiro-cas.jar也放到项目里第三步配置shiro中的cas设置

shadowsick的专栏 2万+

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

yale-cas 与 shiro进行整合

注意:cas-client.version 3.2.1版本。3.3.0版本单点登出存在问题,还在研究。 一.普通的CAS客户端整合 1.CAS与客户端直接整合 参考资料:Configuring the Jasig CAS Client for Java in the web.xml 相关配置直接写在web.xml文件中 内容如下: &lt;!DOCTYPE web-app PUBL...

sgq0085的专栏 251

Shiro与CAS整合实现单点登录

1.简介 CAS:Yale 大学发起的一个开源项目,旨在为 Web 应用系统提供一种可靠的单点登录方法。 Shiro:Apache Shiro是一个Java安全框架,可以帮助我们完成认证、授权、会话管理、加密等,并且提供与web集成、缓存、rememberMed等功能。 *Shiro支持与CAS进行整合使用. 2.CAS Server搭建 参考:http...

weixin_30488085的博客 617

从零实现自动跳过广告:无障碍服务原理与实战

Android无障碍服务(AccessibilityService)是系统提供的一套UI自动化能力,允许应用监听界面变化并模拟点击操作。基于这一机制,开发者能够实现自动跳过开屏广告、自动关闭弹窗等实用功能。理解其工作原理,包括控件树获取、事件监听、规则匹配和模拟点击,是构建稳定自动化工具的关键。此类技术广泛应用于辅助点击、自动化测试、手机管家等场景,极大提升操作效率。本文以自动跳过广告工具为切入点,从底层原理到工程实现,手把手带开发者搭建一个最小可用的无障碍自动化应用,并总结机型适配、服务保活等实战经验。

weixin_34162228的博客 133

Spring+Shiro+CAS整合配置笔记

一、前言Apache Shiro与Spring Security一样是Java的一个安全框架。那为什么与Spring整合却用Shiro?不要问为什么,任性!开个玩笑:D 其实我个人是认为Spring Security太过于笨重,要写太多的过滤器。我是个怕麻烦的人,Shiro的配置简单这就是我选择的理由,何况Spring官方自己都推荐使用Shiro。而Shiro权限控制...

weixin_34010949的博客 220
上一篇: CAS自定义数据加密算法
下一篇: 软件架构浅析-BASE理论
熊猫IT技术
熊猫IT技术 优质创作者: Java技术领域 优质创作者: Java技术领域 领域专家: 后端开发技术领域 领域专家: 后端开发技术领域
博客等级 码龄10年 6021粉丝 1312原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

熊猫IT技术

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值