Git Product home page Git Product logo

realm-loginkit's Introduction

DEPRECATED

With the introduction of MongoDB Realm, this project is deprecated. Please use MongoDB Realm Cloud.


Realm LoginKit

A general purpose account login user interface for apps implementing the Realm Mobile Platform.

CI Status CocoaPods Version GitHub license Platform

Realm LoginKit is a UI framework that provides a fully featured login screen for apps that make use of the Realm Mobile Platform.

It has been designed to be easily dropped into existing app codebases, and to provide a fully featured interface allowing users to either log in, or register new accounts in that app.

Features

  • Light & dark themes for light apps like Realm Draw, and dark apps like Realm Tasks.
  • Fully adaptive to both smartphone, and tablet screen sizes.
  • Easy swapping between 'log in' and 'sign up' modes.
  • Optional settings to hide the server URL and 'remember me' form fields.
  • The ability to remember username and passwords on subsequent app launches.

Versions & Requirements

Realm LoginKit only supports iOS at the moment.

  • Xcode 8.0 and up
  • iOS 9.0 and up

Android

Currently in development, and should be finished soon.

Xamarin

Currently on the roadmap with development starting soon.

Third Party Dependencies

iOS

  • Realm Objective-C - The Objective-C version of the Realm Mobile Database.
  • TORoundedTableView - A subclass of UITableView that creates rounded table sections when view on iPad.

Example Code

Swift

// Create the object
let loginController = LoginViewController(style: .lightTranslucent) // init() also defaults to lightTranslucent

// Configure any of the inputs before presenting it
loginController.serverURL = "localhost"

// Set a closure that will be called on successful login
loginController.loginSuccessfulHandler = { user in
	// Provides the successfully authenticated SyncUser object
}

Objective-C

// Create the object
RLMLoginViewController *loginController = [[RLMLoginViewController alloc] initWithStyle:LoginViewControllerStyleLightTranslucent];

// Configure any of the inputs before presenting it
loginController.serverURL = @"localhost";

// Set a closure that will be called on successful login
loginController.loginSuccessfulHandler = ^(RLMSyncUser *user) {
	// Provides the successfully authenticated RLMSyncUser object
};

Setting up the Demo App

iOS

In order to run the Realm LoginKit demo app, it is necessary to install CocoaPods in order to integrate the third party libraries.

  1. If you haven't already, install CocoaPods.
  2. Open Terminal, and navigate to the root Realm Puzzle directory, e.g. cd ~/Projects/realm-loginkit.
  3. Run pod install to install the necessary dependencies needed by Realm LoginKit.
  4. Open RealmLoginKit.xcworkspace instead of the xcproject file.

Installation

iOS

CocoaPods

CocoaPods is the recommended way to install Realm LoginKit into an app as this will automatically manage recycling Realm Objective-C as a dependency. In your PodFile, simply add pod 'RealmLoginKit'.

Realm LoginKit also provides support for third party authentication providers. However, since these providers may require additional dependencies that might otherwise be redundant, they are being isolated in separated CocoaPods subspecs:

  • Amazon Cognito - pod 'RealmLoginKit/AWSCognito'

Manually

You can also integrate Realm LoginKit manually; simply copy the RealmLoginKit folder to your app, and drag it into Xcode. That being said, you will also need to install the dependencies separately as well. See their respective GitHub repositories for installation instructions.

Contributing

See CONTRIBUTING.md for more details!

This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [email protected].

License

Realm LoginKit is licensed under the Apache license. See the LICENSE file for details.

analytics

realm-loginkit's People

Contributors

bmunkholm avatar chrischares avatar dalinaum avatar dhmspector avatar kishikawakatsumi avatar nirinchev avatar tgoyne avatar timoliver avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

realm-loginkit's Issues

Add support for Custom Auth

ROS landed custom authentication with the ability to integrate with 3rd parties and validate a JWT token or other payload. We should have some easy drop-ins for the most common client-side auth processes: OAuth2, OpenID, AWS Cognito

Add password rules

