I'm learning cbsecurity and keep coming across the...
# box-products
r
I'm learning cbsecurity and keep coming across the following error.
Copy code
invalid component definition, can't find component [cbsecurity.interceptors.Security]

F:\code\web\sites\api\coldbox\system\core\util\Util.cfc: line 413
411: arguments.md = (
412: isObject( arguments.component ) ? getMetadata( arguments.component ) : getComponentMetadata(
413: arguments.component
414: )
415: );

called from F:\code\web\sites\api\coldbox\system\ioc\config\Mapping.cfc: line 521
I have fwreinited coldbox multiple times. I verified that the cbsecurity.interceptors.Security.cfc exists in the cbsecurity module. Is there something I might be missing somewhere?
@wil-shiftinsert thanks, I will check that shortly.
@wil-shiftinsert I believe it is referring to the interceptor within the cbsecurity module.
w
Yes, on initialization of the module the cbsecurity interceptor is loaded. Bu on init the cbsecurity mapping should already be present
r
ok, thank you. I will look into the mapping.
w
Are you trying to map some model in wirebox which has a cbsecurity dependency?
r
not that I am aware of
this is an example that I grabbed so maybe there is something in it already out of whack, possibly
p
can you share more of your stack error; not sure if there is more that can be discovered
r
Here is more of the stack error:
Copy code
F:\code\web\sites\fadometer-api\coldbox\system\core\util\Util.cfc: line 413
called from F:\code\web\sites\fadometer-api\coldbox\system\ioc\config\Mapping.cfc: line 521
called from F:\code\web\sites\fadometer-api\coldbox\system\ioc\config\Mapping.cfc: line 532
called from F:\code\web\sites\fadometer-api\coldbox\system\ioc\Injector.cfc: line 508
called from F:\code\web\sites\fadometer-api\coldbox\system\web\services\InterceptorService.cfc: line 427
called from F:\code\web\sites\fadometer-api\coldbox\system\web\services\InterceptorService.cfc: line 418
called from F:\code\web\sites\fadometer-api\coldbox\system\web\services\InterceptorService.cfc: line 338
called from F:\code\web\sites\fadometer-api\coldbox\system\web\services\InterceptorService.cfc: line 158
called from F:\code\web\sites\fadometer-api\coldbox\system\web\services\InterceptorService.cfc: line 160
called from F:\code\web\sites\fadometer-api\coldbox\system\web\services\InterceptorService.cfc: line 112
called from F:\code\web\sites\fadometer-api\coldbox\system\web\services\LoaderService.cfc: line 70
called from F:\code\web\sites\fadometer-api\coldbox\system\Bootstrap.cfc: line 111
called from F:\code\web\sites\fadometer-api\Application.cfc: line 27
p
Hmm yea doesnt really explain much more; do you have a specific tutorial or example code you are trying to follow? Or is there only specific times this is throwing?
there are numerous approaches to using and configuring this; Wil is actually who helped me a ton on using this!
r
I found a couple of resources as examples. The one giving me trouble is the following and I just noticed modified code in Application.cfc when attempting to troubleshoot an issue related to Lucee. I'm taking that back out now and testing, but here is the following link to it. https://github.com/irvirv/cbsecurity_template.git One of the examples works out of the box after pulling it from https://github.com/wpdebruin/cbsecurity_demo
Yeah, my environment for that first link works now. Sorry about that. However, as I am learning this, would you guys mind if reach out to either of you if I have questions? My focus on this is to learn cbSecurity, cbAuth, JWT, and BCrypt so that I can set it up for creating a Coldbox API.
I would like to learn the rule-based handler, but I am familiar with a sort of home-grown version of using
secured
annotations, so maybe that might be best to learn first.
w
yes, the wpdebruin repo is mine 🙂 . Did you ever see my blogposts on cbsecurity at https://shiftinsert.nl/tag/cbsecurity/ ? I think I have most of it covered in the cbsecurity(1/2 and 3) posts
r
oh nice! I sure did! I read through it all. It has been a couple of weeks now and getting back to this, so my mind is a bit fuzzy and will probably have to go over it, again. I truly appreciate your work and effort in making the blogs about setting this all up. Thank you, Wil.
Would you blog about this work just the same for an API setup?
w
Most of my work was on api development, so yes. You should probably use jwt for that, not sure if I have everything covered in my posts.
My sample code is a bit simplistic, but should show you the concepts. I’ve used most of it, including jwt. If you are just starting I would advise the annotation version first. Once you have this running it is quite easy to change to rules, which are a bit more flexible. You just have to be careful about your rules order
Actually I was planning on one or more blog posts including a sample repo, but this time with a full database model with users, roles, permissions, jwt and some bcrypt. But I didn’t have time yet
Feel free to ask if you have any questions, But be advised I am in a quite different time zone six hours ahead of yours. So dinner time here right now 🙂.
If you want to learn cbsecurity I would advise to start simple. New project, some simple handlers where you can sprinkle some cbsecurity annotations
r
Thank you very much for your advise, Wil! I will start with annotations. Previously, I created APIs with Brad Wood's interceptor for the
secured
annotations. I still love using it and built a more robust API around it, but I think it would be best to continue learning these new modules (new to me, but I know it's been around a while Lol) so that there is a bit more of a standard or conventional practice instead a home-grown one. Thank you, again, and look forward to getting this nailed down. 🙂
p
Feel free to reach out to me as well, when I get time I try to help out around here. I have several apps that utilize various approaches of cbsecurity including jwt etc.
👍🏼 1
r
Thanks, guys! I started reading Wil's tutorials last night, again. Looks like things are making sense. I pulled the demo from github as a comparison while making one from scratch based from the tutorial. I stopped in the middle of the JWT tutorial and will pick it back up tonight.
👍🏻 1