{"id":18427111,"url":"https://github.com/nowisesys/uup-auth","last_synced_at":"2025-07-30T18:09:42.585Z","repository":{"id":57028822,"uuid":"167256701","full_name":"nowisesys/uup-auth","owner":"nowisesys","description":"Flexible authentication stack supporting multiple credential obtaining methods and account validation backends","archived":false,"fork":false,"pushed_at":"2019-10-15T02:58:06.000Z","size":348,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-18T21:59:45.923Z","etag":null,"topics":["authentication","authorization","php-library"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nowisesys.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-23T21:26:38.000Z","updated_at":"2019-10-15T02:58:08.000Z","dependencies_parsed_at":"2022-08-23T16:20:28.583Z","dependency_job_id":null,"html_url":"https://github.com/nowisesys/uup-auth","commit_stats":null,"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"purl":"pkg:github/nowisesys/uup-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nowisesys%2Fuup-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nowisesys%2Fuup-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nowisesys%2Fuup-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nowisesys%2Fuup-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nowisesys","download_url":"https://codeload.github.com/nowisesys/uup-auth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nowisesys%2Fuup-auth/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267914695,"owners_count":24164771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","authorization","php-library"],"created_at":"2024-11-06T05:09:40.092Z","updated_at":"2025-07-30T18:09:42.564Z","avatar_url":"https://github.com/nowisesys.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## UUP-AUTH - Authentication stack for PHP\n\nThe uup-auth package provides a library for stacking authenticators together\nto support multiple authentication method in a uniform way. \n\nBundled are also restrictors for performing access restriction (i.e. on \ntime of day or the ip-address/hostname). All authenticators in the stack can\nbe set as required or sufficient to enforce logon policy (i.e. require CAS-logon\nfrom outside of LAN while supporting Kerberos logon from inside).\n\nThe library is modular. The authenticators are the frontend (credentials\nobtainers) that might use a validator as authentication source (for example\nLDAP). The authenticator can be combined with a storage object to support\nlogon sessions. \n\nAuthenticators can be used in a stack or standalone (single login method). If\nconfiguring a stack, use one of the access classes for easy access to chains\nand authenticators.\n\n    +-- UUP/Authentication/\n          +-- Authenticator/        : Authenticator frontend classes.\n          +-- Restrictor/           : Restrictor classes.\n          +-- Stack/                : Support for stacking authenticators/restrictors.\n          +-- Storage/              : Persistance support.\n          +-- Validator/            : Authentication support.\n\n### Example\n\nA typical authentication/authorization stack providing login thru PAM, CAS and \nLDAP with restriction on network and logon time might look like this:\n\n```php\nclass Authentication extends AuthenticatorStack\n{\n\n    public function __construct()\n    {\n        $chain = array(\n            // \n            // Plugin account authenticator objects in stack:\n            // \n            'auth'   =\u003e array(\n                'pam'  =\u003e (new SystemAuthentication())\n                    -\u003evisible(true)\n                    -\u003econtrol(Authenticator::SUFFICIENT)\n                    -\u003ename('System')\n                    -\u003edescription('Login using local system account.'),\n                'cas'  =\u003e (new CasAuthenticator('cas.example.com'))\n                    -\u003evisible(true)\n                    -\u003econtrol(Authenticator::SUFFICIENT)\n                    -\u003ename('CAS')\n                    -\u003edescription('CAS server login'),\n                'ldap' =\u003e (new LdapAuthenticator('ldaps://ldap.example.com'))\n                    -\u003evisible(true)\n                    -\u003econtrol(Authenticator::SUFFICIENT)\n                    -\u003ename('LDAP')\n                    -\u003edescription('LDAP authentication')\n            ),\n            // \n            // Add some login restrictions:\n            // \n            'access' =\u003e array(\n                'addr' =\u003e (new AddressRestrictor(array('::1', '127.0.0.1', '192.168.0.0/16')))\n                    -\u003evisible(false)\n                    -\u003econtrol(Authenticator::REQUIRED),\n                'time' =\u003e (new DateTimeRestrictor('08:45', '16:30'))\n                    -\u003evisible(false)\n                    -\u003econtrol(Authenticator::REQUIRED)\n            )\n        );\n\n        parent::__construct($chain);\n    }\n\n    public function getName()\n    {\n        return $this-\u003egetAuthenticator()-\u003ename;\n    }\n\n}\n```\n\nSomewhere (typical dispatcher or main template) add some code to handle\nlogin/logout request and render logon form:\n\n```php\n\ntry {\n    $authenticator = new Authentication();\n\n    if (filter_has_var(INPUT_GET, 'login')) {\n        $authenticator-\u003eactivate(filter_input(INPUT_GET, 'login'));\n        $authenticator-\u003elogin();\n    }\n    if (filter_has_var(INPUT_GET, 'logout')) {\n        $authenticator-\u003elogout();\n    }\n\n    if ($authenticator-\u003eaccepted()) {\n        printf(\"\u003cp\u003eLogged on to %s as %s | \u003ca href=\\\"?logout\\\"\u003eLogout\u003c/a\u003e\\n\", \n                $authenticator-\u003egetName(), \n                $authenticator-\u003egetSubject()\n        );\n    } else {\n        printf(\"\u003cform action=\\\"\\\" method=\\\"GET\\\"\u003e\\n\");\n        printf(\"\u003cselect name=\\\"login\\\"\u003e\\n\");\n        foreach ($authenticator-\u003eauthenticators(true) as $key =\u003e $obj) {\n            printf(\"\u003coption value=\\\"%s\\\" title=\\\"%s\\\"\u003e%s\u003c/option\u003e\\n\", $key, $obj-\u003edescription, $obj-\u003ename);\n        }\n        printf(\"\u003c/select\u003e\\n\");\n        printf(\"\u003cinput type=\\\"submit\\\" value=\\\"Login\\\"\u003e\\n\");\n        printf(\"\u003c/form\u003e\\n\");\n    }\n} catch (Exception $exception) {\n    die(sprintf(\"Exception: %s\", $exception));\n}\n```\n\nSee examples directory for fully functional code. Visit the [project page](https://nowise.se/oss/uup/auth) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnowisesys%2Fuup-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnowisesys%2Fuup-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnowisesys%2Fuup-auth/lists"}