I'm using the react-router package to handle routes in a Meteor app, and I'd like to check if the user is logged in and is authorized to see specific routes. How can I do this?
I suggest checking out Base - it's an awesome Meteor boilerplate. If you want to see how routing works specifically, checkout:
https://github.com/themeteorchef/base/blob/master/imports/startup/client/routes.js
https://github.com/themeteorchef/base/blob/master/imports/ui/containers/AppNavigation.js
https://github.com/themeteorchef/base/blob/master/imports/ui/components/AppNavigation.js
Related
I'm a bit new to vue and nuxt, and I'm using firebase authentication with a custom token generation.
I'm looking for the best place to put the onAuthChange listener,
I'm trying to figure out if this should be implemented as middleware or maybe it could go somehow into the nuxt config
obviously, I want it to listen to the entire application all the time.
I found what I was looking for if someone else will ever encounter this question as well,
I've moved the listener to plugins and added the plugin to the nuxt.config.js file under the plugins section.
I would like to track the users on my Symfony 2.7 page using Piwik.
Piwiks default tracking option is the integration of a small JavaScript into the webpage, e.g. with the page footer. Of course this could easily be done by adding the code to the base Twig template.
However I would like to avoid the usage of JavaScript. My Symfony page and the Piwik page both run on the same server. Actually I am surprised that letting the client communicate with Piwik (over Javascript) is the recommended option instead of a direct way to let the webpage server talk to Piwik.
I think the Tracking HTTP API and the PHP Client are what I am looking for. However I am not sure on how to integrate this into Symfony.
I managed to connect my Symfony page with Piwik, however I wonder if this the right/best way to do it:
Used composer require "piwik/piwik-php-tracker" to add the PHPTracker to my Symfony project
Added a new Service that is responsible to create and manage a PiwikTracker object. The Service makes different methods of the Tracker, e.g. doTrackPageView() available to the rest of the project.
Added a new Twig function which uses the Service to trigger the doTrackPageView() method.
Added a call to this function to my base template
This works fine: Page views are correctly reported to Piwik and recorded without any problem. Of course I could easily add other methods to track events, actions, etc.
But: I am really surprised that I could not find any ready-to-use solution for this. Did I miss anything or is this the indented way to use Piwik with Symfony?
I would like to implement the SimpleSamlPHP bundle in my symfony project But, I'm having some issues with the redirect after the login.
Let me explain a little:
I have loaded "simplesamlphp/simplesamlphp" in my composer. So, the bundle sits in the vendor directory.
Then I wrote my own bundle where I configured the simplesaml, made controllers with login actions,...
Everything works (in the sense that I effectively have a button that redirects to the Idp (I configured) and does its thing). But then I get redirected to: http://BASEURL/module.php/saml/sp/saml2-acs.php/IDENTIFIER, which it does not find, because the files are in the vendor bundle.
When reading the documentation carefully, I saw that the baseUrl should point to the simplesaml package. But, because that package is in the vendor, I can't do that.
Is there a way to still use the simpleSAMLphp bundle or do I need to look for a symfony bundle to use simpleSAML?
Thank you.
I highly recommend you to give a try to :
https://www.lightsaml.com
I've tried to do a simple IDP / SP service and it works pretty well and straightforward. Along that I find the website examples also well written so you can start with a base.
If still want to use simplesaml search for "simplesamlphp-bundle" in packagist.org there is at least 3 packages that bundlify this and can help you out to set it up.
this is my first question on stack overflow so please be kind!
I have designed a Symfony server based application with an almost complete backend interface. Using symfony router, i can login in the backend using a url (ex. www.domain.com/admin) and see backend pages.
Based on this backend, i want to create an Angular2 application for dealing with the front end. It is quite straight forward to make it working for the front page url (www.domain.com). However, if i use any subroutes which would otherwise work in an Angular2 app (ex. www.domain.com/inner-page), Symfony router takes over and throws a 404 Not Found - NotFoundHttpException.
The question is, how can i use both routers in "parallel"? Any URL under www.domain.com/admin will be handled by Symfony router, and any other url by Angular2 router?
EDIT
Thank you for your replies!
I have something in mind. It might not be elegant, since it will require manual exclusion of angular routes from symfony, and vice versa, but it will look cleaner. I am still working on it though, so its still a theoretical concept:
For each url containing "/admin/", Symfony router will serve backend twig-php pages as it is designed to do. For any other url however, a simple controller will just serve the angular app.
On the other hand, in the front end, Angular router will work as it would normally do. However, if a url contains "/admin/", it will be handled by an Angular component that will simply change window.location.href within its OnInit function to redirect to Symfony backend.
The angular app should be built separately, Symfony is a back end framework and isn't a good choice to use for building angular apps.
I created an example of how to use the 2 together, with FOS User Bundle and FOS OAuth Server Bundle to deal with authentication.
It's a couple of years old now, but should give you a good idea of how to go about using them together.
Github is down right now, but I'll update this with a link when it comes back.
edit:
https://github.com/mbates/Symfony2-AngularJs
There is AngularUI routing framework available in AngularJS for routing purposes in your AngularJS application. You can use Angular UI-Routing framework to govern your application's frontend while Symfony2 take care of the backend of your application. Angular JS UI-Routing URL's will looks like this,
www.domain.com/#page1
instead of this,
www.domain.com/page1
After the hash (#) the url will not be a part of Symfony2. The place where you map Symfony2 urls with Angular UI-Router urls will be within states. Take a look at this tutorial. I hope AngularUI will solve your issue :)
Cheers!
I'm trying to use Meteor from behind a proxy. I've tried setting environment variables for proxy details as the docs but it has not helped.
SET HTTP_PROXY=http://user:password#1.2.3.4:5678
SET HTTPS_PROXY=http://user:password#1.2.3.4:5678
meteor update
Instead I want to bypass the proxy for the certain URLs that Meteor needs. I have identified atmospherejs.com and registry.npmjs.org (not sure if meteor uses this directly but we are also working with node separately).
Are there any other URLs that Meteor will need?
Here are some:
docs.meteor.com
s3-1.amazonaws.com
activity.meteor.com
warehouse.meteor.com
registry.npmjs.org
registry.npmjs.org
packages.meteor.com
I can't imagine that it's a specific domain causing your problem tough.