You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(Login): Add new preLogin and postLogin interception points
Adding new interception points for `preLogin` and `postLogin` will allow applications which will log a user in by calling `auth().logIn()` explicitly instead of `auth().authenticate()` to perform important post-login actions. This would be especially useful for a site that has "remember me" functionality, where a user will be logged in based on a special cookie on their browser as opposed to them entering their username/password.
cbauth announces two custom interception points — preAuthentication and postAuthentication. You can use these interception points to change request data or add additional values to session or request scopes.
139
+
cbauth announces several custom interception points. You can use these interception points to change request data or add additional values to session or request scopes. The `preAuthentication` and `postAuthentication` events fire during the standard `authenticate()` method call with a username and password. The `preLogin` and `postLogin` events fire during the `login()` method call.
140
+
141
+
Note: the `preLogin` and `postLogin` interception points will be called during the course of `authenticate()`. The order of the calls then are `preAuthentication` -> `preLogin` -> `postLogin` -> `postAuthentication`.
140
142
141
143
### `preAuthentication`
142
144
@@ -161,3 +163,25 @@ interceptData
161
163
| requestStorage | The requestStorage object to store additional values if needed. |
162
164
163
165
This is the prime time to store additional values based on the user returned.
166
+
167
+
### `preLogin`
168
+
169
+
interceptData
170
+
171
+
| name | description |
172
+
| --- | --- |
173
+
| user | The user component to be logged in. |
174
+
175
+
176
+
### `postLogin`
177
+
178
+
interceptData
179
+
180
+
| name | description |
181
+
| --- | --- |
182
+
| user | The user component to be logged in. |
183
+
| sessionStorage | The sessionStorage object to store additional values if needed. |
184
+
| requestStorage | The requestStorage object to store additional values if needed. |
185
+
186
+
187
+
This is a good opportunity to store additional data if your application logged the user in manually without authenticating via a username/password like a "remember me" system.
if ( !structKeyExists( variables, "userService" ) ) {
82
-
if ( userServiceClass=="" ) {
83
-
throw( "No [userServiceClass] provided. Please set in `config/ColdBox.cfc` under `moduleSettings.cbauth.userServiceClass`.", "IncompleteConfiguration" );
96
+
if ( variables.userServiceClass=="" ) {
97
+
throw(
98
+
type ="IncompleteConfiguration",
99
+
message ="No [userServiceClass] provided. Please set in `config/ColdBox.cfc` under `moduleSettings.cbauth.userServiceClass`."
0 commit comments