File tree Expand file tree Collapse file tree 7 files changed +33
-11
lines changed
Expand file tree Collapse file tree 7 files changed +33
-11
lines changed Original file line number Diff line number Diff line change @@ -2,10 +2,6 @@ language: java
22sudo : required
33jdk :
44 - oraclejdk8
5- cache :
6- directories :
7- - " $HOME/.CommandBox/artifacts/"
8- - " $HOME/.CommandBox/server/"
95env :
106 matrix :
117 - ENGINE=adobe@2018
Original file line number Diff line number Diff line change 11component {
22
33 this .title = " cbauth" ;
4+ this .autoMapModels = false ;
5+ this .dependencies = [ " cbstorages" ];
46
57 function configure () {
68 settings = {
7- userServiceClass = " "
9+ userServiceClass = " " ,
10+ sessionStorage = " SessionStorage@cbstorages" ,
11+ requestStorage = " RequestStorage@cbstorages"
812 };
913
1014 interceptorSettings = {
@@ -13,6 +17,10 @@ component {
1317 }
1418
1519 function onLoad () {
20+ binder .map ( " SessionStorage@cbauth" ).toDSL ( settings .sessionStorage );
21+ binder .map ( " RequestStorage@cbauth" ).toDSL ( settings .requestStorage );
22+ binder .map ( " AuthenticationService@cbauth" ).to ( " #moduleMapping #.models.AuthenticationService" );
23+
1624 var helpers = controller .getSetting ( " applicationHelper" );
1725 arrayAppend (
1826 helpers ,
@@ -25,7 +33,7 @@ component {
2533 controller .setSetting (
2634 " applicationHelper" ,
2735 arrayFilter ( controller .getSetting ( " applicationHelper" ), function ( helper ) {
28- return helper ! = " #moduleMapping #/helpers/AuthenticationServiceHelpers.cfm" ;
36+ return helper ! = " #moduleMapping #/helpers/AuthenticationServiceHelpers.cfm" ;
2937 } )
3038 );
3139 }
Original file line number Diff line number Diff line change @@ -16,6 +16,12 @@ Specify a `userServiceClass` in your `config/ColdBox.cfc` inside `moduleSettings
1616
1717Additionally, the user component returned by the ` retrieve ` methods needs to respond to ` getId() ` .
1818
19+ You can also specify a ` sessionStorage ` and a ` requestStorage ` WireBox mapping.
20+ These will be used inside ` AuthenticationService ` . By default, these are
21+ ` SessionStorage@cbstorages ` and ` RequestStorage@cbstorages ` respectively.
22+ Interfaces are provided in the ` models ` folder for reference when building
23+ your own. (Your storage classes do not need to formally implement the interface.)
24+
1925## Usage
2026
2127You can inject the ` authenticationService ` using WireBox.
@@ -154,4 +160,4 @@ interceptData
154160| sessionStorage | The sessionStorage object to store additional values if needed. |
155161| requestStorage | The requestStorage object to store additional values if needed. |
156162
157- This is the prime time to store additional values based on the user returned.
163+ This is the prime time to store additional values based on the user returned.
Original file line number Diff line number Diff line change 3131 "testbox" :" ^2.3.0+00044"
3232 },
3333 "installPaths" :{
34- "testbox" :" testbox" ,
35- "cbstorages" :" modules/cbstorages"
34+ "testbox" :" testbox/ " ,
35+ "cbstorages" :" modules/cbstorages/ "
3636 },
3737 "scripts" :{
3838 "postVersion" :" package set location='elpete/cbauth#v`package version`'"
Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ component singleton {
22
33 property name = " wirebox" inject = " wirebox" ;
44 property name = " interceptorService" inject = " coldbox:interceptorService" ;
5- property name = " sessionStorage" inject = " CacheStorage@cbstorages " ;
6- property name = " requestStorage" inject = " RequestStorage@cbstorages " ;
5+ property name = " sessionStorage" inject = " SessionStorage@cbauth " ;
6+ property name = " requestStorage" inject = " RequestStorage@cbauth " ;
77 property name = " userServiceClass" inject = " coldbox:setting:userServiceClass@cbauth" ;
88
99 variables .USER_ID_KEY = " cbauth__userId" ;
Original file line number Diff line number Diff line change 1+ interface name = " RequestStorageInterface" {
2+ public any function getVar ( required string name , any defaultValue );
3+ public void function setVar ( required string name , required any value );
4+ public boolean function deleteVar ( required string name );
5+ public boolean function exists ( required string name );
6+ }
Original file line number Diff line number Diff line change 1+ interface name = " SessionStorageInterface" {
2+ public any function getVar ( required string name , any defaultValue );
3+ public void function setVar ( required string name , required any value );
4+ public boolean function deleteVar ( required string name );
5+ public boolean function exists ( required string name );
6+ }
You can’t perform that action at this time.
0 commit comments