Sharing authentication between php and python on same domain - php

I am in the early planning stages for a new project/site. Two-thrids of the application are already written in php/laravel. The new bit will be written in python, most likely with Flask or Cherrypy (I need Nosql access, so Django is out).
The Laravel application is the primary site and manages user signups, authentication, activity streams, and notifications, as well as a general REST Api. This part of the site is already well under development, and so switching to python is not an option.
Both sections would need to feel entirely unified to the end user. The design and themes would be identical. Even the urls would show no difference:
site.com - laravel
site.com/forums - laravel
site.com/login,logout,signup - laravel
site.com/ - laravel
site.com/maker - python/flask
I think I have figured out how to serve both from the same server, but how do I share logins? The user should be able to login using laravel and navigate to /maker and still be logged in.
To keep in mind:
maker will not signup user, only make sure they are logged in. If not, redirect to laravel's login page.
Also, both have access to the same database.
What are my options here?

Related

Persistent the authenticate user on main and the subdomains in the Laravel | Session | subdomains

Yes, I know it looks like an old question but still unclear.
I have two different Laravel applications and both have their separate tables. On my local system, I put both of them as subdomain domain(virtual host). Both of them are working fine.
What I want is that whenever a user logged in to either of the subdomains then the user should automatically be authenticated to another subdomain. So I don't need to login into my subdomain separately or again and again.
Some people suggest the following solution.
use the identical setup for app key, session.php, database, and use the database as a driver for the session.
use a third domain as the main domain(or subdomain like auth.example.com) and implement SSO with Laravel.
use passport and create the main domain for the oAuth server to provide tokens.
use Redis or Memcached as a session driver to persistent user authentication.
prefix the table(for second app) with some specific string(i.e app_2) and use single database(i.e database merge)
Real use case:-
One Laravel application handle all banking related feature so the subdomain will be banking.example.com
One Laravel application handle all accounting related feature so the subdomain will be accounting.example.com
I am a little bit confused now. Currently, both application is built using blade template engine for now but in future, the frontend may be in React or Angular. As of now, I can go with the Laravel Blade template engine.
Can someone help me with how can I achieve a single login system and persistent user login and also sync user information across main and subdomains in Laravel fashion?

Share active directory session Wordpress

We have several webapps based in Wordpress and Codeigniter, which are based on different servers but under the same domain (ie: intranet.something.local) and most of them use Active Directory login credentials.
For Wordpress, I'm using a plugin called Active Directory Integration to log in with these credentials and it's working perfectly after configuring openLDAP.
The thing is, our client asked us to have a single log on for every app, meaning that once I'm logged into Wordpress, I should be logged in when I go to another app, that uses the same login user and password.
Is there a possible way to do this? And if so, where should I start?
I believe, that is possible in multiple ways..
Setup Single Sign On in your apps
Use a script which automatically copies User data from a web app,
and then using that information creates user login to the other
apps..Idea is to let user register for one site, and based on that information, register him to other sites automatically
May be, some sort of Database sharing be possible, but that would be
really really a tough job, still Possible (I believe, in Computer
Science, nothing is impossible forever)
create a common cookie file and when user switches the app, use that
cookies to get the user login in between different apps

When logging in from my main site, I want to auto login to Redmine on another page

