|
| 1 | +# SimpleSAMLphp Mongo Module |
| 2 | + |
| 3 | +[](https://travis-ci.org/prolificinteractive/PROJECT_NAME) |
| 4 | + |
| 5 | +The mongo module is an implementation of a SimpleSAMLphp (SSP) data store. |
| 6 | + |
| 7 | +## Features |
| 8 | + |
| 9 | +- Can be used for backend storage of sessions in MongoDB |
| 10 | +- Includes support for replica sets |
| 11 | + |
| 12 | +## Requirements |
| 13 | + |
| 14 | +PHP 5.3 through 5.6 |
| 15 | + |
| 16 | +[SimpleSAMLphp](https://simplesamlphp.org/) |
| 17 | + |
| 18 | +[MongoDB](https://www.mongodb.com/) |
| 19 | + |
| 20 | +[Mongo PHP extension](http://php.net/manual/en/book.mongo.php) |
| 21 | + |
| 22 | +## Installation |
| 23 | + |
| 24 | +If your project manages SSP with [Composer](https://getcomposer.org/) run: |
| 25 | +``` |
| 26 | +php composer.phar require prolificinteractive/simplesamlphp-module-mongo |
| 27 | +``` |
| 28 | +This command will add `prolificinteractive/simplesamlphp-module-mongo` to your projects' composer.json file and install the module |
| 29 | +into SSP's `modules` directory, which relative to your project's root directory is conventionally `vendor/simplesamlphp/simplesamlphp/modules`. |
| 30 | + |
| 31 | +## Usage |
| 32 | + |
| 33 | +Set the `store.type` option in your SSP config file to `mongo:Store`. |
| 34 | + |
| 35 | +Provide your MongoDB connection information to the module by copying the file provided in the `config-templates` directory into SSP's config directory, and setting the following environment variables: |
| 36 | +``` |
| 37 | +DB_MONGODB_HOST |
| 38 | +DB_MONGODB_PORT |
| 39 | +DB_MONGODB_USERNAME |
| 40 | +DB_MONGODB_PASSWORD |
| 41 | +DB_MONGODB_DATABASE |
| 42 | +``` |
| 43 | + |
| 44 | +If your connecting to a replica set, you'll need to set the following environment variables below as well: |
| 45 | +``` |
| 46 | +DB_DEFAULT_CONNECTION # Must contain the substring "_replica" |
| 47 | +DB_MONGODB_REPLICASET |
| 48 | +DB_MONGODB_READ_PREFERENCE |
| 49 | +``` |
| 50 | +See the [Mongo extension PHP Manual](http://php.net/manual/en/mongo.manual.php) for more information about appropriate values for `DB_MONGODB_REPLICASET` and `DB_MONGODB_READ_PREFERENCE`. |
| 51 | + |
| 52 | +Finally, you can enable the module by creating an empty file name `enable` in the `vendor/simplesamlphp/simplesamlphp/modules/mongo` directory. |
| 53 | + |
| 54 | +**Note:** This module stores PHP session data in the `session` collection. |
| 55 | + |
| 56 | +## Contributing to SimpleSAMLphp Mongo Module |
| 57 | + |
| 58 | +To report a bug or enhancement request, feel free to file an issue under the respective heading. |
| 59 | + |
| 60 | +If you wish to contribute to the project, fork this repo and submit a pull request. |
| 61 | + |
| 62 | +## License |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | +Copyright (c) 2017 Prolific Interactive |
| 67 | + |
| 68 | +SimpleSAMLphp Mongo Module is maintained and sponsored by Prolific Interactive. It may be redistributed under the terms specified in the [LICENSE] file. |
| 69 | + |
| 70 | +[LICENSE]: ./LICENSE |
0 commit comments