Lock.swift

A Swift & iOS framework to authenticate using Auth0 and with a Native Look & Feel

MIT License

Stars
260
Committers
23

Bot releases are visible (Hide)

Lock.swift - 1.29.1

Published by hzalaz over 7 years ago

Full Changelog

Fixed

  • Only handle url if there is a current controller for Safari Web Auth #425 (hzalaz)
Lock.swift - 1.29.0

Published by hzalaz over 7 years ago

Full Changelog

Added

Changed

  • Update keyboard to numeric to input SMS code #2 #406 (bourgois)
Lock.swift - 2.0.0

Published by hzalaz over 7 years ago

Full Changelog

Added

  • Show error when using audience in non OIDC mode #391 (hzalaz)
  • Add centralized error processing to Dispatcher #374 (cocojoe)
  • Add Fatal Erorrs to UnrecoverableError for Debug Builds #373 (cocojoe)
  • Auto close on success event behaviour and customization #370 (cocojoe)
  • Critical error handling and presentation #367 (cocojoe)

Changed

  • i18n strings file for Base language in Lock #393 (hzalaz)
  • Change AD screens styling #384 (hzalaz)
  • Navigate to Login screen after ResetPassword and Signup events #369 (cocojoe)

Fixed

  • Fixed single connection behaviour for enterprise #387 (hzalaz)
  • Fixed crash when loading any enterprise connection with no name #385 (hzalaz)
  • Fix signup password policy view enforcement on single screen #371 (cocojoe)
Lock.swift - 1.28.2

Published by hzalaz over 7 years ago

Full Changelog

Fixed

Lock.swift - 2.0.0-rc.2

Published by hzalaz almost 8 years ago

Added

Fixed

Lock.swift - 1.28.1

Published by hzalaz almost 8 years ago

Full Changelog

Fixed

Lock.swift - 2.0.0-rc.1

Published by hzalaz almost 8 years ago

Full Changelog

Added

Changed

  • Compatibility updates against latest Auth0.Swift #356 (cocojoe)
  • Allow developer to get controller to show lock. #349 (hzalaz)
  • Migrate codebase to Swift 3.0 #345 (cocojoe)

Fixed

  • Fixed retain issues between presenter and views #355 (cocojoe)
Lock.swift - 1.28.0

Published by hzalaz almost 8 years ago

Full Changelog

Changed

  • Handle a0.mfa_registration_required when MFA needs enroll #352 (cocojoe)
  • Update A0EmailValidator.m #344 (f2m2rd)
Lock.swift - 1.27.1

Published by hzalaz about 8 years ago

Full Changelog

Closed issues

  • Lock not displayed in fullscreen on an iPad #307

Fixed

  • Set the background color to the enclosing controller #328 (hzalaz)
  • Properly validate login identifier #327 (hzalaz)
Lock.swift - 2.0.0-beta.2

Published by hzalaz about 8 years ago

Full Changelog

Added

Lock.swift - 1.27.0

Published by hzalaz about 8 years ago

Full Changelog

Closed Issues:

  • Xcode 8 support #317
  • A0SafariAuthenticator not dismissing SFSafariViewController #308

Added:

Fixed:

Lock.swift - 1.26.2

Published by hzalaz about 8 years ago

Full Changelog

Closed Issues:

  • The A0EnterpriseLoginViewController ignores the custom ClientId and Domain configuration #294
  • allow lock framework to enable bitcode by default #292
  • Top Level Domains on email address failing validation #248

Fixed:

Lock.swift - 1.26.1

Published by hzalaz about 8 years ago

Full Changelog

Merged pull requests:

Lock.swift - 2.0.0-beta.1

Published by hzalaz about 8 years ago

Full Changelog

Lock for iOS rewritten in Swift

Usage

First to import Lock.swift

import Lock

then in your AppDelegate.swift add the following

func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
    return Lock.resumeAuth(url, options: options)
}

Configuration

In order to use Lock you need to provide your Auth0 Client Id and Domain, either with a Property List file

Auth0 ClientId & Domain can be found in your Auth0 Dashboard

Auth0.plist file

In your application bundle you can add a plist file named Auth0.plist with the following format

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>ClientId</key>
  <string>{YOUR_CLIENT_ID}</string>
  <key>Domain</key>
  <string>{YOUR_DOMAIN}</string>