I have main PHP website and a Redmine app. When a user logged in to my website, new tab will pop-up and open the Redmine and login using the username and password that the user entered on the main website. Or if it is not possible to auto login from my main website to Redmine, is it possible to just have a default value on the username field and password field from the ones that the user also inputted on the main website?
I'm still noob on configuring Redmine and Ruby on Rails, so please bear with me :(
Edit: The main website and the Redmine website will be a system for our group only so I think security will not be a major issue. Also they won't be going online and will be operating through the intranet only.
You asked:
is it possible to modify redmine login page? To have it get variables on url? So I can just open a new window like this: redmine/login?user=user&pass=pass.
Hopefully not. If Redmine is built well (and I'd be reasonably sure it is) then it will only accept user credentials in a post operation, so as to avoid passwords being recorded via the URL in browsers, proxy servers and web servers. It would be poor security practice to attempt to log on this way, or for Redmine to permit you to do so.
One of the approaches I was suggesting in my earlier comment was for your PHP application to become a proxy for Redmine operations. There's two sub-categories here:
Use a programmatic browser component to carry out form operations in Redmine by visiting pages, clicking buttons, submitting forms etc. This is the "screen scraper" approach, but can be quite reliable since presumably Redmine does not change its HTML layout very often. Thus, the cookies you would normally have in your browser would be stored on the server instead.
Use an API built into Redmine. I guess there's not one as standard, but I found this one. I've not used it, so you'd need to test its suitability.
In either approach, you would not use Redmine directly at all: you would build the Redmine features you need into your PHP application, using forms to accept relevant user input, and rendering to the screen the output your server has received from Redmine.
This would work, but bear in mind that it's not a trivial project, either in terms of its size or complexity. If you are after a simpler alternative, then the browser password store is an option, but it won't log users on automatically, nor automatically discover the username you are logged on as in your PHP application.

AD user authentication against a security group in ASP combining it with PHP

so I am moving a small app from Winforms to a web app, and I am doing this mainly in PHP (since it is the only web scripting language I know).
So in Winforms (C#) I use this code to grant access to users (everything is done through a W2K8 server)
WindowsPrincipal principal = new WindowsPrincipal(identity);
principal.IsInRole("CKT.DEL.W_IT_RW")
Deepending on false or true, the app grants access to specif forms inside the app.
It is very simple from my point of view.
Now, I have PHP and IIS 7.5 inside said server, with Windows Authentication enabled.
I am able to get the logged username automatically from IE inside PHP (which is already super useful) using
$_SERVER['LOGON_USER']
I've seen lots of questions about LDAP integration with PHP and so, but it seems way too big for me since I don't want any other thing from AD but the group auth.
So I was thinking, could it be possible to make a single page of ASP.net (or meybe classic) to authenticate the user, then send soe value in a POST variable, read it with PHP and the create a SESSION variable to keep the user authenticated?

Wordpress MediaWiki Cookie Integration

I have my Wordpress install and MediaWiki sharing the same login information. Unfortunately, users need to log into both separately, but at least they use the same credentials.
What I would like to do is cause a successful login on the Wordpress blog to also cause a login for MediaWiki (ideally both directions). There are two ways this could happen:
Logging in causes a login on the other application (writes the cookie and creates the session in the DB)
Accessing an application checks for the cookie of the other and then automatically logs in.
Since the usernames are shared it seems like the latter should be pretty easy to do. Any tips would be great.
The primary problem you are going to run into is that you'll have two login forms, and two logout methods. What you need to do is pick one of the login forms as the default, and redirect the other one over to it.
I've been able to successfully integrate bbPress + MediaWiki + WordPress + WordPress MU, but I wrote a lot of custom code to do it.
I'm using the bbPress login page as the default (and .htaccess rewrite to /login/), and then I created my own MediaWiki authentication plugin (which looks a lot like the one you are using), except my plugin checks the WordPress/bbPress cookie for the login information and automatically logs the user in.
I created a customized /logout/ link that runs the bbPress logout, and also kills the MediaWiki cookies at the same time.
Then the last step was to redirect all of the other logout / login links for bbpress, mediawiki, etc, over to my consolidated one. I used .htaccess rewrites for this rather than mess with core code.
Still a work in progress, but it works fairly well.
You could consider some kind of single-sign-on software. I am unaware of any that are free and I've only ever used SiteMinder which is neither free nor good. Crowd may be better (but is again not free).
I've seen a setup going through Invision Power Board, using IpbWiki and a Wordpress integration mod. Mind you, it's expensive and excessive.
They both support OpenId now.
MediaWiki's extension
WordPress's plugin
There are probably other options for using OpenId, but I think that is the best solution available.

Categories