Symfony routes not working anymore - symfony

I have an application been working on for a while with a fully working login and creating new users functionalities, and out of no where i was trying to switch the user -to change the role- i wasnt able to login again. after some digging around the code i found out that 302 code status is being thrown after login and therefor the logging process stopped working.
i had this code in my SecurityController:
return new RedirectResponse('/sys-admin/');
and changing that code to this :
return $this->forward('AppBundle:SystemAdmin:index', array());
make it work and i am logged in again but now all my routes stopped working, i mean in my views there are buttons something like :
<a href="{{ path('system_admin_client') }}"
class="btn pmd-btn-flat btn-default">Go!</a>
when i click the button i am logged out and redirected to the login page and in the network tab in any browser i can see that the route sys-admin/client have status code 302 since i was logged out.
running bin/console debug:router shows me all my routes are there and for this example running bin/console router:match /sys-admin/client also shows me a match with the controller and every information.
this is how my routes looks like:
app_system_admin:
prefix: /sys-admin
resource: "#AppBundle/Resources/config/routing/sys_admin.yml"
sys_admin.yml
system_admin_client:
path: /client
defaults: { _controller: AppBundle:SystemAdmin:index}
I cant figure out to know what went wrong! any help will be appreciated. Thanks!
more info: i am using Symfony 4.0.4 and if i tried to do something like forwarding on any route its working but the redirecting is not.

The 302 HTTP status code is for a redirection, it's not an error.
It was normal since you returned a RedirectResponse.
In my opinion the problem doesn't come from the redirection.
You should put it back and check the user-switching function (or the user itself).
If you do that, don't hardcode the redirection path. Use a Symfony method to generate it, like:
return $this->redirectToRoute('system_admin_index');

I found the solution after a lot of investigating. I am using docker to make the whole app running and for some reason php-fpm logs showed no errors but the error was the php session is being broken because of no access for the user, changing to root user on docker fixed this issue since root had access.

Related

Single sign out with WSO2 Identity Server - WS-Federation

I got single sign in working but I don't know how to configure single sign out.
Here is what I've tried so far (without any success):
[My Service provider] -> Inbound Authentication Configuration -> [my issuer] -> Enable Single Logout is Checked (custom URL is not given)
What I try is to simply redirect the browser to the URL where login is configured with the following parameter:
https://localhost:9443/passivests?wa=wsignout1.0
So the login works perfectly with this URL: https://localhost:9443/passivests
As I understand there is nothing else I should do but WSO2IS does not remove the cookie and when I try with my other webapp it logs me in as if nothing happened.
I omitted wreply (as it is optional) so I expect that the browser is not redirected back to my application or login screen. This is the reason I try it with a different application. Also the other app is opened FIRST after logout and it still gets the claims. (I always test with a new incognito mode chrome window to avoid false negatives because of leftover cookies)
So is there anything else I should do or is it perhaps a known bug?
This is a known bug. I can't find the particular class right now but the logout function called when using WS-Fed is an auto-generated //TODO stub.
https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/components/identity/org.wso2.carbon.identity.sts.passive/4.2.0/src/main/java/org/wso2/carbon/identity/sts/passive/processors/SignoutRequestProcessor.java

sonata sandbox blocking the Symfony2 exceptions?

I'm trying to understand how works sonata sandbox...
I have created a new route and trigged:
php app/console sonata:page:update-core-routes --site=3
the landingpage was creaded successfuly,
then :
php app/console sonata:page:create-snapshots --site=3
theoretically all is well created,
but my route is pointing to a own controller with my own template and my own block return any response...
sure that i have done something wrong in my block or in my template, but I'm really surprised because when I do a probe to see until where the script run well... for exaple:
//in my action
$this->asdfasdfasdfasfd();
I'm no getting any response, only a white screen. somebody know why? and how can I solve?

Routing & redirecting with iron-router

How does one do an official redirect to another route from a Template.event call using meteor and Iron-Router. I seem to, at least with the Dev branch run into the same error
`if (this._isRunning) // 174
throw new Error('Already in a page run'); `
As an example, i have a button that on click calls Router.go('/home'); if i run this, i get the 'already in a page run' error. Anyone else routing with the router go method?
Its actually the 'this.redirect('/anotherpath')' that causes the problem. Is there way to stop the current running page run and redirect to another route?
It looks like you're working off of the dev branch. The code you were working with has been rolled back because it wasn't working properly. If you still have the issue let me know, and sorry about that!
The code below will stop the current route controller from running (stop any downstream hooks and the action method from being run) and call Router.go('/anotherpath') which will cause a new route to run.
this.redirect('/anotherpath')

Oops! An Error Occurred The server returned a "500 Internal Server Error" on new actions created

I get the error as soon as I enter one of my actions on the project.
Oops! An Error Occurred The server returned a "500 Internal Server Error". Something is broken
Only on 1 page (Action) it happens. The most recent Action I created. The strange thing is that this happens only on the server. Locally on my windows server the page works normally.
The PHP internal logs on the server returns no errors.
The error occurs even if I remove all the code in the action and even if I clear the cache with 'php symfony cc'. Even if I set the permissions with 'php symfony project:permissions'. Even if I combine all of the previous solutions in different order.
Here is the action code:
public function executeExportPostsToProject(sfWebRequest $request)
{
echo 'why?? Show me please!';
}
On the same module there are about 20 other actions decleared the same way. I'm going crazy.
Tryed to check my server configuration for symfony. No Warnings.
The symfony version is 1.4.5.
Seems that the file name of the View is case sensitive under Linux. On Windows hadn't the same problem. On Linux for some reasons with the new files created on windows the problem occured. I renamed the View from exportPostsToProject.php to ExportPostsToProject.php solved this problem.
add route like this in your routing.yml for this action:
route_name:
url: /route-name-example
param: { module: ModuleName, action: exportPostsToProject }
and make sure to be on DEV environment

Facebook php SDK getUser returns 0 apart from my laptop and the app developer

I've looked over hundreds of answers for similar issues to this but can't find anything that seems to help.
I'm running the latest version of the PHP SDK and a login to facebook button which has a generated link from getLoginUrl().
Running on my development laptop and logged in as the application developer it passes me back to the redirect url (Both the callback url when calling getLoginUrl() and the URL set in my application settings are exactly the same) I then do a getUser call which will function in these circumstances.
If i try the same process using my Iphone on the same network, logged in as the same user on facebook getUser() returns 0.
It also does the same for any other user trying to login with facebook.
Sandbox mode is disabled.
my app domains seem to be set up correctly.
I'm really unsure of what to do next.
Many thanks for your responses guys - Turns out the issue was i was sending the request from one page and redirecting back to another. This seems to upset facebook (I'm guessing it will only re-direct back to the page it was called from).
That solved the problem anyway - but many thanks for your responses.
First make sure you are maintaining sessions in your scripts with:
session_start();
at the top of your php file.
Next use something like this to test if you have a fb user and if not, redirect them to the oauth, which will just renew their token if they've already authorized by it's expired.
require_once('facebook/fb.inc');
session_start();
if (!$fbUser) {
$loginUrl = $facebook->getLoginUrl(
array(
'scope' => 'email,publish_stream,user_location',
'redirect_uri' => 'http://scubadivinglog.org/php/fblink.php'
)
);
echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";
exit;
}
Hope this helps. Let us know and if not post the code you are using.

Resources