[CB-4.3] cbauth module implementation

112 views
Skip to first unread message

Roy Chase

unread,
Jul 6, 2017, 7:25:42 PM7/6/17
to ColdBox Platform
Hi all,

Thanks again for your help on a previous issue.

I'm going to try to implement the cbauth forgebox module for my authentication, but I'm confused by this statement in his readme:


Specify a userServiceClass in your config/ColdBox.cfc inside moduleSettings.cbauth.userServiceClass. This component needs to have three methods:
  1. isValidCredentials( username, password )
  2. retrieveUserByUsername( username )
  3. retrieveUserById( id )

 It reads like, "specify something to do with userServiceClass in your config/coldbox.cfc which is inside moduleSettings.cbauth.userServiceClass." Since the
moduleSettings.cbauth.userServiceClass isn't actually a file path in my app (at least not using Commandbox to install the module...), it's unclear to me what exactly the author means. Have any of you used this module? If so, how did you go about registering it as a dependency?

Many thanks,

Jon Clausen

unread,
Jul 6, 2017, 7:37:57 PM7/6/17
to col...@googlegroups.com

Hi Roy,

 

Glad to hear it’s going well.  I haven’t used that particular module before.  I typically use `cbsecurity` (https://www.forgebox.io//view/cbsecurity ), with a custom rules and validator model.  You can see an example of the implementation in the ContentBox module configuration here:

 

https://github.com/Ortus-Solutions/ContentBox/blob/5f3cef1f4864ef5167106c27cb57e507d298fb69/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/ModuleConfig.cfc#L60

 

It sounds like it accomplishes pretty much the same thing that `cbauth` does.

 

HTH,

Jon

--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coldbox/83256273-f379-4e6b-b48e-995fc11d3a14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Roy Chase

unread,
Jul 6, 2017, 7:40:14 PM7/6/17
to ColdBox Platform
Excellent, thanks for the recommendation. It has more straightforward documentation so I'll try that out in the AM.

Many thanks,

Roy Chase

unread,
Jul 7, 2017, 5:32:34 PM7/7/17
to ColdBox Platform
Any thoughts on why I'm throwing this error? Sorry for being needy with this stuff...


Builder.BuildCFCDependencyException

Error building: cbsecurity.interceptors.Security -> The parameter controller to function init is required but was not passed in.

I'm requesting the dependency in handlers/Login.cfc:

    property name="CBSecurity"  inject="cbsecurity.interceptors.Security";





On Thursday, July 6, 2017 at 5:37:57 PM UTC-6, JClausen wrote:

br...@bradwood.com

unread,
Jul 7, 2017, 5:41:06 PM7/7/17
to col...@googlegroups.com
I'm not sure what you're after, but I don't think you should be directly injecting an interceptor into a handler?  What method in the interceptor are you planning on calling and why?

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: br...@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com 
 
 
--------- Original Message ---------
Subject: Re: [coldbox:26480] [CB-4.3] cbauth module implementation
From: "Roy Chase" <rech...@gmail.com>
Date: 7/7/17 4:32 pm
To: "ColdBox Platform" <col...@googlegroups.com>

Any thoughts on why I'm throwing this error? Sorry for being needy with this stuff...


Builder.BuildCFCDependencyException

Error building: cbsecurity.interceptors.Security->The parameter controller to function init is required but was not passed in.

I'm requesting the dependency in handlers/Login.cfc:

    propertyname="CBSecurity"  inject="cbsecurity.interceptors.Security";





On Thursday, July 6, 2017 at 5:37:57 PM UTC-6, JClausen wrote:

Hi Roy,

 

Glad to hear it’s going well.  I haven’t used that particular module before.  I typically use `cbsecurity` (https://www.forgebox.io//view/cbsecurity ), with a custom rules and validator model.  You can see an example of the implementation in the ContentBox module configuration here:

 

https://github.com/Ortus-Solutions/ContentBox/blob/5f3cef1f4864ef5167106c27cb57e507d298fb69/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/ModuleConfig.cfc#L60

 

It sounds like it accomplishes pretty much the same thing that `cbauth` does.

 

HTH,

Jon

 

 

 

From: <col...@googlegroups.com> on behalf of Roy Chase <rech...@gmail.com>
Reply-To: "col...@googlegroups.com" <col...@googlegroups.com>
Date: Thursday, July 6, 2017 at 7:25 PM
To: ColdBox Platform <col...@googlegroups.com>
Subject: [coldbox:26476] [CB-4.3] cbauth module implementation

 

Hi all,

Thanks again for your help on a previous issue.

I'm going to try to implement the cbauth forgebox module for my authentication, but I'm confused by this statement in his readme:

Specify a userServiceClassin your config/ColdBox.cfc inside moduleSettings.cbauth.userServiceClass. This component needs to have three methods:

Roy Chase

unread,
Jul 7, 2017, 5:47:52 PM7/7/17
to ColdBox Platform
I was picturing handlers as controllers in other frameworks, so I was calling CBSecurity as a depency into the handler in order to hopefully call the method _isUserInValidState, but I'm realizing this is a private method anyway so probably not accessible.

I suppose I'll need to look into the docs more on how to implement this.

br...@bradwood.com

unread,
Jul 7, 2017, 5:55:02 PM7/7/17
to col...@googlegroups.com
Handlers, are controllers, but I think you may be confused about what interceptors are, or at least putting methods in them that don't really belong.  It sounds like your method you wish to call should be in a service.  Interceptors should only be registered as an interceptor in the Coldbox config and the framework will automatically call its methods based on the events they are listening to.
--------- Original Message ---------

Roy Chase

unread,
Jul 7, 2017, 5:57:33 PM7/7/17
to ColdBox Platform
Yeah I think you're right, my understanding of interceptors is incorrect. Will read up over the weekend.

Many thanks!

br...@bradwood.com

unread,
Jul 7, 2017, 6:06:31 PM7/7/17
to col...@googlegroups.com
Keep in mind that it's perfectly acceptable (and even desired) to put all your "real" business logic in a service and then simply inject that service into the interceptor to use.  Then you can re-use the service calls elsewhere in your application, which simply leaves your interceptor as a listener for the framework events and proxying the logic over to the service.
--------- Original Message ---------

Roy Chase

unread,
Jul 10, 2017, 10:15:29 AM7/10/17
to ColdBox Platform
Ah, ok. That makes more sense.

Thanks!
Reply all
Reply to author
Forward
0 new messages