Some third party authentication providers (eg, Amazon Cognito) implement strict password policies, up to and including:

  • A minimum password length.
  • A minimum number of capital letters.
  • A minimum number of special characters (!,@,#,$,% etc).
  • A minimum number of numerical digits.

The reasoning for breaking the form validation logic out to the LoginCredentialsValidationProtocol protocol was for this reason, so extending the form validation logic should be quite straightforward.

Additionally, for a good user experience, inserting a label explaining the password rules would also be desired.

Clear text password stored on disk

Currently the lib isn't usable in production since it stores the password in NSUserDefaults. There is an existing issue proposing to use an encrypted Realm: #24 but it sounds like it's more of a "nice to have" instead of a must.

The lib needs to either store the password in the Keychain or use another more secure approach

Need option to hide server IP/hostname

There will be use cases where the applications want to allow users to log in but the IP address should not be able to set or edit the destination or even have the host address visible to the end user..

Authentication Errors

Some interesting things happening on my Mac right now in regard to loginkit, would appreciate any help!

I am trying to get simple username/password auth to work with my app. I have Realm LoginKit, GitHub link, installed in my app via CocoaPods, got the UI looking nice and everything seems to work. When I try to register a new user, I get two errors in Xcode:

2018-07-20 11:41:41.990195-0700 School of STEM[23825:467699] Task <EC0ECEFA-EDC3-433B-9986-18E2854A5668>.<1> finished with error - code: -1001
2018-07-20 11:41:42.006067-0700 School of STEM[23825:467699] Task <EC0ECEFA-EDC3-433B-9986-18E2854A5668>.<1> HTTP load failed (error code: -999 [1:89])

My realm URL is set as such:

loginViewController.serverURL = "https://school-of-stem.us1.cloud.realm.io"

I have also tried multiple times to auth in the simulator, and on only one of those occasions in the realm studio logs I got:

Could not send confirmation email:
authYesterday at 10:49 PM
▼context: Object
 service: "auth"
 code: "EENVELOPE"
 command: "API"
 timestamp: "2018-07-20T05:49:52.276Z"

and

HTTP response: 2b1c8c4d-a353-46c6-a0e3-18608619ea53 {"type":"https://realm.io/docs/object-server/problems/missing-parameters","title":"Your request did not validate because of missing parameters.","status":400,"code":602,"invalid_params":[{"name":"token","reason":"Missing parameter 'token'!"}]}
When running on physical device I get this output in debugger:

tcp_timers [C1.1:3] retransmit SYN 3
tcp_timers [C1.2:3] retransmit SYN 3
tcp_timers [C1.3:3] retransmit SYN 3
tcp_timers [C1.1:3] retransmit SYN 4
tcp_timers [C1.2:3] retransmit SYN 4
tcp_timers [C1.3:3] retransmit SYN 4
tcp_timers [C1.1:3] retransmit SYN 5
tcp_timers [C1.2:3] retransmit SYN 5
tcp_timers [C1.3:3] retransmit SYN 5
tcp_timers [C1.1:3] retransmit SYN 6
tcp_timers [C1.2:3] retransmit SYN 6
tcp_timers [C1.3:3] retransmit SYN 6
tcp_timers [C1.1:3] retransmit SYN 7
tcp_timers [C1.2:3] retransmit SYN 7
tcp_timers [C1.3:3] retransmit SYN 7
tcp_timers [C1.1:3] retransmit SYN 8
tcp_timers [C1.2:3] retransmit SYN 8
tcp_timers [C1.3:3] retransmit SYN 8

Also, another curious bit that may be helpful - when registering for the realm support forum, upon confirming my email, I would get a webpage saying nothing but “[BAD CSRF]” Then suddenly, it worked.

I thought maybe it was because I was running VPN, but even upon disabling VPN no dice. Cleaned build, restarted Xcode and PC - same results.

Maybe these are related? I am running Xcode 9.4.1 and MacOS 10.14 Beta (18A336e).

Thanks in advance!

Server URL 'History'

For instances where we might be switching between a local device and a full RMP instance on a remote server, it would be nice to have a list of recent server URLs that can be used to switch.

1Password Integration

The ability to automatically insert a username and password from the 1Password extension on iOS.

Fix Status Bar in Dark Mode

The status bar doesn't do any theming on its own; relying on the parent view controller on which it was presented. It would be more appropriate if it managed the color itself when in dark mode.

public var URLPortNumber

  1. goals
    to login/sign up and present main view

  2. expected results
    to see the mainview presented

  3. actual results
    substring deprecated error on the public var URLPortNumber

  4. steps to reproduce
    run realm loginkit

  5. code sample

    public var URLPortNumber: Int {
    guard let portRange = self.range(of: ":", options: .backwards) else { return -1 }

     let startIndex = self.index(portRange.upperBound, offsetBy: 0)
     let endIndex = self.index(portRange.upperBound, offsetBy: 2)
     guard self[startIndex...endIndex] != "//" else { return -1 }
    
     return Int(self.substring(from: portRange.upperBound))! (deprecated framework function, locked file)
    

    }

  6. xcode 9

  7. cocoapod version 1.3.1

the substring deprecated error code runs when signing up a user via loginkit.

Cannot use AWSCognitoAuthenticationProvider in iOS example project

If you uncomment this existing line in RealmLoginKit Apple/RealmLoginKitExample/Controllers/ViewController.swift in order to use a AWSCognitoAuthenticationProvider the project won't build:

//        loginViewController.authenticationProvider = AWSCognitoAuthenticationProvider(serviceRegion: .USEast1, userPoolID: "",
//                                                                                      clientID: "",
//                                                                                      clientSecret: "")

Move cached credentials to an encrypted Realm

At the moment, the 'remember me' form details are persisted in NSUserDefaults, which is absolutely unacceptable for production RMP implementations.

At the very minimum, the passwords should be saved to the keychain, but ideally, a separate Realm file, properly isolated from the parent app's Realm implementation can be used to encrypt all of the data more efficiently.

RealmLoginKit crashes after fresh launch w/Save Credentials "off"

(copied from @austinzheng's initial report in the PermissionTester repo)

Upon restarting the app, I get a crash in one of the lines of code below.

private func loadLoginCredentials() {
    let userDefaults = UserDefaults.standard
    serverURL = userDefaults.object(forKey: LoginViewController.serverURLKey) as! String?
    email = userDefaults.object(forKey:  LoginViewController.emailKey) as! String?
    password = userDefaults.object(forKey: LoginViewController.passwordKey) as! String?
}

The error is: Could not cast value of type '__NSCFData' (0x107d59680) to 'NSString' (0x105193c40)..

Update:
I believe it happened after I logged in with the "save credentials" switch toggled off, and killed the app and relaunched it. It happened every time I relaunched the app in the iOS Simulator until I reset the simulator and reinstalled the app.

Layout on smaller iDevice needs scaling

Using it to test the server, tried on a iPhone SE simulator.

As you can see in the image below, there are some ugly overlaps. It gets worse if you press the Register a New Account button.

image

Reorganize file layout

Very soon, there will be versions of Realm LoginKit for Android and Xamarin too. This repo will need to be re-organized so the iOS version isn't on the top level.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.