PHP實現的SSO單點登陸系統,拿走就用吧

SSO單點登陸系統

好心人若是clone了,請來個star唄 謝謝

github地址

  • 功能介紹php

    • 登陸事後會在redis中存儲一條鍵名爲:insidetoken-41a6e5b9-a086-48a8-9b85-49d0f78685bc 以insidetoken-開頭的記錄,內部的值爲通過序列化的用戶信息。css

    • 而且在配置的域名中生成一條token=insidetoken-41a6e5b9-a086-48a8-9b85-49d0f78685bc的cookiehtml

    • 使用者可在各個系統獲取瀏覽器以及其餘設備發送給服務器的cookie進行redis中匹配來判斷用戶是否處於登陸狀態。mysql

  • 目錄結構介紹nginx

    • backend(前臺界面目錄)git

    • frontend(後端PHP目錄)github

  • 配置並使用redis

    • 進入backend目錄 執行 composer installsql

    • 系統token存儲於redis,請確保redis server開啓並處於可用狀態數據庫

    • 數據庫存儲使用mysql server,請導入backend/database/sql/insideaccount_user.sql

    • 配置.env 文件,修改DOMAIN=hb.com爲你本身的域名

    • 增長nginx配置,以下所示:

    1. {
      listen 80;
      server_name insideaccount.hb.com;
      root /Users/laolu/www/haibao-php-insideaccount/frontend/;
      index index.html;
      location ~ .*/.(css|js)$ {
      add_header Cache-Control 'no-store';
      }

      location /backend/ {

      proxy_pass http://127.0.0.1:9191/;
      proxy_set_header X-real-IP $remote_addr;
      proxy_set_header Host $host;
      proxy_redirect off;

      }
      }

    2. {
      listen 9191;
      root /Users/laolu/www/haibao-php-insideaccount/backend/public;
      index index.php;
      try_files $uri $uri/ /index.php?query_string;
      location ~ .php {

      fastcgi_pass 127.0.0.1:9000;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;

      }
      }

    • 預覽
      圖片描述

相關文章
相關標籤/搜索