Pergunta

When a user logs in (using Laravel), can I redirect them from HTTPS one server to another HTTPS server? If so, how can I accomplish this using "plain" PHP without SSO or LDAP?

In my specific situation, I have two servers:

  1. Running Ubuntu with SSL, Apache, MySQL, and a Laravel DB where users will log in and
  2. Same setup as as #1 but without a database

let me rephrase that: WILL THAT BE SECURITY ISSUE ?? and how will i know that user is loged in on 1site?

Foi útil?

Solução

In order to achieve what you want then the following flow, probably modified, could work:

  1. Log into site1
  2. Upon successful login site1 cURLs site2 using HTTPS with predefined credentials to a RESTful interface
  3. Site2 checks the predefined credentials and creates a temporary id which is stored in the DB and responds to the cURL with the ID stored in the DB
    • ^ run a cron job every minute to clear ID's older than 5 seconds
  4. Site1 puts the ID in the URL and redirects to Site2
  5. Site2 gets the ID from the DB and authenticates the user
  6. Site2 deletes DB entry upon authentication

Outras dicas

If you're just looking for a simple redirect, consider using the header() function.

For example: header("Location: https://newurl/")

In Laravel, return Redirect::to('https://newurl/') does the trick.

The best way to achieve this, would be to have the setup that has a database, provide some basic REST API methods, and then create a custom session driver to call that API.

That being said, I am curious why you have the two apps segregated like that?

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top