Giter Site home page Giter Site logo

acmehealth-swift-client-dynamodb's Introduction

AcmeHealth : iOS Native Application with AppAuth

Sample application for communicating with OAuth 2.0 and OpenID Connect providers. Demonstrates single-sign-on (SSO) with AppAuth for iOS implemented in Swift.

Running the Sample with your Okta Organization

###Pre-requisites This sample application was tested with an Okta org. If you do not have an Okta org, you can easily sign up for a free Developer Okta org.

  1. Verify OpenID Connect is enabled for your Okta organization. Admin -> Applications -> Add Application -> Create New App -> OpenID Connect
  1. In the Create A New Application Integration screen, click the Platform dropdown and select Native app only
  2. Press Create. When the page appears, enter an Application Name. Press Next.
  3. Add com.acmeHealth://oauth to your list of approved Redirect URIs.
  4. Click Finish to redirect back to the General Settings of your application.
  5. Select the Edit button in the General Settings section to configure the Allowed Grant Types
  • Ensure Authorization Code and Refresh Token are selected in Allowed Grant Types
  • Save the application
  1. In the Client Credentials section verify Proof Key for Code Exchange (PKCE) is the default Client Authentication
  2. Copy the Client ID, as it will be needed for the OktaConfiguration.swift configuration file.
  3. Finally, select the People tab and Assign to People in your organization.

###Configure the Authorization Server This project uses REST Service Authorization with JWTs to cancel, confirm, create, edit, and retrieve appointments. To enable this feature, contact [email protected].

  1. In the navigation bar, select Security, then API.
  2. Under the Authorization Servers tab, select Add Authorization Server.
  • Name : AcmeHealth Resource Domain
  • Resource URI : http://localhost:8080
  • Description : AcmeHealth Server
  • Save
  1. Select the Scopes tab and click Add Scope. This project requires the following:
  • providers:read
  • appointments:read
  • appointments:write
  • appointments:cancel
  • appointments:confirm
  • appointments:edit
  • Add this name to the name field in the Add Scope window
  1. Select the Access Policies tab, followed by Add New Access Policy.
  • Name : AcmeHealth Access Policy
  • Assign To : All Users
  • Click Create Policy
  1. Finally, we will add three rules by selecting Add Rule
  • Rule Name : Patient Rule
  • If : User is a member of one of the following:
    • Groups : Patients
  • Then scopes are : appointments:read, appointments:write, providers:read, appointments:cancel
  • Repeat for rules Provider Rule and Provider-read-only and specify the groups and scopes accordingly.
  1. Copy the Issuer under Settings - this will be used in OktaConfiguration.swift
  2. Follow the AcmeHealth Server instructions

Configure the Sample Application

Once the project is cloned, install the required dependencies with CocoaPods by running the following from the project root.

pod install

Important: Open AcmeHealth.xcworkspace. This file should be used to run/test your application.

####Requirements

  • XCode 7.0+
  • Swift 2.0+
  • OS X 10.10+

Update the OktaConfiguration.swift OktaConfiguration object:

class OktaConfiguration {
    let issuer: String!                             // Base url of Okta Developer domain
    let clientID: String!                           // Client ID of Application
    let redirectURI: String!                        // Reverse DNS notation of base url with oauth route
    let authorizationServerURL: String!             // API URI for token authentication
    let authIssuer: String!                         // Authorization Issuer URI
    let idTokenScopes : [String]!
    let authorizationServerScopes: [String]!
    
    
    init(){
        issuer = "https://example.oktapreview.com"
        clientID = "Jw1nyzbsNihSuOETY3R1"
        redirectURI = "com.acmehealth://oauth"
        authorizationServerURL = "http://localhost:8088"
        authIssuer = "https://example.oktapreview.com/oauth2/aus7xbiefo72YS2QW0h7"
        idTokenScopes = [
            "openid",
            "profile",
            "email",
            "offline_access"
        ]
        authorizationServerScopes = [
            "appointments:read",
            "appointments:write",
            "appointments:cancel",
            "providers:read"
        ]
    }
}

acmehealth-swift-client-dynamodb's People

Contributors

jmelberg avatar jmelberg-okta avatar

Watchers

 avatar  avatar

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.