File tree Expand file tree Collapse file tree 2 files changed +18
-16
lines changed Expand file tree Collapse file tree 2 files changed +18
-16
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,9 @@ interface{
9
9
/**
10
10
* Get the authenticated user
11
11
*
12
+ * @throws NoUserLoggedIn : If the user is not logged in
13
+ *
12
14
* @return User that implements IAuthUser
13
- * @throws NoUserLoggedIn
14
15
*/
15
16
any function getUser ();
16
17
@@ -20,20 +21,24 @@ interface{
20
21
boolean function isLoggedIn ();
21
22
22
23
/**
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
24
25
*
25
26
* @username The username to log in with
26
27
* @password The password to log in with
27
28
*
28
29
* @throws InvalidCredentials
30
+ *
31
+ * @return User : The logged in user object
29
32
*/
30
- boolean function authenticate ( required username , required password );
33
+ any function authenticate ( required username , required password );
31
34
32
35
/**
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
+ */
37
42
function login ( required user );
38
43
39
44
/**
Original file line number Diff line number Diff line change @@ -136,15 +136,12 @@ component accessors="true" singleton {
136
136
required password ,
137
137
struct customClaims = {}
138
138
){
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 );
148
145
}
149
146
150
147
/**
You can’t perform that action at this time.
0 commit comments