Skip to content

Commit f3f54b7

Browse files
authored
Fix authentication when connecting to MongoDB (#2)
* Fix authentication when connecting to MongoDB * Add back travis CI for correct repository * Fix reference to configuration file
1 parent 66def0d commit f3f54b7

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SimpleSAMLphp MongoDB Module
22

3-
[![Travis build status](https://img.shields.io/travis/prolificinteractive/simplesamlphp-module-mongo.svg?style=flat-square)](https://travis-ci.org/prolificinteractive/simplesamlphp-module-mongo)
3+
[![Travis build status](https://img.shields.io/travis/prolificinteractive/simplesamlphp-module-mongodb.svg?style=flat-square&branch=master)](https://travis-ci.org/prolificinteractive/simplesamlphp-module-mongodb)
44

55
This module is an implementation of a SimpleSAMLphp (SSP) data store to add support for the MongoDB PHP library.
66

@@ -49,7 +49,7 @@ DB_MONGODB_READ_PREFERENCE
4949
```
5050
See the [MongoDB extension PHP Manual](http://php.net/manual/en/set.mongodb.php) for more information about appropriate values for `DB_MONGODB_REPLICASET` and `DB_MONGODB_READ_PREFERENCE`.
5151

52-
Finally, you can enable the module by creating an empty file name `enable` in the `vendor/simplesamlphp/simplesamlphp/modules/mongo` directory.
52+
Finally, you can enable the module by creating an empty file name `enable` in the `vendor/simplesamlphp/simplesamlphp/modules/mongodb` directory.
5353

5454
**Note:** This module stores PHP session data in the `session` collection.
5555

lib/Store/Store.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22
/**
3-
* This file is part of the simplesamlphp-module-mongo.
3+
* This file is part of the simplesamlphp-module-mongodb.
44
*
55
* For the full copyright and license information, please view the LICENSE file that was distributed with this source
66
* code.
77
*
88
* @author Chris Beaton <[email protected]>
9-
* @package prolificinteractive/simplesamlphp-module-mongo
9+
* @package prolificinteractive/simplesamlphp-module-mongodb
1010
*/
1111

1212
use \SimpleSAML\Store;
@@ -31,7 +31,7 @@ class sspmod_mongo_Store_Store extends Store
3131
public function __construct($connectionDetails = array())
3232
{
3333
$options = [];
34-
$config = SimpleSAML_Configuration::getConfig('module_mongo.php');
34+
$config = SimpleSAML_Configuration::getConfig('module_mongodb.php');
3535
$connectionDetails = array_merge($config->toArray(), $connectionDetails);
3636
if (!empty($connectionDetails['replicaSet'])) {
3737
$options['replicaSet'] = $connectionDetails['replicaSet'];
@@ -61,6 +61,9 @@ static function createConnectionURI($connectionDetails = array()) {
6161
? "${connectionDetails['username']}:${connectionDetails['password']}@"
6262
: '')
6363
."${seedList}";
64+
if(!empty($connectionDetails['database'])) {
65+
$connectionURI .= '/' . $connectionDetails['database'];
66+
}
6467

6568
return $connectionURI;
6669
}

tests/lib/Store/StoreTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* code.
77
*
88
* @author Chris Beaton <[email protected]>
9-
* @package prolificinteractive/simplesamlphp-module-mongo
9+
* @package prolificinteractive/simplesamlphp-module-mongodb
1010
*/
1111

1212
namespace SimpleSAML\Test\Module\mongo\Store;
File renamed without changes.

0 commit comments

Comments
 (0)