-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
230 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ jobs: | |
strategy: | ||
fail-fast: false | ||
matrix: | ||
cfengine: [ "lucee@5", "adobe@2018", "adobe@2021" ] | ||
cfengine: [ "lucee@5", "adobe@2018", "adobe@2021", "adobe@2023" ] | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,30 @@ | ||
component { | ||
|
||
/** | ||
* Configure CBAuth for operation | ||
* https://cbauth.ortusbooks.com/installation-and-usage#configuration | ||
*/ | ||
function configure(){ | ||
return { "userServiceClass" : "UserService" }; | ||
return { | ||
/** | ||
*-------------------------------------------------------------------------- | ||
* User Service Class | ||
*-------------------------------------------------------------------------- | ||
* The user service class to use for authentication which must implement IUserService | ||
* https://cbauth.ortusbooks.com/iuserservice | ||
* The User object that this class returns must implement IUser as well | ||
* https://cbauth.ortusbooks.com/iauthuser | ||
*/ | ||
"userServiceClass" : "UserService", | ||
/** | ||
*------------------------------------------------------------------------- | ||
* Storage Classes | ||
*------------------------------------------------------------------------- | ||
* Which storages to use for tracking session and the request scope | ||
*/ | ||
"sessionStorage" : "SessionStorage@cbstorages", | ||
"requestStorage" : "RequestStorage@cbstorages" | ||
}; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,119 +1,31 @@ | ||
/** | ||
* A user in the system. | ||
* Implements CBSecurity's : IAuthUser and IJwtSubject interfaces | ||
* | ||
* This user is based off the Auth User included in cbsecurity, which implements already several interfaces and properties. | ||
* - https://coldbox-security.ortusbooks.com/usage/authentication-services#iauthuser | ||
* - https://coldbox-security.ortusbooks.com/jwt/jwt-services#jwt-subject-interface | ||
* | ||
* It also leverages several delegates for Validation, Population, Authentication, Authorization and JWT Subject. | ||
*/ | ||
component accessors="true" { | ||
|
||
/** | ||
* -------------------------------------------------------------------------- | ||
* Properties | ||
* -------------------------------------------------------------------------- | ||
*/ | ||
|
||
property name="id" default=""; | ||
property name="fname" default=""; | ||
property name="lname" default=""; | ||
property name="email" default=""; | ||
property name="password" default=""; | ||
property name="permissions" type="array"; | ||
|
||
/** | ||
* -------------------------------------------------------------------------- | ||
* Mementifier | ||
* -------------------------------------------------------------------------- | ||
*/ | ||
this.memento = { | ||
defaultIncludes : [ "*" ], | ||
defaultExcludes : [], | ||
neverInclude : [ "password" ] | ||
}; | ||
|
||
/** | ||
* -------------------------------------------------------------------------- | ||
* Validation | ||
* -------------------------------------------------------------------------- | ||
*/ | ||
this.constraints = { | ||
fname : { required : true }, | ||
lname : { required : true }, | ||
email : { required : true, type : "email" }, | ||
password : { required : true } | ||
}; | ||
component | ||
accessors ="true" | ||
extends ="cbsecurity.models.auth.User" | ||
transientCache="false" | ||
delegates =" | ||
Validatable@cbvalidation, | ||
Population@cbDelegates, | ||
Auth@cbSecurity, | ||
Authorizable@cbSecurity, | ||
JwtSubject@cbSecurity | ||
" | ||
{ | ||
|
||
/** | ||
* Constructor | ||
*/ | ||
function init(){ | ||
variables.permissions = []; | ||
|
||
super.init(); | ||
return this; | ||
} | ||
|
||
/** | ||
* -------------------------------------------------------------------------- | ||
* Authentication/Authorization Methods | ||
* -------------------------------------------------------------------------- | ||
*/ | ||
|
||
/** | ||
* Check if a user is loaded from the db or not | ||
*/ | ||
boolean function isLoaded(){ | ||
return ( !isNull( variables.id ) && len( variables.id ) ); | ||
} | ||
|
||
/** | ||
* Verify if the user has one or more of the passed in permissions | ||
* | ||
* @permission One or a list of permissions to check for access | ||
*/ | ||
boolean function hasPermission( required permission ){ | ||
// If no permissions, then it a default value of true comes in | ||
if ( isBoolean( arguments.permission ) && arguments.permission ) { | ||
return true; | ||
} | ||
|
||
if ( isSimpleValue( arguments.permission ) ) { | ||
arguments.permission = listToArray( arguments.permission ); | ||
} | ||
|
||
return arguments.permission | ||
.filter( function( item ){ | ||
return ( variables.permissions.findNoCase( item ) ); | ||
} ) | ||
.len(); | ||
} | ||
|
||
/** | ||
* Verify if the user has one or more of the passed in roles | ||
* | ||
* @role One or a list of roles to check for access | ||
*/ | ||
boolean function hasRole( required role ){ | ||
return true; | ||
} | ||
|
||
/** | ||
* -------------------------------------------------------------------------- | ||
* IJwtSubject Methods | ||
* -------------------------------------------------------------------------- | ||
*/ | ||
|
||
/** | ||
* A struct of custom claims to add to the JWT token | ||
*/ | ||
struct function getJwtCustomClaims(){ | ||
return {}; | ||
} | ||
|
||
/** | ||
* This function returns an array of all the scopes that should be attached to the JWT token that will be used for authorization. | ||
*/ | ||
array function getJwtScopes(){ | ||
return []; | ||
} | ||
|
||
} |
Oops, something went wrong.