$prefix, 'plugin' => $plugin, 'controller' => $controller, 'action' => $action]; } /** * Check if the action is the one from a request * * @param string $action users action * @param \Cake\Http\ServerRequest $request the request * @return bool */ public static function checkActionOnRequest($action, ServerRequest $request) { $route = static::actionParams($action); foreach ($route as $param => $value) { if ($request->getParam($param, null) !== $value) { return false; } } return true; } /** * Setup needed config urls but without overwriting * * @return void */ public static function setupConfigUrls() { $urls = self::getDefaultConfigUrls(); foreach ($urls as $configKey => $url) { if (!Configure::check($configKey)) { Configure::write($configKey, $url); } } } /** * Get a list of default config urls using static::actionUrl method for users url. * * @return array */ private static function getDefaultConfigUrls() { $loginAction = static::actionUrl('login'); return [ 'Users.Profile.route' => static::actionUrl('profile'), 'OneTimePasswordAuthenticator.verifyAction' => static::actionUrl('verify'), 'Webauthn2fa.startAction' => static::actionUrl('webauthn2fa'), 'Auth.AuthenticationComponent.loginAction' => $loginAction, 'Auth.AuthenticationComponent.logoutRedirect' => $loginAction, 'Auth.Authenticators.Form.loginUrl' => $loginAction, 'Auth.Authenticators.Cookie.loginUrl' => $loginAction, 'Auth.Authenticators.SocialPendingEmail.loginUrl' => $loginAction, 'Auth.AuthorizationMiddleware.unauthorizedHandler.url' => $loginAction, 'OAuth.path' => static::actionParams('socialLogin'), ]; } }