</dict>
</plist>

Classic

Lock Classic handles authentication using Database, Social & Enterprise connections.

Currenty Lock.swift only supports Database & Social authentication and you need to tell Lock what connections it should use

To show Lock.swift, add the following snippet in any of your UIViewController

Lock
    .classic()
    .connections {
        $0.database(name: "Username-Password-Authentication", requiresUsername: true)
    }
    .options {
        $0.closable = false
    }
    .on { result in
        switch result {
        case .Success(let credentials):
            print("Obtained credentials \(credentials)")
        case .Failure(let cause):
            print("Failed with \(cause)")
        case .Cancelled:
            print("User cancelled")
        }
    }
    .present(from: self)

Specify Connections

Eventually Lock.swift will be able to load your client configuration automatically, but until then you should describe what connections it should use.

Before presenting Lock.swift you can tell it what connections it should display and use to authenticate an user. You can do that by calling the method and supply a closure that can specify the connections

.connections { connections in
    // Your connections
}

So if you need a database connection you can call

connections.database(name: "{CONNECTION_NAME}", requiresUsername: true)

Or a social connection

connections.social(name: "{CONNECTION_NAME}", style: .Facebook)

Logging

In Lock.swift options you can turn on/off logging capabilities

Lock
    .classic()
    .options {
        $0.logLevel = .All
        $0.logHttpRequest = true
    }
Lock.swift - 1.26.0

Published by hzalaz over 8 years ago

Full Changelog

Implemented enhancements:

  • Not passing correct error code and domain #226

Fixed bugs:

  • Force Lock's UIViewControllers in portrait mode #258

Closed issues:

  • Make Error handling helper methods public #224

Merged pull requests:

Lock.swift - 1.24.1

Published by hzalaz over 8 years ago

Full Changelog

Merged pull requests:

Lock.swift - 1.24.0

Published by hzalaz over 8 years ago

Full Changelog

Fixed bugs:

  • Properly initialise A0LockSignupViewController #246
  • Change embedded WebView title text attributes #187

Merged pull requests:

Lock.swift - 1.25.0

Published by hzalaz over 8 years ago

Full Changelog

Merged pull requests:

  • Allow to use A0SafariAuthenticator w/o connection #254 (hzalaz)
  • Update build scripts #252 (hzalaz)
  • Use PKCE for token exchange via authorize #250 (hzalaz)
Lock.swift - 1.23.1

Published by hzalaz over 8 years ago

Full Changelog

Merged pull requests:

  • Avoid overriding connection name for social login #240 (hzalaz)
Lock.swift - 1.23.0

Published by hzalaz over 8 years ago

Full Changelog

Fixed bugs:

  • Clear cookies for UIWebView and WKWebView #227
  • Avoid cleaning reference to callbacks before calling them in A0WebKitViewController #222
  • For TouchID use default connection name if none is specified #220

Closed issues:

  • How to get the latest commits using CocoaPods? #238
  • signUpWithEmail method doesn't work properly #233
  • LICENSE file needs an update and readme.md needs a fix #215
  • connection_scopes are ignored by A0WebViewAuthenticator #209
  • Update Google Ent Auth Login screen logic #206
  • Add au region for CDN #201
  • Support customizing "user is blocked" message #195

Merged pull requests:

  • Add api_type param name to fetchNewIdTokenWithIdToken and fetchNewIdTokenWithRefreshToken #239 (rweindl)
  • If auth parameters are nil, use defaults #237 (hzalaz)
  • Avoid cleaning callbacks before vc is dismissed #236 (hzalaz)
  • Update TouchID authentication #235 (hzalaz)
  • Use new change password flow #232 (hzalaz)
  • Clear session of UIWebView & WKWebView #231 (hzalaz)
  • Fixed property inheritance warning #230 (ppaulojr)
  • Remove apple versioning from bundles #229 (hzalaz)
  • Update license and readme #216 (aguerere)
  • Update to AFNetworking 3 #213 (hzalaz)
  • Fix missing device when scope has offline_access #211 (hzalaz)
  • connection_scopes are ignored by A0WebViewAuthenticator #210 (keeth)