Skip to content

Commit

Permalink
AuthenticationHandler not plugin, dependency plugins don't specifiy t…
Browse files Browse the repository at this point in the history
…heir types
  • Loading branch information
yasserf committed Jul 5, 2016
1 parent 91054a1 commit 642f801
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/authentication/open-authentication-handler.js
@@ -1,4 +1,5 @@
'use strict';
const EventEmitter = require( 'events' ).EventEmitter;

/**
* Used for users that don't provide a username
Expand All @@ -14,12 +15,13 @@ const OPEN = 'open';
*
* @class OpenAuthenticationHandler
*/
module.exports = class OpenAuthenticationHandler{
module.exports = class OpenAuthenticationHandler extends EventEmitter{
/**
* @param {String} type exposes the type for logging purposes. This one is called
* none to avoid confusion with openAuth
*/
constructor() {
super();
this.type = 'none';
this.isReady = true;
}
Expand Down
8 changes: 3 additions & 5 deletions src/deepstream.io.js
Expand Up @@ -50,7 +50,8 @@ var Deepstream = function( config ) {
'messageConnector',
'storage',
'cache',
'permissionHandler' //TODO: This now requires the permissionHandler to have a ready flag / emit events
'authenticationHandler',
'permissionHandler'
];

};
Expand Down Expand Up @@ -152,12 +153,9 @@ Deepstream.prototype._start = function() {
}

if( global.deepstreamLibDir ) {
this._options.logger.log( C.LOG_LEVEL.INFO, C.EVENT.INFO, 'library directory set to: ' + global.deepstreamLibDir );
this._options.logger.log( C.LOG_LEVEL.INFO, C.EVENT.INFO, 'library directory set to: ' + global.deepstreamLibDir );
}

var authTypeMsg = 'authentication type ' + ( this._options.authenticationHandler.type || 'custom' );
this._options.logger.log( C.LOG_LEVEL.INFO, C.EVENT.INFO, authTypeMsg );

if( this._options.dataTransforms && this._options.dataTransforms instanceof Array ) {
this._options.dataTransforms = new DataTransforms( this._options.dataTransforms );
}
Expand Down
5 changes: 4 additions & 1 deletion src/permission/open-permission-handler.js
@@ -1,16 +1,19 @@
'use strict';

const EventEmitter = require( 'events' ).EventEmitter;

/**
* The open permission handler allows any action to occur without applying
* any permissions.
*
* @class OpenPermissionHandler
*/
module.exports = class OpenPermissionHandler{
module.exports = class OpenPermissionHandler extends EventEmitter{
/**
* @param {String} type exposes the type for logging purposes
*/
constructor() {
super();
this.type = 'none';
this.isReady = true;
}
Expand Down
3 changes: 2 additions & 1 deletion src/utils/dependency-initialiser.js
Expand Up @@ -56,7 +56,8 @@ DependencyInitialiser.prototype._onReady = function() {
clearTimeout( this._timeout );
}

this._options.logger.log( C.LOG_LEVEL.INFO, C.EVENT.INFO, this._name + ' ready' );
var dependencyType = this._dependency.type ? ': ' + this._dependency.type : ''
this._options.logger.log( C.LOG_LEVEL.INFO, C.EVENT.INFO, `${this._name} ready${dependencyType}` );
process.nextTick( this._emitReady.bind( this ) );
};

Expand Down

0 comments on commit 642f801

Please sign in to comment.