Skip to content

Commit 1c0d5fa

Browse files
committed
Merge branch 'development'
2 parents ca4e9fa + cd5c4ae commit 1c0d5fa

File tree

5 files changed

+26
-20
lines changed

5 files changed

+26
-20
lines changed

box.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name":"ColdBox Security",
3-
"version":"2.4.0",
3+
"version":"2.5.0",
44
"location":"https://downloads.ortussolutions.com/ortussolutions/coldbox-modules/cbsecurity/@build.version@/[email protected]@.zip",
55
"author":"Ortus Solutions.com <[email protected]>",
66
"slug":"cbsecurity",
@@ -29,8 +29,8 @@
2929
],
3030
"dependencies":{
3131
"jwt-cfml":"^1.0.0",
32-
"cbauth":"^4.0.0",
33-
"cbcsrf":"^2.0.0"
32+
"cbauth":"^5.0.0",
33+
"cbcsrf":"^2.0.0"
3434
},
3535
"scripts":{
3636
"toMaster":"recipe build/toMaster.boxr",

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## 2.5.0
4+
5+
* `Feature` : Upgraded to `cbAuth` @ 5.x
6+
37
## 2.4.0
48

59
* `Feature` : We now include the `cbcsrf` module to allow for protections of cross site request forgery vectors. Please see all the features included in this module here: https://github.com/coldbox-modules/cbcsrf

interfaces/IAuthService.cfc

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ interface{
99
/**
1010
* Get the authenticated user
1111
*
12+
* @throws NoUserLoggedIn : If the user is not logged in
13+
*
1214
* @return User that implements IAuthUser
13-
* @throws NoUserLoggedIn
1415
*/
1516
any function getUser();
1617

@@ -20,20 +21,24 @@ interface{
2021
boolean function isLoggedIn();
2122

2223
/**
23-
* Attemps to log in a user
24+
* Try to authenticate a user into the system. If the authentication fails an exception is thrown, else the logged in user object is returned
2425
*
2526
* @username The username to log in with
2627
* @password The password to log in with
2728
*
2829
* @throws InvalidCredentials
30+
*
31+
* @return User : The logged in user object
2932
*/
30-
boolean function authenticate( required username, required password );
33+
any function authenticate( required username, required password );
3134

3235
/**
33-
* Logs a user into the system
34-
*
35-
* @user The user object that implements IAuthUser
36-
*/
36+
* Login a user into our persistent scopes
37+
*
38+
* @user The user object to log in
39+
*
40+
* @return The same user object so you can do functional goodness
41+
*/
3742
function login( required user );
3843

3944
/**

models/jwt/JwtService.cfc

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,12 @@ component accessors="true" singleton {
136136
required password,
137137
struct customClaims = {}
138138
){
139-
var auth = cbSecurity.getAuthService();
140-
141-
if ( auth.authenticate( arguments.username, arguments.password ) ) {
142-
// Create it
143-
return fromUser( auth.getUser(), arguments.customClaims );
144-
} else {
145-
// Can't do anything if the authenticate is false.
146-
throw( message = "The credentials are invalid!", type = "InvalidCredentials" );
147-
}
139+
var oUser = cbSecurity
140+
.getAuthService()
141+
.authenticate( arguments.username, arguments.password );
142+
143+
// Create it
144+
return fromUser( oUser, arguments.customClaims );
148145
}
149146

150147
/**

test-harness/box.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dependencies":{
88
"coldbox":"^5.0.0",
99
"testbox":"be",
10-
"cbauth":"^4.0.0",
10+
"cbauth":"^5.0.0",
1111
"BCrypt":"^2.5.0-snapshot",
1212
"jwt-cfml":"^1.0.0",
1313
"cbcsrf":"^2.0.0+21"

0 commit comments

Comments
 (0)