当前位置: 首页 > news >正文

网站设计策划书案例怎样做网站建设的程序

网站设计策划书案例,怎样做网站建设的程序,包头建站,cpa广告联盟平台1 Shiro 什么是 Shiro 官网#xff1a; http://shiro.apache.org/ 是一款主流的 Java 安全框架#xff0c;不依赖任何容器#xff0c;可以运行在 Java SE 和 Java EE 项目中#xff0c;它的主要作用是对访问系统的用户进行身份认证、 授权、会话管理、加密等操作。 … 1 Shiro 什么是 Shiro 官网 http://shiro.apache.org/ 是一款主流的 Java 安全框架不依赖任何容器可以运行在 Java SE 和 Java EE 项目中它的主要作用是对访问系统的用户进行身份认证、 授权、会话管理、加密等操作。 Shiro 就是用来解决安全管理的系统化框架。 2 Shiro 核心组件 用户、角色、权限 会给角色赋予权限给用户赋予角色 1 、 UsernamePasswordToken Shiro 用来封装用户登录信息使用 用户的登录信息来创建令牌 Token 。 2 、 SecurityManager Shiro 的核心部分负责安全认证和授权。 3 、 Suject Shiro 的一个抽象概念包含了用户信息。 4 、 Realm 开发者自定义的模块根据项目的需求验证和授权的逻 辑全部写在 Realm 中。 5 、 AuthenticationInfo 用户的角色信息集合认证时使用。 6 、 AuthorzationInfo 角色的权限信息集合授权时使用。 7 、 DefaultWebSecurityManager 安全管理器开发者自定义的 Realm 需要注入到 DefaultWebSecurityManager 进行管理才能生 效。 8 、 ShiroFilterFactoryBean 过滤器工厂 Shiro 的基本运行机制是开 发者定制规则Shiro 去执行具体的执行操作就是由 ShiroFilterFactoryBean 创建的一个个 Filter 对象来完成。 Shiro 的运行机制如下图所示。 3 Spring Boot 整合 Shiro 1 、创建 Spring Boot 应用集成 Shiro 及相关组件 pom.xml ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersiongroupIdcom.example/groupIdartifactIdspringboot-shiro/artifactIdversion0.1.0/versionpropertiesjava.version11/java.versionspring.boot.version2.5.4/spring.boot.versionshiro.version1.7.1/shiro.version/propertiesdependencies!-- Spring Boot Starter Web --dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-web/artifactIdversion${spring.boot.version}/version/dependency!-- Shiro Starter --dependencygroupIdorg.apache.shiro/groupIdartifactIdshiro-spring-boot-starter/artifactIdversion${shiro.version}/version/dependency!-- Other Dependencies --!-- Add other dependencies here if needed --/dependenciesbuildplugins!-- Maven Compiler Plugin --plugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-compiler-plugin/artifactIdversion3.8.1/versionconfigurationsource${java.version}/sourcetarget${java.version}/target/configuration/plugin!-- Spring Boot Maven Plugin --plugingroupIdorg.springframework.boot/groupIdartifactIdspring-boot-maven-plugin/artifactIdversion${spring.boot.version}/version/plugin/plugins/build/project2 、自定义 Shiro 过滤器 import sun.net.www.protocol.http.AuthenticationInfo;public class AccoutRealm extends AuthorizingRealm {Autowiredprivate AccountService accountService;/*** 授权** param principalCollection* return*/Overrideprotected AuthorizationInfodoGetAuthorizationInfo(PrincipalCollection principalCollection) {return null;}/*** 认证** param authenticationToken* return* throws AuthenticationException*/Overrideprotected AuthenticationInfodoGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {UsernamePasswordToken token (UsernamePasswordToken) authenticationToken;Account account accountService.findByUsername(token.getUsername());if (account ! null) {return new SimpleAuthenticationInfo(account, account.getPassword(), getName());}return null;} }3、配置类  Configuration public class ShiroConfig { Bean public ShiroFilterFactoryBean shiroFilterFactoryBean(Qualifier(securityManager) DefaultWebSecurityManager securityManager){ ShiroFilterFactoryBean factoryBean new ShiroFilterFactoryBean(); factoryBean.setSecurityManager(securityManager); return factoryBean; } Bean public DefaultWebSecurityManager securityManager(Qualifier(accoutRealm) AccoutRealm accoutRealm){ DefaultWebSecurityManager manager new DefaultWebSecurityManager(); manager.setRealm(accoutRealm); return manager; } Bean public AccoutRealm accoutRealm(){ return new AccoutRealm(); } } 编写认证和授权规则 认证过滤器 anon 无需认证。 authc 必须认证。 authcBasic 需要通过 HTTPBasic 认证。 user 不一定通过认证只要曾经被 Shiro 记录即可比如记住我。 授权过滤器 perms 必须拥有某个权限才能访问。 role 必须拥有某个角色才能访问。 port 请求的端口必须是指定值才可以。 rest 请求必须基于 RESTful POST 、 PUT 、 GET 、 DELETE 。 ssl 必须是安全的 URL 请求协议 HTTPS 。 创建 3 个页面 main.html 、 manage.html 、 administrator.html 访问权限如下 1 、必须登录才能访问 main.html 2 、当前用户必须拥有 manage 授权才能访问 manage.html 3 、当前用户必须拥有 administrator 角色才能访问 administrator.html Shiro 整合 Thymeleaf 1 、 pom.xml 引入依赖 dependency groupId com.github.theborakompanioni /groupId artifactId thymeleaf-extras-shiro /artifactId version 2.0.0 /version /dependency 2 、配置类添加 ShiroDialect Bean public ShiroDialect shiroDialect (){ return new ShiroDialect (); } 3 、 index.html !DOCTYPE html html lang en xmlns:th http://www.thymeleaf.org xmlns:shiro http://www.thymeleaf.org/thymeleaf-extras shiro head meta charset UTF-8 title Title /title link rel shortcut icon href # / /head body h1 index /h1 div th:if ${session.account ! null} span th:text ${session.account.username} 欢 迎回来 /spana href /logout 退出 /a /div a href /main main /a br/ div shiro:hasPermission manage a href manage manage /a br/ /div div shiro:hasRole administrator a href /administrator administrator /a /div /body /html 数据库
http://www.hkea.cn/news/14425936/

