realm

Redirect after Realm authentication on Glassfish

◇◆丶佛笑我妖孽 提交于 2020-01-14 01:42:49
问题 I'm currently running a JPA/EJB/JSF application on Glassfish and using the security JDBC realm for authentication. The realm works pretty well, fulfilling the requirements, until the customer asked for a small change on the navigation. Today, if you try to access a protected page, the authentication mechanism will redirect you to a login page specified in the web.xml. Perfect! Once the authentication is successful, you are redirected back to the page you were trying to access. Fair enough.

Realm-iOS: Object reference set to nil after save

北城余情 提交于 2020-01-13 19:12:12
问题 I have 2 classes: Company and Employee . Both inherit the Realm Object class. class Company:Object { var name:String = "" var employee:Employee? override static func primaryKey() -> String? { return "name" } } class Employee:Object { var name:String = "" var age:Int = 0 override static func primaryKey() -> String? { return "name" } } Populate the objects var emp = Employee() emp.name = "Sachin" emp.age = 35 var comp = Company() comp.name = "BCCI" comp.employee = emp println("Before: \(comp

Realm-iOS: Object reference set to nil after save

帅比萌擦擦* 提交于 2020-01-13 19:09:33
问题 I have 2 classes: Company and Employee . Both inherit the Realm Object class. class Company:Object { var name:String = "" var employee:Employee? override static func primaryKey() -> String? { return "name" } } class Employee:Object { var name:String = "" var age:Int = 0 override static func primaryKey() -> String? { return "name" } } Populate the objects var emp = Employee() emp.name = "Sachin" emp.age = 35 var comp = Company() comp.name = "BCCI" comp.employee = emp println("Before: \(comp

Realm-iOS: Object reference set to nil after save

偶尔善良 提交于 2020-01-13 19:09:16
问题 I have 2 classes: Company and Employee . Both inherit the Realm Object class. class Company:Object { var name:String = "" var employee:Employee? override static func primaryKey() -> String? { return "name" } } class Employee:Object { var name:String = "" var age:Int = 0 override static func primaryKey() -> String? { return "name" } } Populate the objects var emp = Employee() emp.name = "Sachin" emp.age = 35 var comp = Company() comp.name = "BCCI" comp.employee = emp println("Before: \(comp

Should I use Realm Objective-C or Realm Swift in my mixed Objective-C / Swift project?

泄露秘密 提交于 2020-01-13 09:29:11
问题 My project uses Swift and targets iOS 8.0 and newer, but we use some files from our old Objective-C project, and brings in some Objective-C libraries via CocoaPods. Which Realm interface should I use in this project: Objective-C or Swift? I'm confused because of the announcement in the Realm documentation: If you’re looking to use Realm from Objective-C, or from mixed Objective-C & Swift apps please see Realm Objective-C instead. Using both Realm Objective-C and Realm Swift simultaneously is

Apache Shiro 学习记录1

泪湿孤枕 提交于 2020-01-13 09:00:58
  最近几天在学习Apache Shiro......看了一些大神们的教程.....感觉收获不少.....但是毕竟教程也只是指引一下方向....即使是精品教程,仍然有很多东西都没有说明....所以自己也稍微研究了一下...记录了一下我的研究发现.... 教程点这里   这篇教程的最后提到了strategy.....然后给出了4个方法.....但是并没有怎么详细说明.....我想说说我的理解.....(我的理解可能会有很多错误)   我想先说说登陆验证的大致流程....大致...... Subject 从用户那里收集完用户名密码以后我们会调用subject.login(token)这个方法去登陆.....Subject是一个接口,没有定义login的具体实现.....Shiro里只有一个类实现了这个接口,是DelegatingSubject这个类.这个类里的方法login方法如下: 1 public void login(AuthenticationToken token) throws AuthenticationException { 2 clearRunAsIdentitiesInternal(); 3 Subject subject = securityManager.login(this, token); 4 5 PrincipalCollection principals

Realm findFirst() method returns null

半世苍凉 提交于 2020-01-13 08:32:34
问题 I searched and found FindFirst returns null question but no one answered it. As I'm thinking I am doing something wrong, let me explain my problem with more details. I'm working on an app that asks the user to sign in first and then lets the user use the app. My User class looks like this: public class User extends RealmObject { @PrimaryKey @SerializedName("uid") String id; @SerializedName("ufname") String firstName; @SerializedName("ulname") String lastName; String avatar; int sessions; int

Updating UITableView with multiple sections from RLMResults.Observe()

巧了我就是萌 提交于 2020-01-13 06:25:05
问题 I am trying to create an auto-updating TableView, which is usually easy to do with help of Results.observe (the replacement of .addNotificationBlock) The problem I'm facing is that I can't figure out how to handle a tableView with multiple sections, and cells that can move from 1 section to another. With below table as example: (as seen on UITableView with Multiple Sections using Realm and Swift) Bulldogs Charlie Max German Shepherd Bella Buddy Molly Golden Retrievers Bailey Siberian Huskies

Shiro简介

半城伤御伤魂 提交于 2020-01-12 00:23:26
1.shiro是什么? Shiro是Apache下的一个开源项目。shiro属于轻量级框架,相对于SpringSecurity简单的多,也没有SpringSecurity那么复杂。官方架构图如下: 2.Shiro提供了四大功能: (1)认证 (2)授权 (3)加密 (4)会话管理 3.shiro主要功能 shiro主要有三大功能模块: Subject:主体,一般指用户。 SecurityManager:安全管理器,管理所有Subject,可以配合内部安全组件。(类似于SpringMVC中的DispatcherServlet) Realms:用于进行权限信息的验证,一般需要自己实现。 细分功能 Authentication:身份认证/登录(账号密码验证)。 Authorization:授权,即角色或者权限验证。 Session Manager:会话管理,用户登录后的session相关管理。 Cryptography:加密,密码加密等。 Web Support:Web支持,集成Web环境。 Caching:缓存,用户信息、角色、权限等缓存到如redis等缓存中。 Concurrency:多线程并发验证,在一个线程中开启另一个线程,可以把权限自动传播过去。 Testing:测试支持; Run As:允许一个用户假装为另一个用户(如果他们允许)的身份进行访问。 Remember Me

Shiro自定义Realm(二)

℡╲_俬逩灬. 提交于 2020-01-11 06:16:01
项目结构: 1 :自定义 reaml ,继承 AuthorizingRealm 重写 3 方法:getName doGetAuthorizationInfo doGetAuthenticationInfo public class MyRealm extends AuthorizingRealm { public String getName(){ return "MyRealm"; } //授权操作 @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) { return null; } //认证操作 @Override protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException { //参数token:表示登陆时保证的UsernamePasswordToken //通过用户名到数据库中查用户信息,封装成一个AuthenticationInfo认证对象返回,方便认证器进行对比 String username =(String)