liamheneghan / azure-activedirectory-library-for-react-native

Active Directory Authentication Library (ADAL) plugin provides easy to use authentication functionality for your React Native apps by taking advantage of Windows Server Active Directory and Windows Azure Active Directory.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Active Directory Authentication Library (ADAL) plugin for React Native apps

Active Directory Authentication Library (ADAL) plugin provides easy to use authentication functionality for your React Native apps by taking advantage of Windows Server Active Directory and Windows Azure Active Directory.

npm version

Inspired By

  1. ADAL for Cordova
  2. ADAL for React Native

Features

  • Support Non-Broker and Broker Based Authentication for Android and iOS
  • Consistent API between Android and iOS
  • Promise-based JS API
  • Easy to configure and Use

Table of contents

Project setup and initialization

See Android guide and iOS guide

Usage

Import

import AzureAdal from 'react-native-azure-adal';

Public API

  1. Configure

    /**
     *
    * @param authority
    * @param validateAuthority
    * @param clientId
    * @param redirectUrl
    * @param useBroker if true, it will try to use broker based authentication only if broker is present
    */
    configure (authority: String, validateAuthority: Boolean, clientId: String,
         redirectUrl: String, useBroker: Boolean)
  2. Login

    /**
    * let the user signin with azure ad credentials into your application,
    * if already logged in, it will not ask credentials again
    * @param resourceUrl
    * @param loginHint
    * @param extraQueryParameters
    * @returns Promise
    */
    login (resourceUrl: String, loginHint: String, extraQueryParameters: String)
  3. login With LoginPrompt

    /**
    * Prompt the modal to let the user signin with azure ad credentials into your application
    * @param resourceUrl
    * @param loginHint
    * @param extraQueryParameters
    * @returns Promise
    */
    loginWithPrompt (resourceUrl: String, loginHint: String, extraQueryParameters: String)
  4. Get Token

    /**
    * It will return you token
    * It will internally call acquireTokenSilentAsync of azure ad authentication context
    * Note:- One time logged in required
    * @param resourceUrl
    * @returns Promise
    */  
    getTokenAsync (resourceUrl: String)
  5. Logout

    /**
    * Sign out from your application
    */
    logout ()

Please refer example project for more details

Example project

See the example project for a working example.

Contributing

Just submit a pull request!

Contact

Drop a mail to durgaprasad.budhwani@gmail.com

Todo

  • Integrate Azure AD Log
  • Handle token caching in better way
  • Unit Test Case
  • Code Quality Integration tool - Eslint and Flow

Copyright and license

Code released under the Apache License.

About

Active Directory Authentication Library (ADAL) plugin provides easy to use authentication functionality for your React Native apps by taking advantage of Windows Server Active Directory and Windows Azure Active Directory.

License:Apache License 2.0


Languages

Language:Objective-C 33.3%Language:Java 27.7%Language:Shell 17.3%Language:JavaScript 15.3%Language:PowerShell 2.8%Language:Python 2.1%Language:Ruby 1.5%