OA对接若依第三方系统时实现单点登录的一些笔记

本文介绍了在OA系统中实现与若依系统单点登录的详细步骤,包括前端创建Vue页面`login_sso.vue`,注册路由,添加白名单过滤,以及在store的user.js中增加单点登录方法。后端部分涉及LoginSsoController的创建,无验证码登录接口的添加,以及Shiro的白名单配置。最终实现用户在OA系统登录后,跳转若依系统页面无需再次登录。
摘要由CSDN通过智能技术生成

业务需求:

在oa系统里面左侧的菜单栏目里,都是oa自己的,现在需要实现左侧多一个菜单按钮,点击之后直接跳到另一个系统的一个页面(这里使用若依),用户的体验如同在同一个系统一样,并不了解是多个系统对接的。而在其中需要实现单点登录的功能,也就是用户在oa系统登录之后,跳转到第三方系统的页面时并不需要重复的登录。
在这里插入图片描述
本文使用的第三方系统是若依前后端分离版

前端

首先新起一个登录的Vue页面,新增login_sso.vue

在/src/view/下新增login_sso.vue文件作为自动登录的前端入口

<template>
  <div></div>
</template>


<script>

import {
     getInfo} from "@/api/login";

export default {
     
  name: "LoginSso",
  data() {
     
    return {
     
      loginRules: {
     },
      loading: false,
      //验证码开关
      captchaOnOff: true,
      //注册开关
      register: false,
      //重定向
      redirect: undefined,
      userInfo:{
     
        userName:"",
        password:""
      }
    };
  },
  watch: {
     
  },
  created() {
     
    //页面初始化时调单点登录方法
    this.loginSso();
  },
  mounted(){
     



  },
  methods: {
     
    loginSso(){
     
      console.log("获取")
      //获取地址栏中的用户名和密码  这里使用了地址传参,需要在oa系统那里自己配置
      this.userInfo.userName = this.$route.query.userName;
      this.userInfo.password = this.$route.query.password;
      console.log("名字是"+this.userInfo.userName)
      console.log("密码是"+this.userInfo.password)

      //调用登录的接口
      if(this.userInfo.userName==''||this.userInfo.userName==undefined||this.userInfo.userName==null){
     
        //请求中不带名字,拦截为正常登录
      }else{
     
        this.loading = true;//开启过渡动画
        console.log("开启过渡动画")
        const loginInfo = {
     
          "userName" : this.userInfo.userName,
          "password" : this.userInfo.password
        };

        //执行另一套登录操作
        //不是本系统的用户,去J平台登陆去
        this.$store.dispatch("LoginSso", loginInfo).then(() => {
     
          this.$message.success("登录成功");
          this.loading = false;

          //   //处理登录        下面的path根据自己的需要去写
            this.$router.push({
     path: '/cggl/index'}).catch(() => {
     
  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值