Git Product home page Git Product logo

duo_universal_php's Introduction

Duo Universal PHP library

Build Status

This SDK allows a web developer to quickly add Duo's interactive, self-service, two-factor authentication to any PHP web login form.

What's included:

  • src - The PHP Duo SDK for interacting with the Duo Universal Prompt
  • example - An example PHP application with Duo integrated
  • tests - Test cases

Getting started

This library requires PHP 7.4 or later

To use SDK in your existing developing environment, install it from Packagist

composer require duosecurity/duo_universal_php

Once it's installed, see our developer documentation at https://duo.com/docs/duoweb and sample/index.php in this repo for guidance on integrating Duo 2FA into your web application.

TLS 1.2 and 1.3 Support

Duo_universal_php uses PHP's cURL extension and OpenSSL for TLS operations. TLS support will depend on the versions of multiple libraries:

TLS 1.2 support requires PHP 5.5 or higher, curl 7.34.0 or higher, and OpenSSL 1.0.1 or higher.

TLS 1.3 support requires PHP 7.3 or higher, curl 7.61.0 or higher, and OpenSSL 1.1.1 or higher.

Contribute

To contribute, fork this repo and make a pull request with your changes when they are ready.

Install the SDK from source:

composer install

Run interactive mode

php -a -d auto_prepend_file=vendor/autoload.php

Interactive shell

php > $client = new Duo\DuoUniversal\Client("IntegrationKey", "SecretKey", "api-XXXXXXXX.duosecurity.com", "https://example.com");
php > $state = $client->generateState();
php > $username = "example";
string(700) "https://api-XXXXXXXX.duosecurity.com/oauth/v1/authorize?response_type=code&client_id=DIXXXXXXXXXXXXXXXXXX&scope=openid&redirect_uri=https%3A%2F%2Fexample.com&request=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzY29wZSI6Im9wZW5pZCIsInJlZGlyZWN0X3VyaSI6Imh0dHBzOlwvXC9leGFtcGxlLmNvbSIsImNsaWVudF9pZCI6IkRJWFhYWFhYWFhYWFhYWFhYWFhYIiwiaXNzIjoiRElYWFhYWFhYWFhYWFhYWFhYWFgiLCJhdWQiOiJodHRwczpcL1wvYXBpLVhYWFhYWFhYLmR1b3NlY3VyaXR5LmNvbSIsImV4cCI6MTYxMjI5OTA3Nywic3RhdGUiOiJtYjlWalFGeDNzMEswRVpidVBJMmlCVWE4N29qbWFMTUl2VksiLCJyZXNwb25zZV90eXBlIjoiY29kZSIsImR1b191bmFtZSI6ImV4YW1wbGUiLCJ1c2VfZHVvX2NvZGVfYXR0cmlidXRlIjp0cnVlfQ.8Pr02LJd0pi6rsiAf5mvzGbf51piHysHyP5PlmnMiwNIkQ0HsYED0wECilXxsIyISz--oU528Cy7Sfebj0copg"

Tests

./vendor/bin/phpunit --process-isolation tests

Lint

To run linter

./vendor/bin/phpcs --standard=.duo_linting.xml -n src/* tests

duo_universal_php's People

Contributors

aaronatduo avatar jeffreyparker avatar yizshi avatar ishanvyas22 avatar mbish avatar xdesai avatar duokristina 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.