realm

Shiro入门学习与实战(一)

天涯浪子 提交于 2019-12-02 14:46:59
一、概述 1.Shiro是什么?   Apache Shiro是java 的一个安全框架,主要提供:认证、授权、加密、会话管理、与Web集成、缓存等功能,其不依赖于Spring即可使用;   Spring Security(Oauth2)也是一个开源的权限框架,但其依赖于Spring运行,功能相对强大;而Shiro相对独立,不依赖于Spring,使用简单、灵活,所以我选择Shiro学习。哈哈~ 2.Shiro基本功能 ①Authentication(音标: [ɔːˌθentɪˈkeɪʃn] )   身份认证,验证用户是不是拥有相应的身份。 ②Authorization(音标:[ˌɔːθərəˈzeɪʃn])   授权即权限验证,验证某个已认证的用户是否拥有某个权限(比如接下来我要实现的:不用用户拥有不用的菜单树) ③Session Management   会话管理,在用户登录后,退出之前,所有信息都存在于会话中(这里可以用于sso单点登录) ④Crptography   加密,保护数据的安全性(比如密码加密存储到数据库,而不是明文存储) ⑤Web支持   非常容易集成到Web环境 ⑥Caching   缓存,比如用户登录后,其用户信息、拥有的角色/权限不必每次去查,这样可以提高效率 ⑦Concurrency   Shiro支持多线程应用宝并发验证,(即在一个线程中开启另一个线程

WatchKit Extension not working under CocoaPods

﹥>﹥吖頭↗ 提交于 2019-12-02 12:31:40
Using iOS-8.3, Xcode-6.3.1 and MacOS-10.10.3 - The CocoaPods (v0.37.1) installation of the RealmSwift (v0.92.3) described here and here basically works, except the WatchKit Extension does not find any Realm keywords. My Podfile looks as follows: xcodeproj 'MyApp.xcodeproj' workspace 'MyApp.xcworkspace' platform :ios, '8.3' source 'https://github.com/artsy/Specs.git' source 'https://github.com/CocoaPods/Specs.git' use_frameworks! def shared_pods pod 'RealmSwift', '>= 0.92.3' end target 'MyApp' do shared_pods end target 'MyAppTests' do shared_pods end target 'MyApp WatchKit Extension' do shared

Migrating multiple realms - Realm Version Greater Than Schema Version exception

北城余情 提交于 2019-12-02 12:29:07
Why this exception is thrown (when I'm trying to migrate multiple realms)? bool ObjectStore::is_schema_at_version(Group *group, uint64_t version) { uint64_t old_version = get_schema_version(group); if (old_version > version && old_version != NotVersioned) { throw ObjectStoreException(ObjectStoreException::Kind::RealmVersionGreaterThanSchemaVersion, {{"old_version", to_string(old_version)}, {"new_version", to_string(version)}}); } return old_version != version; } First of all I needed to instantiate realmconfig in the right way. RLMRealmConfiguration *someOtherConfig = [[RLMRealmConfiguration

简单的shirod例子

烂漫一生 提交于 2019-12-02 11:31:22
有几种方式其他的记不住了,这里把我常用的一种介绍一下。 shiro这个功能对应五张数据库表 一个人可以有多个角色,一个角色可以有多个权限 先写一个配置文件 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <!-- 配置自定的Realm类 --> <bean id="myRealm" class="com.zhiyou.shiro.realm.MyRealm"/> <!-- 配置SecurityManager的bean --> <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager"> <property name="realm" ref="myRealm"/> <

Realm database decryption failed

白昼怎懂夜的黑 提交于 2019-12-02 10:08:55
Question : When I try to open encrypted realm file in Realm Browser (windows) and it gives me following message. Either this is not a Realm file or it's encrypted. Enter: 128-character hex-encoded encryption key Important - I am closing my realm before saving on disk. Code RealmConfiguration config = new RealmConfiguration.Builder() .name("w5uyqFyEDEK_OCWyl4123aa77") .schemaVersion(2) .encryptionKey(myClassObject.getRealmKey()) .deleteRealmIfMigrationNeeded() .build(); Methods public byte[] getRealmKey() { byte[] key; String savedKey = getStringFromPrefs(KEY); if (savedKey.isEmpty()) { key =

Objectmapper get array of one item within JSON

本小妞迷上赌 提交于 2019-12-02 09:58:57
问题 So I have the following JSON, which I am using together with ObjectMapper and Realm. { "result": [ { "id": 20, "types": [ "now" ], "url": "/nl/whereto/ezrhgerigerg", "categories": [ { "id": 39, "name": "Food " }, { "id": 21, "name": "Varia" } ] }, My problem is getting the data from "types", which for some items in the array says "now" or "later", and is empty for other items (hence, no types item is given). I tried to do the following in my mapping: class Publication: Object, Mappable {

How to correctly configure path for the Realm DB-file (<db_name>.realm) in iOS project?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 08:58:11
问题 Sorry for my english. I have developed a mobile application that needs its own local data store. I chose Realm as the database management system. In the process of studying the Realm documentation I had no problems with the database design, it's normalization, the CRUD-operations and everything that is related directly to the code. I was confused following. I test my application in the simulator. I did not create the local database. I’ve just done it as it is written in the documentation of

Realm数据库简介

馋奶兔 提交于 2019-12-02 08:57:34
Realm 是一个跨平台的移动数据库引擎,于 2014 年 7 月发布,准确来说,它是专门为移动应用所设计的数据持久化解决方案之一。 Realm 可以轻松地移植到您的项目当中,并且绝大部分常用的功能(比如说插入、查询等等)都可以用一行简单的代码轻松完成! Realm 并不是对 Core Data 的简单封装,相反地, Realm 并不是基于 Core Data ,也不是基于 SQLite 所构建的。它拥有自己的数据库存储引擎,可以高效且快速地完成数据库的构建操作。 之前我们提到过,由于 Realm 使用的是自己的引擎,因此, Realm 就可以在 iOS 和 Android 平台上共同使用(完全无缝),并且支持 Swift 、 Objective-C 以及 Java 语言来编写( Android 平台和 iOS 平台使用不同的 SDK )。 使用Realm的理由: 跨平台 :现在绝大多数的应用开发并不仅仅只在 iOS 平台上进行开发,还要兼顾到 Android 平台的开发。为两个平台设计不同的数据库是愚蠢的,而使用 Realm 数据库, iOS 和 Android 无需考虑内部数据的架构,调用 Realm 提供的 API 就可以完成数据的交换,实现 “ 一个数据库,两个平台无缝衔接 ” 。 简单易用 : Core Data 和 SQLite 冗余

Inserting data into realm DB with progress?

醉酒当歌 提交于 2019-12-02 08:31:07
I have request data which was about 7MB after it has downloaded the json string,means the json string is about 7MB.After it has downloaded,I would like to save the data into realm model object(table) with progress like (1/7390) to (7390/7390) -> (data which is inserted/total data to be inserted) I am using Alamofire as HTTPClient at my app.So,how to insert data with progress into my realm object model after it has downloaded from server?Any help cause I am a beginner. I wont show the data model exactly,so,any example is appreciated.Let say my json string is. { { name : Smith, age : 23, address

Accessing realm database across activities

前提是你 提交于 2019-12-02 08:26:12
I have 3 different activities. 1 extends Application and realm is configured in this activity. 2. Data is added to Realm from 2nd activity . 3. Data is to be displayed in the 3rd activity. I am unable to do the 3rd part. I am unable to get an instance of Realm in the 3rd activity. The following is Application(1st activity that I mentioned) @Override public void onCreate() { super.onCreate(); Realm.init(this); RealmConfiguration realmConfiguration = new RealmConfiguration.Builder().build(); Realm.setDefaultConfiguration(realmConfiguration); } the following is the code for adding data to realm