realm

Shiro安全框架(二)——身份认证

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 02:23:08
Shiro使用指定的验证Realm 1.Subject认证主体 Subject认证 包含两个信息: Principals:身份,可以是用户名,邮件,手机号码等等,用来标识一个登录主体身份; Credentials:凭证,常见有密码,数字证书等等; 2.身份认证流程 3.Realm&JdbcRealm Realm:域,Shiro从Realm中获取验证数据; Realm有很多种类,例如常见的JdbcRealm,JndiRealm,TextRealm; 这里我们使用JdbcRealm。 首先,创建数据库和表: 添加druid,mysql 驱动依赖坐标: <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.6</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.0.26</version> </dependency> 在resources目录下创建jdbc_realm.ini配置文件 [main] jdbcRealm=org.apache.shiro.realm.jdbc

What is the most efficient way to store long list of Objects in Realm?

≯℡__Kan透↙ 提交于 2019-11-27 02:15:09
问题 I'm trying to compare Realm with Snappydb (This is my repo for those who would like to have a look at benchmark). I guess my way is wrong, as store-to-db time takes super long time in Realm in compare with Sanppydb. Benchmark shows following result. As you can see in the image, Realm is around 100-200 times slower than Snappydb. What I'm doing is creating 10,000 objects first and then storing them into the db. So, in my code I store a Booking object in this way (there is a for loop that

How to save a struct to realm in swift?

冷暖自知 提交于 2019-11-27 01:57:19
问题 It is easy to use Realm with classes by inheriting from Object . But how would I save a struct containing several fields to realm in Swift? E.g. struct DataModel { var id = 0 var test = "test" } I know the documentation is clear about supported types. But maybe there is nice workaround or - even better - someone from realm could write about future plans about structs. 回答1: To save a struct in Realm, means copying the data into a Realm Object . The reason why Realm Objects are classes and not

How to delete object from Realm Database Android?

佐手、 提交于 2019-11-27 01:44:43
问题 I want remove all message object from realm those are equal to userid RealmQuery<Message> rowQuery = realm.where(Message.class).equalTo(Message.USER_ID, userId); realm.beginTransaction(); //TODO : here I want to remove all messages where userId is equal to "9789273498708475" realm.commitTransaction(); 回答1: In 0.88.3 and below you can do: realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { RealmResults<Message> rows = realm.where(Message.class)

SpringBoot与Shiro整合

拥有回忆 提交于 2019-11-27 01:04:42
修改 pom.xml : <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> <!-- 继承Spring Boot的默认父工程 --> <!-- Spring Boot 父工程 --> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.4.RELEASE</version> </parent> <groupId>com.mxj</groupId> <artifactId> springboot - shiro </artifactId> <version>0.0.1-SNAPSHOT</version> </project> 1.1. 导入 web 支持 修改 pom

基于百度云 BOS 搭建私有 Docker Registry

我与影子孤独终老i 提交于 2019-11-26 22:47:48
基于百度云 BOS 搭建私有 Docker Registry Docker Registry 作为 Docker 的核心组件之一负责了镜像的存储以及分发。用户只需要使用 Docker 的客户端就可以直接和 Registry 进行交互,下载和上传镜像。 百度对象存储 BOS (Baidu Object Storage) 提供稳定、安全、高效以及高扩展存储服务。 Baidu BOS storage driver 基于官方 Docker Registry 源码,结合百度云 Go 语言SDK: https://github.com/guoyao/baidubce-sdk-go.git ,通过实现 storagedriver.StorageDriver 接口,提供了一个针对百度云 BOS 的 Storage Driver。 准备工作 安装 Docker Engine,如何安装请参考 Docker官方文档 下载 Registry 镜像(或者通过源码仓库 https://github.com/guoyao/distribution.git 自己 build 一个镜像) docker pull guoyao/registry:0.6.0 因为是从Docker官方Registry下载镜像,速度会比较慢,可以配置国内的镜像加速 注册 百度云 账号,开通 BOS 服务,在 百度云 BOS 控制台

Realm accessed from incorrect thread

南笙酒味 提交于 2019-11-26 21:48:40
问题 I'm using serial GCD queue to work with realm. Application crashes with Realm accessed from incorrect thread exception when GCD starts to switch threads for the queue. Is there any way to bind given realm with a thread using GCD API? Here's a quick example self.realmQueue = dispatch_queue_create("db", DISPATCH_QUEUE_SERIAL); __block RLMRealm *realm = nil; dispatch_async(self.realmQueue, ^{ realm = [RLMRealm realmWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"temp"]]; });

How can I set LIMIT in query in Realm?

半腔热情 提交于 2019-11-26 21:43:25
问题 I have done R&D for limit in query with no success. There is one way with which to paginate data in Realm with sub list but no success with that. It shows duplicate value in it. Here is what I attempted for pagination. RealmResults<Person> mPersonData=RealmUtils.getAllPersonWithTagsDescending(); if (mPersonData != null) { int startPos=getAllPerson.size()-1; int endPos=mPersonData.size()-1; List<Person> newPersonData=mPersonData.subList(startPos,endPos); getAllPerson.addAll(newPersonData);

Complex sorting for search in realm, union of multiple RealmResults

江枫思渺然 提交于 2019-11-26 21:24:24
问题 I replaced sqlite with realm in my open source Linux Command Library project. Everything went fine so far, but now I'm facing a problem. I'm using a RealmBaseAdapter to display all the commands in a ListView with an search interface. For a search the realm sniped below orders the results like this: Query: test result: l2 test rc test test test parm RealmResults<Command> commands = mRealm.where(Command.class).contains("name", query).findAll(); mAdapter.updateRealmResults(commands); With the

Android: Realm + Retrofit 2 + Gson

非 Y 不嫁゛ 提交于 2019-11-26 21:05:24
I have a problem when using Retrofit + Gson and Realm . I know that there is an issue with the combination of these 3 libraries. Some answers suggest that setting an ExclusionStrategy for Gson can solve this issue, and I tried it but it didn't work. My code looks like: public class ObjectList { public List<AnotherObject> anotherObject; } public class AnotherObject extends RealmObject { private String propA; public void setPropA(String propA){ this.setPropA = propA } public String getPropA(){ return propA } } Gson gson = new GsonBuilder().setExclusionStrategies(new ExclusionStrategy() {