External user database

How would I connect an external user database to Contentbox?

Would it be possible just to use an external user table (separate data source), but store the roles in Contentbox?

Hmm, I don’t think so. Will this be just for authentication into the system?

Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano

Yes

For this, then you will need a few things:

  1. Create a CFC that implements our security interface: contentbox.model.security.ISecurityService. You can find an example implementation here: contentbox.model.security.SecurityService.

/**

  • User validator via security interceptor

*/

boolean function userValidator(required struct rule,any messagebox,any controller);

/**

  • Get an author from session, or returns a new empty author entity

*/

Author function getAuthorSession();

/**

  • Set a new author in session

*/

ISecurityService function setAuthorSession(required Author author);

/**

  • Delete author session

*/

ISecurityService function logout();

/**

  • Verify if an author has valid credentials in our system.

*/

boolean function authenticate(required username, required password);

/**

  • Send password reminder for an author

*/

ISecurityService function sendPasswordReminder(required Author author);

/**

  • Check to authorize a user to view a content entry or page

*/

boolean function authorizeContent(required content,required password);

/**

  • Checks Whether a content entry or page is protected and user has credentials for it

*/

boolean function isContentViewable(required content);

  1. Tell WireBox to use your implementation instead of the core one, this is done in the contentbox.ModuleConfig.cfc

// ContentBox security

{class=“coldbox.system.interceptors.Security”,

name=“security@cb”,

properties={

rulesSource = “model”,

rulesModel = “securityRuleService@cb”,

rulesModelMethod = “getSecurityRules”,

validatorModel = “securityService@cb”}

},

The validator model property is the one you change. Once you do this, then basically authentication will be in your hands. Now, for compatibility purposes, I suggest that you map this to some local ContentBox users so the permissions systems work as well. This can be done by your Security service on the getAuthorSession() which should return the appropriate ContentBox Author object.

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano