Skip to content
Snippets Groups Projects
Select Git revision
  • 756968d48723c3f3b6aa3c451e06b56f312041fa
  • main default protected
2 results

shibd_discofeed.class.php

Blame
  • shibd_discofeed.class.php 5.46 KiB
    <?php
    /**
     * ======================================================================
     * 
     * AAI LOGIN WITH SHIBBOLETH HANDLING MULTIPLE ORGANIZATIONS
     * 
     * included functions
     * License: GNU GPL 3.0
     * Source: https://git-repo.iml.unibe.ch/iml-open-source/login-aai
     * ======================================================================
     */
    class shibd_discofeed
    {
        /**
         * Url to the discofeed that returns a json with al idps
         * @var string
         */
        protected string $_sDiscofeedUrl = '/Shibboleth.sso/DiscoFeed';
    
        /**
         * Url to generate a static Shibboleth login url
         * @var string
         */
        protected string $_sShibLoginUrl = '/Shibboleth.sso/Login';
    
        /**
         * Language to search for in the discofeed; a 2 letter code
         * @var string
         */
        protected string $lang = 'en';
    
        // caching of discofeed
    
        /**
         * Filename of the cache file for the Shibboleth discofeed
         * @var string
         */
        protected string $_sCachefile = 'discofeed.json';
    
        /**
         * Caching time for the discofeed cache in seconds
         * @var int
         */
        protected int $_iCacheTtl;
    
        /**
         * Self base URL of the current app tu build Shibboleth links
         * @var string
         */
        protected string $SELFURL = '';
        // protected array $aConfig = [];
    
        // ----------------------------------------------------------------------
    
        /**
         * Constructor
         * @param array $aConfig  config array; the following keys are required:
         *                        idps        array   IDP poositive list
         *                        return-url  string  return URL
         *                        cache-ttl   int     caching time in seconds
         *                        cachefile   string  caching filename
         * @param string $SELFURL
         */
        public function __construct(array $aConfig, string $SELFURL = '')
        {
            $SELFURL = $SELFURL ?: (
                isset($_SERVER['SERVER_NAME']) ? "https://" . $_SERVER['SERVER_NAME'] : ''
            );
    
            if(!$SELFURL) {