SlideShare ist ein Scribd-Unternehmen logo
1 von 48
Downloaden Sie, um offline zu lesen
T E N I N F I F T Y
T E N C O L D B O X M O D U L E S 

Y O U S H O U L D B E U S I N G 

I N E V E RY A P P L I C AT I O N
Me: Jon Clausen
Senior Software Developer,

Ortus Solutions
Grand Rapids, Michigan
C F M I G R AT I O N S
C F M I G R AT I O N S
• Version control for your application's database
• Changes to database schema are kept in timestamped
files that run in order
• Two methods: up and down
• Built on the QB ( Query Builder ) module, which is
database-agnostic
• Excellent for deployments across multiple tiers
C F M I G R AT I O N S : Q U I C K S TA R T
box install cfmigrations



box install commandbox-migrations



box migrate create AddResetTokenToUsersTable
C F M I G R AT I O N S
component {
function up( schema ) {
schema.alter( "users", function( table ){
table.addColumn(
table.string( "resetToken", 75 ).nullable()
);
} );
}
function down( schema ) {
schema.alter( "users", function( table ){
table.dropColumn( "resetToken" );
} );
}
}
C B A U T H
C B A U T H
• Authentication wrapper for Coldbox
• Interception points and standardized conventions
• Supertype global methods to allow easy access to
authentication info in your handlers, views, and
interceptors
• Simplifies the task of rewriting the auth mechanisms
with every new application
C B A U T H : Q U I C K S TA R T
box install cbauth
• Specify a userServiceClass in your config/
ColdBox.cfc inside moduleSettings.cbauth.us
erServiceClass
• Implement three methods in your user service class
and one method in your user object/entity
C B A U T H
// Tests the credentials

public boolean function isValidCredentials( 

required string username, 

required string password 

){
var user = retrieveUserByUsername( arguments.username );
if( !isNull( user ) ){
return encryptionService.bcryptMatches( 

arguments.password, 

user.getPassword() 

);
} else {
return false;
}
}


// retrieves the user to test the credentials
public function retrieveUserByUsername( required string username ){
return newEntity().where( 'email', arguments.username ).first();
}


