jojijacobk/access-sso-protected-data

Read/Write data on single-sign-on protected pages with a single line of script.

v1.0.2 2019-05-23 11:21 UTC

This package is auto-updated.

Last update: 2024-09-23 23:18:59 UTC


README

If you are ever on a rush for an automated script to perform read/write operation on data residing behind single-sign-on protected URL, this module is for you. Just configure a working SSO username & password into config.ini file - you are done!

  • class SingleSignOn - tries to access the single-sign-on protected URL, and follows HTTP redirects to the authentication server, and pass through authentication server by posting credentials configured in config.ini file. After successful authentication, a cookie jar stores necessary cookies to perform subsequent visits to any URLs within the protected host.
  • class Data Streamer - is used to perform read/write operations on protected server resources, after successfully signing into protected hosts with the help of SignleSignOn class.

How To Install

Visit packagist for details.

  1. Install the package via composer composer require jojijacobk/access-sso-protected-data

  2. Make config.ini file in the root directory (where composer.json file resides). You can make the config.ini file either by copying it from vendor/jojijacobk/access-sso-protected-data/config.ini, or by the copying the config.ini sample as described below.

    config.ini

    ; single sign-on credentials
    [single_sign_on]
    username = hello@company.com
    password = xxxxx
    
  3. Make a PHP file in the root directory (where _composer.json & config.ini resides), let's call it demo.php and write the following script to read data from single-sign-on protected page:

    demo.php

    <?php
    
    require 'vendor/autoload.php';
    
    $requestUrl_1 = "https://jira.your-company.com/jira/rest/api/2/search?jql=xxx";
    $requestUrl_2 = "https://confluence.your-company.com/confluence/rest/api/content/yyy";
    
    echo \jojijacobk\access_sso_protected_data\DataStreamer::read($requestUrl_1);
    echo \jojijacobk\access_sso_protected_data\DataStreamer::read($requestUrl_2);

Support or Contact

Github pull requests: https://github.com/jojijacobk/Access-SSO-Protected-Data

Contact me: joji.jacob.k@gmail.com