Forums › Forums › OroPlatform › OroPlatform – How do I? Questions › How to prefix all routes
This topic contains 11 replies, has 4 voices, and was last updated by Mike Kudelya 7 years, 7 months ago.
Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.
- CreatorTopic
- May 20, 2014 at 7:26 pm #35704
Hi,
I am trying to prefix all routes in the OroBAP. This is a relatively straight-forward thing to do in Symfony, yet I am running into an infinite loading screen. I have tried the following code in the routing.yml file.
123456oro_auto_routing:resource: .prefix: /admintype: oro_autoLike I stated above this produces an endless blue loading screen where the page never actually loads. I have tried sifting through the logs but have found nothing. Any insight on how I can go about prefixing all routes would be much appreciated.
Thanks,
-Sean - CreatorTopic
- AuthorReplies
- May 28, 2014 at 1:40 pm #35705
Hi.
It’s strange, did you tried to clear cache or reinstall with modified config ? There was some issue related, but it’s already fixed. We will publish 1.2 in the nearest 2-3 days, please check it out.
May 29, 2014 at 7:16 am #35706Yes I did try clearing my cache. I also tried running oro:install after adding the prefix to the config. Neither worked for me. I can see all the routes have the new prefix in the router:debug, but I am still getting the endless loading bar when trying to access a route.
May 29, 2014 at 10:20 am #35707I will try to find out what happens. Will keep you posted.
May 29, 2014 at 2:58 pm #35708I have just tried the 1.2 update and it seems prefixes work now. However I am getting “This webpage has a redirect loop” (in chrome) when trying to get to the user login page with a prefix. When I take the prefix off it works. I am unsure how to get around this.
May 31, 2014 at 11:30 am #35709Hello.
I tried to prefix routes with following lines in routing.yml
12345678910oro_default:pattern: /admin/defaults:_controller: OroDashboardBundle:Dashboard:vieworo_auto_routing:prefix: /adminresource: .type: oro_autoAlso changes in security.yml required
1234567891011121314151617181920212223242526272829303132login:pattern: ^/admin/user/(login|reset-request|send-email|check-email)$provider: chain_provideranonymous: truereset_password:pattern: ^/admin/user/reset/*provider: chain_provideranonymous: trueembedded_form:pattern: ^/admin/embedded-form/(submit|success)provider: chain_provideranonymous: truemain:pattern: ^/admin/provider: chain_providerform_login:csrf_provider: form.csrf_providercheck_path: oro_user_security_checklogin_path: oro_user_security_loginlogout:path: oro_user_security_logoutremember_me:key: %secret%name: CRMRMlifetime: 1209600 # stay logged for two weekshttponly: trueanonymous: falseHope this will help.
May 31, 2014 at 4:32 pm #35710Thank you for taking the time to look into this. I tried the same security.yml settings that you provided and I am getting an exception with the following message “Full authentication is required to access this resource.” I am getting this upon login (/app_dev.php/admin/user/login). Please let me know if there is anymore information I can provide to you. Thanks.
May 31, 2014 at 9:53 pm #35711Yes, my bad I forgot that also need to remove this line from security.yml
June 1, 2014 at 6:44 am #35712Perfect. Thank you again for helping me through this issue. Prefixes are now working for me.
May 12, 2015 at 7:20 am #35713Hi! I tried to do the same changes for my application and met following errors:
( ! ) LogicException: The check_path “/login_check” for login method “oauth” is not matched by the firewall pattern “^/admin/”. in ../vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php on line 292
As i understand this is because following line in security.yml:
123456main:pattern: ^/admin/provider: chain_providerform_login:csrf_provider: form.csrf_providercheck_path: oro_user_security_checkAnd such route definition is present in ../vendor/oro/platform/src/Oro/Bundle/DistributionBundle/Resources/config/routing.yml
What am i doing wrong? My ORO version is 1.7.0.
In addition: Is there some way to move all ORO BAP functionality to path /admin/ and leave login functionality on URLs without prefix (/login)?
May 20, 2015 at 9:57 am #35714Any advise, guys? Still got problems with this task.
August 10, 2016 at 2:48 am #35715Hi @anatolii,
Also you have missed delete this line, only for test, of course.
YAML1- { path: ^/admin/, role: ROLE_ADMIN }in /Library/WebServer/www/symfony/orocrm-application/app/config/security.yml
and set
YAML1234567891011121314151617181920hwi_oauth:firewall_name: mainresource_owners:google:type: googleclient_id: changeMeclient_secret: changeMescope: "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"security:firewalls:main:oauth:resource_owners:google: /login/check-googlelogin_path: /admin/user/loginfailure_path: /admin/user/logincheck_path: /admin/login_checkoauth_user_provider:service: oro_sso.oauth_providerin vendor/oro/platform/src/Oro/Bundle/SSOBundle/Resources/config/oro/app.yml
Also you need create listener, which will redirect you to right url after logout
PHP12345678parameters:custom_oro.listener.logout.class: Custom\Bundle\OroBundle\EventListener\LogoutListenerservices:custom_oro.listener.logout:class: %custom_oro.listener.logout.class%arguments:- @routersrc/Custom/Bundle/OroBundle/EventListener/LogoutListener.php
PHP123456789101112131415161718192021222324252627<?phpnamespace Custom\Bundle\OroBundle\EventListener;use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\HttpFoundation\RedirectResponse;use Symfony\Bundle\FrameworkBundle\Routing\Router;class LogoutListener implements LogoutSuccessHandlerInterface{/** @var Router */protected $router;/*** @param Router $router*/public function __construct(Router $router){$this->router = $router;}public function onLogoutSuccess(Request $request){return new RedirectResponse($this->router->generate('oro_default'));}}This is example how you can do this very fast. Of course you need extend SSOBundle and override app.yml
In addition: Is there some way to move all ORO BAP functionality to path /admin/ and leave login functionality on URLs without prefix (/login)?
Did you mean that the link must be without /user/login?
- AuthorReplies
The forum ‘OroPlatform – How do I? Questions’ is closed to new topics and replies.