{"id":19794128,"url":"https://github.com/simplesamlphp/simplesamlphp-module-memcookie","last_synced_at":"2025-05-01T02:30:55.743Z","repository":{"id":54861691,"uuid":"51999270","full_name":"simplesamlphp/simplesamlphp-module-memcookie","owner":"simplesamlphp","description":"A SimpleSAMLphp module that supports Auth MemCookie authentication for applications not written in PHP.","archived":false,"fork":false,"pushed_at":"2024-11-18T16:55:26.000Z","size":115,"stargazers_count":5,"open_issues_count":1,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-06T07:52:53.359Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simplesamlphp.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-18T10:23:19.000Z","updated_at":"2024-11-18T16:55:23.000Z","dependencies_parsed_at":"2024-06-14T21:24:26.585Z","dependency_job_id":"d33a2c42-28ab-46db-a44c-1ba7e2e93594","html_url":"https://github.com/simplesamlphp/simplesamlphp-module-memcookie","commit_stats":{"total_commits":79,"total_committers":4,"mean_commits":19.75,"dds":0.2784810126582279,"last_synced_commit":"ad6ca9ad6e54d574a3395a7878449b6557b23d22"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplesamlphp%2Fsimplesamlphp-module-memcookie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplesamlphp%2Fsimplesamlphp-module-memcookie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplesamlphp%2Fsimplesamlphp-module-memcookie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplesamlphp%2Fsimplesamlphp-module-memcookie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simplesamlphp","download_url":"https://codeload.github.com/simplesamlphp/simplesamlphp-module-memcookie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251812304,"owners_count":21647884,"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","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":[],"created_at":"2024-11-12T07:12:10.793Z","updated_at":"2025-05-01T02:30:55.494Z","avatar_url":"https://github.com/simplesamlphp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SimpleSAMLphp AuthMemCookie module\n\n![Build Status](https://github.com/simplesamlphp/simplesamlphp-module-memcookie/actions/workflows/php.yml/badge.svg)\n[![Coverage Status](https://codecov.io/gh/simplesamlphp/simplesamlphp-module-memcookie/branch/master/graph/badge.svg)](https://codecov.io/gh/simplesamlphp/simplesamlphp-module-memcookie)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/simplesamlphp/simplesamlphp-module-memcookie/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/simplesamlphp/simplesamlphp-module-memcookie/?branch=master)\n[![Type Coverage](https://shepherd.dev/github/simplesamlphp/simplesamlphp-module-memcookie/coverage.svg)](https://shepherd.dev/github/simplesamlphp/simplesamlphp-module-memcookie)\n[![Psalm Level](https://shepherd.dev/github/simplesamlphp/simplesamlphp-module-memcookie/level.svg)](https://shepherd.dev/github/simplesamlphp/simplesamlphp-module-memcookie)\n\nThis module implements [Auth MemCookie](https://zenprojects.github.io/Apache-Authmemcookie-Module/) support for SimpleSAMLphp. This allows\nyou to integrate SimpleSAMLphp with web applications written in languages other than PHP.\n\n*AuthMemCookie* works by reading authentication data from a *memcache* server and setting environment variables based on\nthe attributes found in this data. It also allows you to use the default **Apache access control** features to restrict\naccess to your site.\n\n## Requisites\n\nThis module requires you to install and set up the following requirements:\n\n* SimpleSAMLphp running as a [Service Provider](https://simplesamlphp.org/docs/stable/simplesamlphp-sp).\n* A *memcache* server.\n* [Auth MemCookie](https://zenprojects.github.io/Apache-Authmemcookie-Module/) .\n\n## Installation\n\nOnce you have installed SimpleSAMLphp, installing this module is very simple. First of all, you will need to [download\nComposer](https://getcomposer.org/) if you haven't already. After installing Composer, just execute the following\ncommand in the root of your SimpleSAMLphp installation:\n\n```shell\ncomposer.phar require simplesamlphp/simplesamlphp-module-memcookie:dev-master\n```\n\nwhere `dev-master` instructs Composer to install the `master` branch from the Git repository. See the\n[releases](https://github.com/simplesamlphp/simplesamlphp-module-memcookie/releases) available if you want to use a\nstable version of the module.\n\n## Configuration\n\nNext thing you need to do is to enable the module:\n\nin `config.php`, search for the `module.enable` key and set `memcookie` to true:\n\n```php\n    'module.enable' =\u003e [ 'memcookie' =\u003e true, … ],\n```\n\nThe first step to use this module is to configure *Auth MemCookie* appropriately. The following example (that you can\nfind also in `extra/auth_memcookie.conf`) might be helpful:\n\n```apacheconf\n\u003cLocation /\u003e\n    # This is a list of memcache servers which Auth MemCookie\n    # should use. \n    # Note that this list must list the same servers as the\n    # 'authmemcookie.servers'-option in config.php in the\n    # configuration for simpleSAMLphp.\n    #\n    # The syntax for this option is inherited from: http://docs.libmemcached.org/libmemcached_configuration.html \n    Auth_memCookie_Memcached_Configuration \"--SERVER=127.0.0.1:11211\"\n\n    # This must be set to 'on' to enable Auth MemCookie for\n    # this directory.\n    Auth_memCookie_Authoritative on\n\n    # This adjusts the maximum number of data elements in the\n    # session data. The default is 10, which can be to low.\n    Auth_memCookie_SessionTableSize \"40\"\n\n    # These two commands are required to enable access control\n    # in Apache.\n    AuthType Cookie\n    AuthName \"My Login\"\n\n    # This command causes apache to redirect to the given\n    # URL when we receive a '401 Authorization Required'\n    # error. We redirect to \"/simplesaml/module.php/memcookie/auth.php\",\n    # which initializes a login to the IdP.\n    ErrorDocument 401 \"/simplesaml/module.php/memcookie/auth.php\"\n\u003c/Location\u003e\n\n\u003cLocation /protected\u003e\n    # This allows all authenticated users to access the\n    # directory. To learn more about the 'Require' command,\n    # please look at:\n    # http://httpd.apache.org/docs/2.0/mod/core.html#require\n    Require valid-user\n\u003c/Location\u003e\n```\n\nOnce *Auth MemCookie* has been correctly configured, you need to configure the module itself by editing the\n`config/authmemcookie.php` file. Set the `username` configuration option to the name of an attribute that you are sure\nto receive and that will identify the user unambiguously. Read the instructions in the file itself if you need help to\nconfigure it.\n\nIf you already have an *auth source* configured and working in SimpleSAMLphp, and all your memcookie configuration\noptions are correct, you are ready to go! Make sure to reload Apache so that it uses the new configuration and *Auth\nMemCookie* is loaded. Then you can point your browser to the location that you have protected in Apache and it should\nredirect you automatically to the IdP for authentication.\n\nIn order to see all the environment variables you have available in the protected location, you can drop a PHP script\nlike the following in there and access it from your browser after authenticating to your IdP:\n\n```html\n\u003chtml\u003e\n \u003cbody\u003e\n  \u003ctable\u003e\n\u003c?php\n    foreach ($_SERVER as $key =\u003e $value) {\n        echo \"   \u003ctr\u003e\u003ctd\u003e\".htmlspecialchars($key).\"\u003c/td\u003e\u003ctd\u003e\".htmlspecialchars($value).\"\u003c/td\u003e\u003c/tr\u003e\\n\";\n    }\n?\u003e\n  \u003c/table\u003e\n \u003c/body\u003e\n\u003c/html\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplesamlphp%2Fsimplesamlphp-module-memcookie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimplesamlphp%2Fsimplesamlphp-module-memcookie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplesamlphp%2Fsimplesamlphp-module-memcookie/lists"}