相关文章:

  • wap网站html5国外做油画的网站
  • 古镇 网站建设商赢网站建设
  • 网站建设辶首选金手指十五商城微网站模板
  • 类似站酷的设计类网站沈阳德泰诺网站建设公司 概况
  • 核工业南京建设集团有限公司南宁百度快速排名优化
  • cc域名做门户网站接app推广的单子在哪接
  • 做类似58同城的网站wordpress 生成海报
  • 网站水晶头怎么做口碑好的网站建设
  • 网站服务费怎么做分录网页设计工作心得
  • 泉州网站建设多少钱关键词排名查询软件
  • 网站策划与设计(做网站公司简介模版
  • 网站正在建设维护中网站建设教程论坛
  • 网页建站点网站建设在医院的作用
  • 大兴快速网站建设公司防恶意竞价点击软件
  • 安卓市场网站建设网站导航设计原则
  • 签订网站制作合同注意事项台州网站建设系统
  • 东莞如何建网站费用自己创业做原公司一样的网站
  • 宜昌 房地产网站建设申请注册公司费用
  • 自己建设网站平台步骤施工企业风险防控
  • 怎样做展会推广网站wordpress 编辑器模板
  • 网站配色 蓝色东莞高埗做网站哪个公司好
  • 天津百度推广公司地址中山网站建设seo优化营销制作设计
  • 工信部网站备案方法wordpress托管服务
  • 网站之家搭建自己的网站
  • 淘宝网站用什么语言做的重庆网站推广优化软件业务
  • 公司网站建设维护上海营业执照查询网上查询
  • 动漫网站实现功能无锡阿凡达
  • 怎么做网站镜像中煤第五建设有限公司网站
  • 丹徒网站建设包括哪些联通营业厅做网站维护
  • 昆明驿站网站建设kali建设网站