// retrieves the user by identifier
public function retrieveUserById( required string id ){
return newEntity().find( arguments.id );
}
C B G U A R D
C B G U A R D
• Secure routes and events to logged in users and users with
specific permissions with component and function annotations
• A simple “secured” annotation on a handler prevents
execution from all but authenticated users, while additional
annotations will check permissions
• Handlers/actions may use combinations of actions to provide
granular lockdown control
• Authentication failures may be re-routed by module and by
type of request ( e.g. AJAX vs UI )
C B G U A R D : Q U I C K S TA R T
box install cbguard
• Implement two methods in your existing authentication
service: hasPermission and isLoggedIn
• Configure your Coldbox.cfc with the authentication
service and any desired override events
• Add additional configuration overrides to any application
modules
C B G U A R D
moduleSettings = {
cbguard = {
authenticationService : “SecurityService”,
authenticationOverrideEvent : “Main.onAuthenticationFailure”,

authenticationAjaxOverrideEvent : “BaseAPIHandler.onAuthorizationFailure”,

authorizationOverrideEvent : “Main.onAuthorizationFailure”,

authorizationAjaxOverrideEvent : “BaseAPIHandler.onAuthorizationFailure”,
}
};
C B G U A R D
component secured{



function index( event, rc, prc ){...}



function create( event, rc, prc ) secured=“User:Create”{...}
function update( event, rc, prc ) secured=“User:Edit”{…}
...



}
C B VA L I D AT I O N
C B VA L I D AT I O N
• An oldie but goodie.
• Works with a variety of different entities, models,
DAOs, etc
• Supertype methods to simplify validation in handlers
• Global or model-specific constraints may be specified
C B VA L I D AT I O N : Q U I C K S TA R T
box install cbvalidation
• Add constraints to your config, models or objects
• Add validation routines in your handler CRUD
methods
C B VA L I D AT I O N
this.constraints = {
firstName : { required : true },
lastName : { required : true },
password : { required : true },
email : { required : true, validator : "UniqueValidator@cborm" }
};
moduleSettings = {
cbvalidation = {
sharedConstraints = {
modifiedTime = { required: true },
modifiedBy = { required: true },
}
}
};
C B S T O R A G E S
C B S T O R A G E S
• Another oldie but goodie.
• Provides you with a collection of *smart* interfaces for dealing
with common scopes and storage mechanisms ( i.e. - cookies,
cache )
• Consistent methods for dealing with all scopes - you can change
from SessionStorage to CookieStorage without refactoring code
• Cookie Storage handles automatic encryption/decryption
• Cache Storage simplifies distributed caching of authentication
and “session” persistence
C B S T O R A G E S : Q U I C K S TA R T
box install cbstorages
• Begin implementing usage in your auth services and
other places where storage scopes are used
C B S T O R A G E S
component{

property name=“cookieStorage” inject=“CookieStorage@cbstorages”;

property name=“sessionStorage” inject=“CacheStorage@cbstorages”;

}
C B S T O R A G E S
function setAuthorizedUser( required User user ){
        //set our session storage var
        sessionStorage.setVar(
            name="AuthorizedUser",
            value=arguments.user.getId()
        );
        // set a cookie which we can use for timeout evaluation
        cookieStorage.setVar(
            name="AuthorizedUser",
            value=arguments.user.getId(),
            expires = dateDiff( 'd', now(), dateAdd( 'n', now(), 20 ) )
        );
        return this;
}
function logout(){
if( isSessionAuthenticated() ){
        sessionStorage.deleteVar( "AuthorizedUser" );
        cookieStorage.deleteVar(“AuthorizedUser" );
}
}
B C RY P T
B C RY P T
• Creates cryptographically strong (and slow) hashes
• Implements one-way encryption - can never be
decrypted
• Usages: Paswords, Pins, API Tokens, etc
• Given many recent, very public user/password data
thefts, you owe it to yourself to use this one…
B C RY P T : Q U I C K S TA R T
box install BCrypt
• Add additional configuration options and begin using
to secure your passwords
B C RY P T
/**
* BCrypt a string
*/
function bCrypt( string value ){
    return variables.bCrypt.hashPassword( ARGUMENTS.value );
}
/**
* Verify if a string matches
*/
function bCryptMatches( string provided, string stored ){
    try{
        return variables.bCrypt.checkPassword( provided,stored );
    } catch( "java.lang.IllegalArgumentException" e ){
        return false;
    }
}
C B M A I L S E R V I C E S
C B M A I L S E R V I C E S
• Object-Oriented email with a consistent interface
• Data tokens in views to support dynamic data
• Built-in protocols ( CFMail, File-based, Postmark )
• Other protocols available through forge box
• Allows for global configuration of sender information
• Additional protocols are easily developed
C B M A I L S E R V I C E S : Q U I C K S TA R T
box install cbmailservices
• Add additional configuration options to your Coldbox
configuration
C B M A I L S E R V I C E S
var contactMail = mailService.newMail(
to=event.getValue( "recipient", getSetting( "mailSettings" ).to ),
from=rc.email,
subject=rc.subject
);
contactMail.setBody( renderView( view=“email/contacts/index" ) );
mailService.send( contactMail );
M E M E N T I F I E R
M E M E N T I F I E R
• Transforms objects into data structures
• Injects itself in to model objects and can be
configured and extended
• Exceptionally fast transformations as native functions
( no passing around of objects or collections during
transformation)
M E M E N T I F I E R : Q U I C K S TA R T
box install mementifier
• Add additional memento configuration to your
modules
M E M E N T I F I E R
this.memento = {
// An array of the properties/relationships to include by default
defaultIncludes = [
"id",
"username",
"firstName",
"lastName",
"email",
"avatar"
],
defaultExcludes = [],
neverInclude = [
"password",
"PIN"
],
defaults = {
"roles" : [],
"explicitPermissions" : []
},
mappers = {}
};
M E M E N T I F I E R
/api/v1/products?includes=skus.media.mediaItem,skus.inventory
C F F R A C TA L
C F F R A C TA L
• Another tool for rich transformations of data objects
• Include and exclude items
• Custom serialization, filtering and sanitization of data
( e.g. XML, JSON, Arrays, Maps, etc )
• Prevents repetitive code in your handlers
C F F R A C TA L : Q U I C K S TA R T
box install cffractal
• Add transformers and serialization handling in your
handlers
C F F R A C TA L
fractal
.builder()
.collection( users )
.withTransformer( "UserTransformer" )
.withIncludes( "roles" )
.convert();
C F F R A C TA L
event.paramValue( “format”, “json” );

switch( rc.format ){

case “xml”:

var serializer = “XMLSerializer@cffractal”;

break;



default:

var serializer = “ResultsMapSerializer@cffractal”;

}
C B S T R E A M S
C B S T R E A M S
•  Enable functional-style operations on streams of elements ( e.g. -
collections )
• Elements in a stream are processed and passed across the
processing pipeline ( e.g. parallel transformations, while
maintaining synchronicity )
• Unlike traditional CFML functions like map(), reduce() and filter(),
which duplicate, streams maintain the integrity of the original
collection
• Chainable syntax which mimics native collection member
functions
C B S T R E A M S : Q U I C K S TA R T
box install cbstreams
C B S T R E A M S
return streamBuilder
.new( users )

.parallel()

.map( function( user ){
return {

“firstName” : user.firstName,

“lastName” : user.lastName

}
} )
.sorted( function( item1, item2 ){
return item1.lastName.compareNoCase( item2.lastName );
} )
.forEach( function( item ){
item[ “fullName” ]=item.firstName & “ “ & item.lastName;
} );
https://forgebox.io/view/cbstreams
T E N I N F I F T Y
• C F M I G R AT I O N S
• C B A U T H
• C B G U A R D
• C B VA L I D AT I O N
• C B S T O R A G E S
• B C RY P T
• C B M A I L S E R V I C E S
• M E M E N T I F I E R
• C F F R A C TA L
• C B S T R E A M S
Q & A

Weitere ähnliche Inhalte

Was ist angesagt?

Engage 2013 - Why Upgrade to v10 Tag
Engage 2013 - Why Upgrade to v10 TagEngage 2013 - Why Upgrade to v10 Tag
Engage 2013 - Why Upgrade to v10 TagWebtrends
 
What's new in GeoServer 2.2
What's new in GeoServer 2.2What's new in GeoServer 2.2
What's new in GeoServer 2.2GeoSolutions
 
Apache Cassandra Data Modeling with Travis Price
Apache Cassandra Data Modeling with Travis PriceApache Cassandra Data Modeling with Travis Price
Apache Cassandra Data Modeling with Travis PriceDataStax Academy
 
The State of the GeoServer project
The State of the GeoServer projectThe State of the GeoServer project
The State of the GeoServer projectGeoSolutions
 
Cassandra summit keynote 2014
Cassandra summit keynote 2014Cassandra summit keynote 2014
Cassandra summit keynote 2014jbellis
 
Data in Motion: Streaming Static Data Efficiently 2
Data in Motion: Streaming Static Data Efficiently 2Data in Motion: Streaming Static Data Efficiently 2
Data in Motion: Streaming Static Data Efficiently 2Martin Zapletal
 
PyCon DE 2013 - Table Partitioning with Django
PyCon DE 2013 - Table Partitioning with DjangoPyCon DE 2013 - Table Partitioning with Django
PyCon DE 2013 - Table Partitioning with DjangoMax Tepkeev
 
Apache Spark - Basics of RDD & RDD Operations | Big Data Hadoop Spark Tutoria...
Apache Spark - Basics of RDD & RDD Operations | Big Data Hadoop Spark Tutoria...Apache Spark - Basics of RDD & RDD Operations | Big Data Hadoop Spark Tutoria...
Apache Spark - Basics of RDD & RDD Operations | Big Data Hadoop Spark Tutoria...CloudxLab
 
Tokyo cassandra conference 2014
Tokyo cassandra conference 2014Tokyo cassandra conference 2014
Tokyo cassandra conference 2014jbellis
 
React table tutorial project setup, use table, and usefilter
React table tutorial project setup, use table, and usefilterReact table tutorial project setup, use table, and usefilter
React table tutorial project setup, use table, and usefilterKaty Slemon
 
London Scala UG - Lift:Getting started with Scala
London Scala UG - Lift:Getting started with ScalaLondon Scala UG - Lift:Getting started with Scala
London Scala UG - Lift:Getting started with ScalaSkills Matter
 
Spring data ii
Spring data iiSpring data ii
Spring data ii명철 강
 
How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF Luc Bors
 
Spring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenSpring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenJoshua Long
 
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스PgDay.Seoul
 
How to implement g rpc services in nodejs
How to implement g rpc services in nodejsHow to implement g rpc services in nodejs
How to implement g rpc services in nodejsKaty Slemon
 

Was ist angesagt? (20)

Engage 2013 - Why Upgrade to v10 Tag
Engage 2013 - Why Upgrade to v10 TagEngage 2013 - Why Upgrade to v10 Tag
Engage 2013 - Why Upgrade to v10 Tag
 
What's new in GeoServer 2.2
What's new in GeoServer 2.2What's new in GeoServer 2.2
What's new in GeoServer 2.2
 
Apache Cassandra Data Modeling with Travis Price
Apache Cassandra Data Modeling with Travis PriceApache Cassandra Data Modeling with Travis Price
Apache Cassandra Data Modeling with Travis Price
 
The State of the GeoServer project
The State of the GeoServer projectThe State of the GeoServer project
The State of the GeoServer project
 
Cassandra summit keynote 2014
Cassandra summit keynote 2014Cassandra summit keynote 2014
Cassandra summit keynote 2014
 
Dun ddd
Dun dddDun ddd
Dun ddd
 
Spock and Geb
Spock and GebSpock and Geb
Spock and Geb
 
Data in Motion: Streaming Static Data Efficiently 2
Data in Motion: Streaming Static Data Efficiently 2Data in Motion: Streaming Static Data Efficiently 2
Data in Motion: Streaming Static Data Efficiently 2
 
PyCon DE 2013 - Table Partitioning with Django
PyCon DE 2013 - Table Partitioning with DjangoPyCon DE 2013 - Table Partitioning with Django
PyCon DE 2013 - Table Partitioning with Django
 
Apache Spark - Basics of RDD & RDD Operations | Big Data Hadoop Spark Tutoria...
Apache Spark - Basics of RDD & RDD Operations | Big Data Hadoop Spark Tutoria...Apache Spark - Basics of RDD & RDD Operations | Big Data Hadoop Spark Tutoria...
Apache Spark - Basics of RDD & RDD Operations | Big Data Hadoop Spark Tutoria...
 
CQL3 in depth
CQL3 in depthCQL3 in depth
CQL3 in depth
 
Tokyo cassandra conference 2014
Tokyo cassandra conference 2014Tokyo cassandra conference 2014
Tokyo cassandra conference 2014
 
React table tutorial project setup, use table, and usefilter
React table tutorial project setup, use table, and usefilterReact table tutorial project setup, use table, and usefilter
React table tutorial project setup, use table, and usefilter
 
London Scala UG - Lift:Getting started with Scala
London Scala UG - Lift:Getting started with ScalaLondon Scala UG - Lift:Getting started with Scala
London Scala UG - Lift:Getting started with Scala
 
Spring data ii
Spring data iiSpring data ii
Spring data ii
 
How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF
 
Spring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenSpring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in Heaven
 
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
 
React lecture
React lectureReact lecture
React lecture
 
How to implement g rpc services in nodejs
How to implement g rpc services in nodejsHow to implement g rpc services in nodejs
How to implement g rpc services in nodejs
 

Ähnlich wie ITB2019 10 in 50: Ten Coldbox Modules You Should be Using in Every App - Jon Clausen

Coldbox developer training – session 5
Coldbox developer training – session 5Coldbox developer training – session 5
Coldbox developer training – session 5Billie Berzinskas
 
Vpd Virtual Private Database By Saurabh
Vpd   Virtual Private Database By SaurabhVpd   Virtual Private Database By Saurabh
Vpd Virtual Private Database By Saurabhguestd83b546
 
Local data storage for mobile apps
Local data storage for mobile appsLocal data storage for mobile apps
Local data storage for mobile appsIvano Malavolta
 
While writing program in any language, you need to use various variables to s...
While writing program in any language, you need to use various variables to s...While writing program in any language, you need to use various variables to s...
While writing program in any language, you need to use various variables to s...bhargavi804095
 
Spring design-juergen-qcon
Spring design-juergen-qconSpring design-juergen-qcon
Spring design-juergen-qconYiwei Ma
 
GWT.create 2013: Introduction to GXT
GWT.create 2013: Introduction to GXTGWT.create 2013: Introduction to GXT
GWT.create 2013: Introduction to GXTniloc132
 
Change tracking
Change trackingChange tracking
Change trackingSonny56
 
SenchaCon 2016: Upgrading an Ext JS 4.x Application to Ext JS 6.x - Mark Linc...
SenchaCon 2016: Upgrading an Ext JS 4.x Application to Ext JS 6.x - Mark Linc...SenchaCon 2016: Upgrading an Ext JS 4.x Application to Ext JS 6.x - Mark Linc...
SenchaCon 2016: Upgrading an Ext JS 4.x Application to Ext JS 6.x - Mark Linc...Sencha
 
Apache cassandra - future without boundaries (part3)
Apache cassandra - future without boundaries (part3)Apache cassandra - future without boundaries (part3)
Apache cassandra - future without boundaries (part3)Return on Intelligence
 
Beginning direct3d gameprogrammingcpp02_20160324_jintaeks
Beginning direct3d gameprogrammingcpp02_20160324_jintaeksBeginning direct3d gameprogrammingcpp02_20160324_jintaeks
Beginning direct3d gameprogrammingcpp02_20160324_jintaeksJinTaek Seo
 
Apache Calcite Tutorial - BOSS 21
Apache Calcite Tutorial - BOSS 21Apache Calcite Tutorial - BOSS 21
Apache Calcite Tutorial - BOSS 21Stamatis Zampetakis
 
DataStax NYC Java Meetup: Cassandra with Java
DataStax NYC Java Meetup: Cassandra with JavaDataStax NYC Java Meetup: Cassandra with Java
DataStax NYC Java Meetup: Cassandra with Javacarolinedatastax
 
Unit test candidate solutions
Unit test candidate solutionsUnit test candidate solutions
Unit test candidate solutionsbenewu
 
Designing a production grade realtime ml inference endpoint
Designing a production grade realtime ml inference endpointDesigning a production grade realtime ml inference endpoint
Designing a production grade realtime ml inference endpointChandim Sett
 

Ähnlich wie ITB2019 10 in 50: Ten Coldbox Modules You Should be Using in Every App - Jon Clausen (20)

12Structures.pptx
12Structures.pptx12Structures.pptx
12Structures.pptx
 
Couchbas for dummies
Couchbas for dummiesCouchbas for dummies
Couchbas for dummies
 
Coldbox developer training – session 5
Coldbox developer training – session 5Coldbox developer training – session 5
Coldbox developer training – session 5
 
Linq
LinqLinq
Linq
 
Vpd Virtual Private Database By Saurabh
Vpd   Virtual Private Database By SaurabhVpd   Virtual Private Database By Saurabh
Vpd Virtual Private Database By Saurabh
 
Local data storage for mobile apps
Local data storage for mobile appsLocal data storage for mobile apps
Local data storage for mobile apps
 
While writing program in any language, you need to use various variables to s...
While writing program in any language, you need to use various variables to s...While writing program in any language, you need to use various variables to s...
While writing program in any language, you need to use various variables to s...
 
11-Classes.ppt
11-Classes.ppt11-Classes.ppt
11-Classes.ppt
 
Google cloud Dataflow & Apache Flink
Google cloud Dataflow & Apache FlinkGoogle cloud Dataflow & Apache Flink
Google cloud Dataflow & Apache Flink
 
Spring design-juergen-qcon
Spring design-juergen-qconSpring design-juergen-qcon
Spring design-juergen-qcon
 
GWT.create 2013: Introduction to GXT
GWT.create 2013: Introduction to GXTGWT.create 2013: Introduction to GXT
GWT.create 2013: Introduction to GXT
 
Change tracking
Change trackingChange tracking
Change tracking
 
SenchaCon 2016: Upgrading an Ext JS 4.x Application to Ext JS 6.x - Mark Linc...
SenchaCon 2016: Upgrading an Ext JS 4.x Application to Ext JS 6.x - Mark Linc...SenchaCon 2016: Upgrading an Ext JS 4.x Application to Ext JS 6.x - Mark Linc...
SenchaCon 2016: Upgrading an Ext JS 4.x Application to Ext JS 6.x - Mark Linc...
 
Apache cassandra - future without boundaries (part3)
Apache cassandra - future without boundaries (part3)Apache cassandra - future without boundaries (part3)
Apache cassandra - future without boundaries (part3)
 
Beginning direct3d gameprogrammingcpp02_20160324_jintaeks
Beginning direct3d gameprogrammingcpp02_20160324_jintaeksBeginning direct3d gameprogrammingcpp02_20160324_jintaeks
Beginning direct3d gameprogrammingcpp02_20160324_jintaeks
 
Apache Calcite Tutorial - BOSS 21
Apache Calcite Tutorial - BOSS 21Apache Calcite Tutorial - BOSS 21
Apache Calcite Tutorial - BOSS 21
 
Refreshing mule cache using oracle database change notification
Refreshing mule cache using oracle database change notificationRefreshing mule cache using oracle database change notification
Refreshing mule cache using oracle database change notification
 
DataStax NYC Java Meetup: Cassandra with Java
DataStax NYC Java Meetup: Cassandra with JavaDataStax NYC Java Meetup: Cassandra with Java
DataStax NYC Java Meetup: Cassandra with Java
 
Unit test candidate solutions
Unit test candidate solutionsUnit test candidate solutions
Unit test candidate solutions
 
Designing a production grade realtime ml inference endpoint
Designing a production grade realtime ml inference endpointDesigning a production grade realtime ml inference endpoint
Designing a production grade realtime ml inference endpoint
 

Mehr von Ortus Solutions, Corp

BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Secure your Secrets and Settings in ColdFusion
Secure your Secrets and Settings in ColdFusionSecure your Secrets and Settings in ColdFusion
Secure your Secrets and Settings in ColdFusionOrtus Solutions, Corp
 
Daniel Garcia ContentBox: CFSummit 2023
Daniel Garcia ContentBox: CFSummit 2023Daniel Garcia ContentBox: CFSummit 2023
Daniel Garcia ContentBox: CFSummit 2023Ortus Solutions, Corp
 
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdfITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdfOrtus Solutions, Corp
 
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdf
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdfITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdf
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdfOrtus Solutions, Corp
 
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdf
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdfITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdf
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdfOrtus Solutions, Corp
 
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdf
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdfITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdf
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdfOrtus Solutions, Corp
 
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdfITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdfOrtus Solutions, Corp
 
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdfITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdfOrtus Solutions, Corp
 
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdf
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdfITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdf
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdfOrtus Solutions, Corp
 
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdf
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdfITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdf
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdfOrtus Solutions, Corp
 
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdf
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdfITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdf
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdfOrtus Solutions, Corp
 
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdf
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdfITB_2023_Chatgpt_Box_Scott_Steinbeck.pdf
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdfOrtus Solutions, Corp
 
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdfITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdfOrtus Solutions, Corp
 
ITB_2023_Create_as_many_web_sites_or_web_apps_as_you_want_George_Murphy.pdf
ITB_2023_Create_as_many_web_sites_or_web_apps_as_you_want_George_Murphy.pdfITB_2023_Create_as_many_web_sites_or_web_apps_as_you_want_George_Murphy.pdf
ITB_2023_Create_as_many_web_sites_or_web_apps_as_you_want_George_Murphy.pdfOrtus Solutions, Corp
 
ITB2023 Developing for Performance - Denard Springle.pdf
ITB2023 Developing for Performance - Denard Springle.pdfITB2023 Developing for Performance - Denard Springle.pdf
ITB2023 Developing for Performance - Denard Springle.pdfOrtus Solutions, Corp
 

Mehr von Ortus Solutions, Corp (20)

BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Ortus Government.pdf
Ortus Government.pdfOrtus Government.pdf
Ortus Government.pdf
 
Luis Majano The Battlefield ORM
Luis Majano The Battlefield ORMLuis Majano The Battlefield ORM
Luis Majano The Battlefield ORM
 
Brad Wood - CommandBox CLI
Brad Wood - CommandBox CLI Brad Wood - CommandBox CLI
Brad Wood - CommandBox CLI
 
Secure your Secrets and Settings in ColdFusion
Secure your Secrets and Settings in ColdFusionSecure your Secrets and Settings in ColdFusion
Secure your Secrets and Settings in ColdFusion
 
Daniel Garcia ContentBox: CFSummit 2023
Daniel Garcia ContentBox: CFSummit 2023Daniel Garcia ContentBox: CFSummit 2023
Daniel Garcia ContentBox: CFSummit 2023
 
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdfITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
ITB_2023_Human-Friendly_Scheduled_Tasks_Giancarlo_Gomez.pdf
 
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdf
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdfITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdf
ITB_2023_CommandBox_Multi-Server_-_Brad_Wood.pdf
 
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdf
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdfITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdf
ITB_2023_The_Many_Layers_of_OAuth_Keith_Casey_.pdf
 
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdf
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdfITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdf
ITB_2023_Relationships_are_Hard_Data_modeling_with_NoSQL_Curt_Gratz.pdf
 
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdfITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
 
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdfITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
ITB_2023_25_Most_Dangerous_Software_Weaknesses_Pete_Freitag.pdf
 
ITB_2023_CBWire_v3_Grant_Copley.pdf
ITB_2023_CBWire_v3_Grant_Copley.pdfITB_2023_CBWire_v3_Grant_Copley.pdf
ITB_2023_CBWire_v3_Grant_Copley.pdf
 
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdf
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdfITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdf
ITB_2023_Practical_AI_with_OpenAI_-_Grant_Copley_.pdf
 
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdf
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdfITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdf
ITB_2023_When_Your_Applications_Work_As_a_Team_Nathaniel_Francis.pdf
 
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdf
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdfITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdf
ITB_2023_Faster_Apps_That_Wont_Get_Crushed_Brian_Klaas.pdf
 
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdf
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdfITB_2023_Chatgpt_Box_Scott_Steinbeck.pdf
ITB_2023_Chatgpt_Box_Scott_Steinbeck.pdf
 
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdfITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
ITB_2023_CommandBox_Task_Runners_Brad_Wood.pdf
 
ITB_2023_Create_as_many_web_sites_or_web_apps_as_you_want_George_Murphy.pdf
ITB_2023_Create_as_many_web_sites_or_web_apps_as_you_want_George_Murphy.pdfITB_2023_Create_as_many_web_sites_or_web_apps_as_you_want_George_Murphy.pdf
ITB_2023_Create_as_many_web_sites_or_web_apps_as_you_want_George_Murphy.pdf
 
ITB2023 Developing for Performance - Denard Springle.pdf
ITB2023 Developing for Performance - Denard Springle.pdfITB2023 Developing for Performance - Denard Springle.pdf
ITB2023 Developing for Performance - Denard Springle.pdf
 

Kürzlich hochgeladen

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 

Kürzlich hochgeladen (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

ITB2019 10 in 50: Ten Coldbox Modules You Should be Using in Every App - Jon Clausen

  • 1. T E N I N F I F T Y T E N C O L D B O X M O D U L E S 
 Y O U S H O U L D B E U S I N G 
 I N E V E RY A P P L I C AT I O N
  • 2. Me: Jon Clausen Senior Software Developer,
 Ortus Solutions Grand Rapids, Michigan
  • 3. C F M I G R AT I O N S
  • 4. C F M I G R AT I O N S • Version control for your application's database • Changes to database schema are kept in timestamped files that run in order • Two methods: up and down • Built on the QB ( Query Builder ) module, which is database-agnostic • Excellent for deployments across multiple tiers
  • 5. C F M I G R AT I O N S : Q U I C K S TA R T box install cfmigrations
 
 box install commandbox-migrations
 
 box migrate create AddResetTokenToUsersTable
  • 6. C F M I G R AT I O N S component { function up( schema ) { schema.alter( "users", function( table ){ table.addColumn( table.string( "resetToken", 75 ).nullable() ); } ); } function down( schema ) { schema.alter( "users", function( table ){ table.dropColumn( "resetToken" ); } ); } }
  • 7. C B A U T H
  • 8. C B A U T H • Authentication wrapper for Coldbox • Interception points and standardized conventions • Supertype global methods to allow easy access to authentication info in your handlers, views, and interceptors • Simplifies the task of rewriting the auth mechanisms with every new application
  • 9. C B A U T H : Q U I C K S TA R T box install cbauth • Specify a userServiceClass in your config/ ColdBox.cfc inside moduleSettings.cbauth.us erServiceClass • Implement three methods in your user service class and one method in your user object/entity
  • 10. C B A U T H // Tests the credentials
 public boolean function isValidCredentials( 
 required string username, 
 required string password 
 ){ var user = retrieveUserByUsername( arguments.username ); if( !isNull( user ) ){ return encryptionService.bcryptMatches( 
 arguments.password, 
 user.getPassword() 
 ); } else { return false; } } 
 // retrieves the user to test the credentials public function retrieveUserByUsername( required string username ){ return newEntity().where( 'email', arguments.username ).first(); } 
 // retrieves the user by identifier public function retrieveUserById( required string id ){ return newEntity().find( arguments.id ); }
  • 11. C B G U A R D
  • 12. C B G U A R D • Secure routes and events to logged in users and users with specific permissions with component and function annotations • A simple “secured” annotation on a handler prevents execution from all but authenticated users, while additional annotations will check permissions • Handlers/actions may use combinations of actions to provide granular lockdown control • Authentication failures may be re-routed by module and by type of request ( e.g. AJAX vs UI )
  • 13. C B G U A R D : Q U I C K S TA R T box install cbguard • Implement two methods in your existing authentication service: hasPermission and isLoggedIn • Configure your Coldbox.cfc with the authentication service and any desired override events • Add additional configuration overrides to any application modules
  • 14. C B G U A R D moduleSettings = { cbguard = { authenticationService : “SecurityService”, authenticationOverrideEvent : “Main.onAuthenticationFailure”,
 authenticationAjaxOverrideEvent : “BaseAPIHandler.onAuthorizationFailure”,
 authorizationOverrideEvent : “Main.onAuthorizationFailure”,
 authorizationAjaxOverrideEvent : “BaseAPIHandler.onAuthorizationFailure”, } };
  • 15. C B G U A R D component secured{
 
 function index( event, rc, prc ){...}
 
 function create( event, rc, prc ) secured=“User:Create”{...} function update( event, rc, prc ) secured=“User:Edit”{…} ...
 
 }
  • 16. C B VA L I D AT I O N
  • 17. C B VA L I D AT I O N • An oldie but goodie. • Works with a variety of different entities, models, DAOs, etc • Supertype methods to simplify validation in handlers • Global or model-specific constraints may be specified
  • 18. C B VA L I D AT I O N : Q U I C K S TA R T box install cbvalidation • Add constraints to your config, models or objects • Add validation routines in your handler CRUD methods
  • 19. C B VA L I D AT I O N this.constraints = { firstName : { required : true }, lastName : { required : true }, password : { required : true }, email : { required : true, validator : "UniqueValidator@cborm" } }; moduleSettings = { cbvalidation = { sharedConstraints = { modifiedTime = { required: true }, modifiedBy = { required: true }, } } };
  • 20. C B S T O R A G E S
  • 21. C B S T O R A G E S • Another oldie but goodie. • Provides you with a collection of *smart* interfaces for dealing with common scopes and storage mechanisms ( i.e. - cookies, cache ) • Consistent methods for dealing with all scopes - you can change from SessionStorage to CookieStorage without refactoring code • Cookie Storage handles automatic encryption/decryption • Cache Storage simplifies distributed caching of authentication and “session” persistence
  • 22. C B S T O R A G E S : Q U I C K S TA R T box install cbstorages • Begin implementing usage in your auth services and other places where storage scopes are used
  • 23. C B S T O R A G E S component{
 property name=“cookieStorage” inject=“CookieStorage@cbstorages”;
 property name=“sessionStorage” inject=“CacheStorage@cbstorages”;
 }
  • 24. C B S T O R A G E S function setAuthorizedUser( required User user ){         //set our session storage var         sessionStorage.setVar(             name="AuthorizedUser",             value=arguments.user.getId()         );         // set a cookie which we can use for timeout evaluation         cookieStorage.setVar(             name="AuthorizedUser",             value=arguments.user.getId(),             expires = dateDiff( 'd', now(), dateAdd( 'n', now(), 20 ) )         );         return this; } function logout(){ if( isSessionAuthenticated() ){         sessionStorage.deleteVar( "AuthorizedUser" );         cookieStorage.deleteVar(“AuthorizedUser" ); } }
  • 25. B C RY P T
  • 26. B C RY P T • Creates cryptographically strong (and slow) hashes • Implements one-way encryption - can never be decrypted • Usages: Paswords, Pins, API Tokens, etc • Given many recent, very public user/password data thefts, you owe it to yourself to use this one…
  • 27. B C RY P T : Q U I C K S TA R T box install BCrypt • Add additional configuration options and begin using to secure your passwords
  • 28. B C RY P T /** * BCrypt a string */ function bCrypt( string value ){     return variables.bCrypt.hashPassword( ARGUMENTS.value ); } /** * Verify if a string matches */ function bCryptMatches( string provided, string stored ){     try{         return variables.bCrypt.checkPassword( provided,stored );     } catch( "java.lang.IllegalArgumentException" e ){         return false;     } }
  • 29. C B M A I L S E R V I C E S
  • 30. C B M A I L S E R V I C E S • Object-Oriented email with a consistent interface • Data tokens in views to support dynamic data • Built-in protocols ( CFMail, File-based, Postmark ) • Other protocols available through forge box • Allows for global configuration of sender information • Additional protocols are easily developed
  • 31. C B M A I L S E R V I C E S : Q U I C K S TA R T box install cbmailservices • Add additional configuration options to your Coldbox configuration
  • 32. C B M A I L S E R V I C E S var contactMail = mailService.newMail( to=event.getValue( "recipient", getSetting( "mailSettings" ).to ), from=rc.email, subject=rc.subject ); contactMail.setBody( renderView( view=“email/contacts/index" ) ); mailService.send( contactMail );
  • 33. M E M E N T I F I E R
  • 34. M E M E N T I F I E R • Transforms objects into data structures • Injects itself in to model objects and can be configured and extended • Exceptionally fast transformations as native functions ( no passing around of objects or collections during transformation)
  • 35. M E M E N T I F I E R : Q U I C K S TA R T box install mementifier • Add additional memento configuration to your modules
  • 36. M E M E N T I F I E R this.memento = { // An array of the properties/relationships to include by default defaultIncludes = [ "id", "username", "firstName", "lastName", "email", "avatar" ], defaultExcludes = [], neverInclude = [ "password", "PIN" ], defaults = { "roles" : [], "explicitPermissions" : [] }, mappers = {} };
  • 37. M E M E N T I F I E R /api/v1/products?includes=skus.media.mediaItem,skus.inventory
  • 38. C F F R A C TA L
  • 39. C F F R A C TA L • Another tool for rich transformations of data objects • Include and exclude items • Custom serialization, filtering and sanitization of data ( e.g. XML, JSON, Arrays, Maps, etc ) • Prevents repetitive code in your handlers
  • 40. C F F R A C TA L : Q U I C K S TA R T box install cffractal • Add transformers and serialization handling in your handlers
  • 41. C F F R A C TA L fractal .builder() .collection( users ) .withTransformer( "UserTransformer" ) .withIncludes( "roles" ) .convert();
  • 42. C F F R A C TA L event.paramValue( “format”, “json” );
 switch( rc.format ){
 case “xml”:
 var serializer = “XMLSerializer@cffractal”;
 break;
 
 default:
 var serializer = “ResultsMapSerializer@cffractal”;
 }
  • 43. C B S T R E A M S
  • 44. C B S T R E A M S •  Enable functional-style operations on streams of elements ( e.g. - collections ) • Elements in a stream are processed and passed across the processing pipeline ( e.g. parallel transformations, while maintaining synchronicity ) • Unlike traditional CFML functions like map(), reduce() and filter(), which duplicate, streams maintain the integrity of the original collection • Chainable syntax which mimics native collection member functions
  • 45. C B S T R E A M S : Q U I C K S TA R T box install cbstreams
  • 46. C B S T R E A M S return streamBuilder .new( users )
 .parallel()
 .map( function( user ){ return {
 “firstName” : user.firstName,
 “lastName” : user.lastName
 } } ) .sorted( function( item1, item2 ){ return item1.lastName.compareNoCase( item2.lastName ); } ) .forEach( function( item ){ item[ “fullName” ]=item.firstName & “ “ & item.lastName; } ); https://forgebox.io/view/cbstreams
  • 47. T E N I N F I F T Y • C F M I G R AT I O N S • C B A U T H • C B G U A R D • C B VA L I D AT I O N • C B S T O R A G E S • B C RY P T • C B M A I L S E R V I C E S • M E M E N T I F I E R • C F F R A C TA L • C B S T R E A M S
  • 48. Q & A