realm

Shiro简单使用

99封情书 提交于 2020-02-25 20:01:13
Shiro 1、简介 Apache Shiro是一个Java的安全(权限)框架。 Shiro可以非常容易的开发出足够好的应用,其不仅可以用在JavaSE环境,也可以用在JavaEE环境。 Shiro可以完成 认证、授权、加密、会话管理、Web集成、缓存等。 下载地址: https://shiro.apache.org/ 2、运行原理 Subject :Subject其实代表的就是当前正在执行操作的用户,只不过因为“User”一般指代人,但是一个“Subject”可以是人,也可以是任何的第三方系统,服务账号等任何其他正在和当前系统交互的第三方软件系统。 SecurityManager :安全管理器。即 所有的安全有关的操作都会与SecurityManager交互,并且它管理着所有的subject 。 Realm :可以有一个或者多个Realm,可以认为是安全实体数据源,即用于获取安全实体的。 3、Shiro过滤器 Shiro内置过滤器,可以实现权限相关的拦截器。 常用的过滤器 说明 anon 无需认证(登陆)就可以访问 authc 必须认证才可以访问 user 如果使用rememberMe的功能可以直接访问 perms 拥有对某个资源的权限才可以访问 roles 拥有某个角色才可以访问 4、Springboot整合Shiro 4.1、添加依赖 <!--mysql依赖-->

Tomcat 核心配置

倖福魔咒の 提交于 2020-02-25 19:15:55
tomcat的核心配置在conf/server.xml中。 <Server> 根元素 <Server>即Catalina Servlet组件。 <Server port="8005" shutdown="SHUTDOWN"> 常用属性 Address—Tomcat监听shutdown命令的地址,默认为localhost className—指定实现org.apache.catalina.Server接口的类,默认值为org.apache.catalina.core.StandardServer port-Tomcat监听shutdown命令的端口。设置为-1,则禁止通过端口关闭Tomcat,同时shutdown.bat也不能使用 shutdown-通过指定的地址(Address)、端口(port)关闭Tomcat所需的字符串。 shutdown属性使用示例 启用Telnet:(Telnet是windows自带的与其它主机通信的程序) win+s,输入telnet,匹配“启用或关闭windows功能”,回车,勾选telent 命令行输入 telnet 启动Telnet 输入 telnet localhost 8005 连接到指定主机(此处为本地主机) 输入 SHUTDOWN 即可关闭Tomcat 输入 quit 可退出Telnet <Server>有3个子元素:<Listener>、

shiro认证和授权

风格不统一 提交于 2020-02-24 18:35:20
一、shiro基础概念 Authentication :身份认证 / 登录,验证用户是不是拥有相应的身份; Authorization :授权,即权限验证,验证某个已认证的用户是否拥有某个权限;即判断用户是否能做事情,常见的如:验证某个用户是否拥有某个角色。或者细粒度的验证某个用户对某个资源是否具有某个权限; Session Manager :会话管理,即用户登录后就是一次会话,在没有退出之前,它的所有信息都在会话中;会话可以是普通 JavaSE 环境的,也可以是如 Web 环境的; Cryptography :加密,保护数据的安全性,如密码加密存储到数据库,而不是明文存储; Web Support :Web 支持,可以非常容易的集成到 Web 环境; Caching :缓存,比如用户登录后,其用户信息、拥有的角色 / 权限不必每次去查,这样可以提高效率; Concurrency :shiro 支持多线程应用的并发验证,即如在一个线程中开启另一个线程,能把权限自动传播过去; Testing :提供测试支持; Run As :允许一个用户假装为另一个用户(如果他们允许)的身份进行访问; Remember Me :记住我,这个是非常常见的功能,即一次登录后,下次再来的话不用登录了。 记住一点,Shiro 不会去维护用户、维护权限;这些需要我们自己去设计 / 提供

关于shiro

北慕城南 提交于 2020-02-22 17:53:16
shiro作为一个功能强大而且可靠的安全框架拥有很多Api,结合spring可以很方便的实现有关shiro的使用。 这是关于shiro内部的架构图官网上的。下面做个简单的介绍: subject:主体,可以是用户也可以是程序,主体要访问系统,系统需要对主体进行认证、授权。 securityManager:安全管理器,主体进行认证和授权都 是通过securityManager进行。 authenticator:认证器,主体进行认证最终通过authenticator进行的。 authorizer:授权器,主体进行授权最终通过authorizer进行的。 sessionManager:web应用中一般是用web容器对session进行管理,shiro也提供一套session管理的方式。 SessionDao: 通过SessionDao管理session数据,针对个性化的session数据存储需要使用sessionDao。 cache Manager:缓存管理器,主要对session和授权数据进行缓存,比如将授权数据通过cacheManager进行缓存管理,和ehcache整合对缓存数据进行管理。 realm:域,领域,相当于数据源,通过realm存取认证、授权相关数据。 下面时一些shiro提供的方法 可继承重写 Subject Subject即主体,外部应用与subject进行交互

