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;

      }
      }

    • 预览
      图片描述

相关文章
相关标签/搜索