How to write a better data access layer with Realm

两盒软妹~` 提交于 2020-02-21 11:18:44
问题 I've been using Realm in a few small projects and I quite like it. I'm hoping to move on to using it in bigger projects and I'm looking for better structure my data access layer. I came across this similar question and tried to build up on the information I found there. The approach discussed there is the DAO pattern so I gave a shot at that. This is my model class. class Chat: Object { dynamic var id: String = "" dynamic var createdAt: Date = Date() dynamic var creatorId: String = "" dynamic

RealmSwift: No such module 'RealmSwift'

回眸只為那壹抹淺笑 提交于 2020-02-21 10:28:46
问题 I configured RealmSwift 1.0.0 Latest Using Docs into the Xcode project. After installation i created a class file and getting module error - like: No such module 'RealmSwift' in class file. 1. 2. 3. 4. After adding the Realm Plugin, i created a class and get the module error below. Please help me to solve this error. 回答1: It looks like you've added the path to RealmSwift.framework to your framework search paths. The Realm Swift installation instructions say to add the parent path of

RealmSwift: No such module 'RealmSwift'

时光怂恿深爱的人放手 提交于 2020-02-21 10:28:26
问题 I configured RealmSwift 1.0.0 Latest Using Docs into the Xcode project. After installation i created a class file and getting module error - like: No such module 'RealmSwift' in class file. 1. 2. 3. 4. After adding the Realm Plugin, i created a class and get the module error below. Please help me to solve this error. 回答1: It looks like you've added the path to RealmSwift.framework to your framework search paths. The Realm Swift installation instructions say to add the parent path of

Transform object to list[object] in Realm ( How can i replace a list[objects] with object field in Realm? )

允我心安 提交于 2020-02-12 05:26:49
问题 I want to import existing token into tokenList as first item , for example if someone has a token="abc" after migration , i want he/she has tokenList that tokenList[0]=="abc" This is my migration code: public class RealmMigration implements io.realm.RealmMigration { . . . if (oldVersion == 3) { final RealmObjectSchema bankSchema = realmSchema.get("Bank"); final RealmObjectSchema tokenSchema = realmSchema.get("Token"); DynamicRealmObject bank = realm.createObject("Bank",1); Token token = bank

Shiro简介

杀马特。学长 韩版系。学妹 提交于 2020-02-09 18:31:09
之前在工作中有比较快速的学习过Shiro安全框架,但经过一年的荒废,已经不是很熟悉了,通过这个系列,深入研究和学习Shiro的一些知识,填补安全管理方面的知识漏洞。使我们在web 开发领域更具竞争力,不做只会CRUD的程序员! 一、Shiro介绍 Shiro是一个Java安全框架,执行身份验证、授权、密码、会话管理。Shiro是Apache 的一个开源项目,前身是JSecurity 项目,始于2003年初。 Shiro 可以为任何应用提供安全保障 - 从命令行应用、移动应用到大型网络及企业应用。 shiro 解决了应用安全的四要素: 认证 - 用户身份识别,常被称为用户“登录”; 授权 - 访问控制; 密码加密 - 保护或隐藏数据防止被偷窥; 会话管理 - 每用户相关的时间敏感的状态。 同时,Shiro另外支持了一些辅助特性:如 Web 应用安全、单元测试和多线程,它们的存在强化了上面提到的四个要素。 二、Shiro的优势 从 2003 年至今,框架选择方面的情况已经改变了不少,但今天仍有令人信服的理由让你选择 Shiro。其实理由相当多,Apache Shiro: 1、易于使用 - 易用性是这个项目的最终目标。应用安全有可能会非常让人糊涂,令人沮丧,并被认为是“必要之恶”【译注:比喻应用安全方面的编程。】。若是能让它简化到新手都能很快上手,那它将不再是一种痛苦了。 2、广泛性 -

Removed Realm, but still getting this error: module importing failed: invalid token (rlm_lldb.py, line 37) File “temp.py”, line 1,

不问归期 提交于 2020-02-06 08:21:10
问题 I tried using Realm with Cocoapods in a project two years ago. Realm didn't work out, so I removed it. Cocoapods didn't work out, so I eventually removed that as well and switched to Carthage. With the advent of Xcode 11, I started seeing this error: error: module importing failed: invalid token (rlm_lldb.py, line 37) File "temp.py", line 1, in <module> It didn't seem to cause any crashes, so I stupidly ignored it. Last night I ran an app on an iPod Touch Generation 6 running the latest iOS